@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Color Palette */
    --primary: hsl(221, 83%, 53%);
    --primary-hover: hsl(221, 83%, 45%);
    --primary-light: hsl(221, 83%, 95%);
    --dark: hsl(222, 47%, 11%);
    --dark-muted: hsl(220, 9%, 46%);
    --bg: hsl(210, 20%, 98%);
    --bg-gradient: linear-gradient(135deg, hsl(210, 30%, 99%) 0%, hsl(220, 15%, 94%) 100%);
    --card-bg: rgba(255, 255, 255, 0.7);
    --border-color: rgba(226, 232, 240, 0.8);
    --success: hsl(142, 72%, 29%);
    --success-bg: hsl(142, 72%, 95%);
    --warning: hsl(38, 92%, 50%);
    --error: hsl(0, 84%, 60%);
    
    /* Layout Variables */
    --sidebar-width: 260px;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Microsoft JhengHei', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Navigation Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2.5rem;
}

.logo-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, hsl(260, 80%, 60%) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--dark) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--dark-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.nav-link i {
    font-size: 1.2rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-link.active {
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--dark-muted);
}

/* Main Content Area */
.content-wrapper {
    margin-left: var(--sidebar-width);
    padding: 3rem;
    flex-grow: 1;
    min-height: 100vh;
    min-width: 0;
    max-width: calc(100vw - var(--sidebar-width));
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 2.25rem;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* UI Cards (Glassmorphism) */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Typography and Labels */
h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

p.description {
    color: var(--dark-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, hsl(221, 83%, 43%) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, hsl(0, 84%, 50%) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.3);
}

/* Inputs and Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dark-muted);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: var(--bg);
    padding: 14px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dark-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 14px 20px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--dark);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(248, 250, 252, 0.8);
}

/* Modals and Overlays */
.overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition);
}

.overlay.active .modal {
    transform: scale(1);
}

/* Micro-animations and loaders */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Notifications */
.notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-success {
    border-left: 4px solid var(--success);
}

.notification-error {
    border-left: 4px solid var(--error);
}

/* Premium Fullscreen Modal System */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.82) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    z-index: 999999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    background: #ffffff !important;
    color: #0f172a !important;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    width: 95vw !important;
    max-width: 1360px !important;
    max-height: 92vh !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000000 !important;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.modal-header-bar {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header-bar h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    margin: 0;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.9);
    color: #ffffff;
    transform: rotate(90deg);
}

.modal-body-content {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

/* Upload zone */
.pdf-upload-zone {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px dashed #3b82f6;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
}

.pdf-upload-zone:hover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-2px);
}

/* Stats Cards Banner */
.rec-stats-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.rec-stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 18px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.rec-stat-label {
    font-size: 0.76rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.rec-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

/* Reconciliation Matrix Table */
.rec-table-wrapper {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: auto;
    max-height: 480px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    background: #ffffff;
}

.rec-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.83rem;
}

.rec-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 10px 8px;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap;
    z-index: 10;
}

.rec-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #1e293b;
}

.rec-table tr:hover {
    background-color: #f8fafc;
}

.rec-size-cell {
    text-align: center;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.rec-size-cell.active-size {
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 800;
    border-radius: 6px;
}

/* Badge pills */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-pill-exact {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.badge-pill-unmatched {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-pill-diff {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

/* Select dropdown in table */
.rec-select {
    width: 100%;
    max-width: 240px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    font-size: 0.82rem;
    color: #0f172a;
    transition: all 0.2s ease;
}

.rec-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Modal Footer Action Bar */
.modal-footer-bar {
    padding: 16px 28px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Searchable Select Dropdown */
.searchable-select-wrap {
    position: relative;
    width: 100%;
}
.searchable-select-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    list-style: none;
    padding: 6px;
    margin: 0;
    display: none;
}
.searchable-select-list li {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.15s ease;
}
.searchable-select-list li:hover,
.searchable-select-list li.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

