/* ==========================================================================
   E-Mirsal II Invoice & XML Converter — SaaS Styling for UAE Trade Portal
   ========================================================================== */

:root {
    --m2-primary: #059669;
    --m2-primary-hover: #047857;
    --m2-primary-light: #ecfdf5;
    --m2-accent: #0f172a;
    --m2-dark: #090e17;
    --m2-text-dark: #0f172a;
    --m2-text-muted: #64748b;
    --m2-border: #cbd5e1;
    --m2-border-focus: #059669;
    --m2-card-bg: #ffffff;
    --m2-success: #10b981;
    --m2-warning: #f59e0b;
    --m2-danger: #ef4444;
    --m2-info: #0284c7;
    --m2-purple: #8b5cf6;
}

/* Hero Section */
.m2-hero {
    background: linear-gradient(135deg, #090e17 0%, #0f172a 45%, #064e3b 100%);
    color: #ffffff;
    padding: 2.25rem 0 1.75rem;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.m2-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -15%;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.m2-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.m2-hero p {
    font-size: 1.02rem;
    color: #e2e8f0;
    max-width: 720px;
    line-height: 1.55;
    margin-bottom: 0;
}

/* High Contrast Guide Button */
.m2-btn-guide {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.55) !important;
    font-weight: 700 !important;
    font-size: 0.88rem !important;
    padding: 8px 20px !important;
    border-radius: 30px !important;
    transition: all 0.2s ease !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    white-space: nowrap;
}

.m2-btn-guide:hover {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.m2-btn-guide:hover span {
    color: #0f172a !important;
}

/* Main Container */
.m2-main-wrapper {
    background: #f8fafc;
    padding: 1.5rem 0 4rem;
    color: var(--m2-text-dark);
}

.m2-main-wrapper .container,
.m2-hero .container {
    max-width: 1720px !important;
    width: 100% !important;
}

/* Feature & Preset Chips */
.m2-preset-btn {
    background: #ffffff;
    border: 1.5px solid var(--m2-border);
    color: #0f172a;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 20px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.m2-preset-btn:hover {
    background: var(--m2-primary-light);
    border-color: var(--m2-primary);
    color: var(--m2-primary-hover);
    transform: translateY(-1px);
}

/* Converter Card */
.m2-card {
    background: var(--m2-card-bg);
    border: 1.5px solid var(--m2-border);
    border-radius: 16px;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    margin-bottom: 1.75rem;
}

.m2-card-header {
    background: #ffffff;
    border-bottom: 1.5px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.m2-card-header h2,
.m2-card-header h3 {
    color: #0f172a;
    font-weight: 800;
}

.m2-card-body {
    padding: 1.5rem;
}

/* Paste Catch Area */
.m2-paste-zone {
    background: #f0fdf4;
    border: 2px dashed #059669;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.m2-paste-zone:hover,
.m2-paste-zone.dragover {
    background: #dcfce7;
    border-color: #047857;
    transform: scale(1.005);
}

.m2-paste-zone-icon {
    font-size: 2.5rem;
    color: #059669;
    margin-bottom: 0.5rem;
}

/* Form Controls */
.m2-form-label {
    color: #1e293b !important;
    font-weight: 700 !important;
    font-size: 0.82rem !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 5px;
    display: block;
}

.m2-form-control,
.m2-form-select {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #94a3b8 !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    padding: 0.55rem 0.75rem !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.m2-form-control:focus,
.m2-form-select:focus {
    border-color: var(--m2-primary) !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2) !important;
    outline: none;
}

/* Spreadsheet Table Styling */
.m2-table-responsive {
    max-height: 600px;
    overflow-x: auto !important;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    border: 1.5px solid var(--m2-border);
    border-radius: 10px;
    background: #ffffff;
    box-sizing: border-box;
}

.m2-grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.m2-grid-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #0f172a;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.m2-grid-table tbody td {
    padding: 6px 6px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    vertical-align: middle;
}

.m2-grid-table tbody tr:hover td {
    background-color: #f8fafc;
}

.m2-grid-table tbody tr.row-invalid td {
    background-color: #fef2f2 !important;
}

.m2-grid-table tbody tr.row-warning td {
    background-color: #fffbeb !important;
}

.m2-grid-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s;
}

.m2-grid-input:focus {
    border-color: var(--m2-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.m2-grid-select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 5px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
    background: #ffffff;
}

/* HS Code Badge inside cell */
.m2-hs-badge {
    font-size: 0.75rem;
    font-weight: 800;
    background: #0f172a;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 3px;
}

.m2-hs-duty-badge {
    font-size: 0.72rem;
    font-weight: 700;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
}

/* Sticky Summary Card */
.m2-sticky-sidebar {
    position: sticky;
    top: 24px;
    z-index: 10;
}

.m2-summary-card {
    background: linear-gradient(145deg, #090e17 0%, #0f172a 50%, #064e3b 100%) !important;
    color: #ffffff !important;
    border-radius: 18px;
    padding: 1.75rem;
    box-shadow: 0 12px 36px -4px rgba(15, 23, 42, 0.35);
    border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
}

.m2-summary-card .text-white-50 {
    color: #cbd5e1 !important;
    opacity: 1 !important;
}

.m2-main-display {
    text-align: center;
    padding: 1.35rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    margin-bottom: 1.5rem;
}

.m2-main-number {
    font-size: 2.65rem;
    font-weight: 900;
    line-height: 1;
    color: #34d399;
    text-shadow: 0 2px 10px rgba(52, 211, 153, 0.25);
    font-feature-settings: "tnum";
}

.m2-main-unit {
    font-size: 0.92rem;
    font-weight: 800;
    color: #f1f5f9;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 6px;
}

.m2-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.m2-stat-box {
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.m2-stat-label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #a7f3d0;
    font-weight: 800;
    margin-bottom: 3px;
}

.m2-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: #ffffff;
}

/* Export Buttons */
.m2-btn-export-txt {
    background: #10b981;
    color: #ffffff !important;
    font-weight: 800;
    border-radius: 10px;
    border: none;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.m2-btn-export-txt:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.m2-btn-export-xml {
    background: #0284c7;
    color: #ffffff !important;
    font-weight: 800;
    border-radius: 10px;
    border: none;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.m2-btn-export-xml:hover {
    background: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.3);
}

.m2-btn-outline {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 8px;
    padding: 8px 14px;
    transition: all 0.2s ease;
}

.m2-btn-outline:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: #ffffff;
}

/* Toast Notifications */
.m2-toast-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.m2-toast {
    background: #0f172a;
    color: #ffffff;
    border-left: 4px solid #10b981;
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    font-size: 0.9rem;
    font-weight: 600;
    animation: m2ToastIn 0.3s ease;
}

@keyframes m2ToastIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Educational Info Card */
.m2-info-card {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    padding: 1.75rem;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

/* Pre-Flight Discrepancies Alerts */
#validationAlertsBox,
#validationAlertsBox * {
    color: #ffffff !important;
}

#validationAlertsList li {
    color: #ffffff !important;
    font-size: 0.82rem;
    line-height: 1.4;
    margin-bottom: 3px;
}

/* Mobile & Small Device Overflow Protection */
@media (max-width: 991.98px) {
    .m2-hero {
        padding: 2rem 1rem 1.5rem;
        text-align: center;
    }
    .m2-hero h1 {
        font-size: 1.65rem;
    }
    .m2-hero p {
        font-size: 0.92rem;
    }
    .m2-main-wrapper {
        padding: 1.25rem 0 3rem;
    }
    .m2-card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .m2-paste-zone {
        padding: 1.5rem 1rem;
    }
    .m2-info-card {
        padding: 1.25rem 1rem;
    }
    .m2-btn-export-txt,
    .m2-btn-export-xml {
        width: 100%;
        font-size: 0.95rem;
    }
}

