:root {
    /* Main background: Clean sky-gray */
    --bg: #f8fafc; 
    /* Card backgrounds: Pure white for clarity */
    --card: #ffffff; 
    /* Primary Aero Blue (#3f6ac9) */
    --mint: #3f6ac9; 
    /* Deep Navy for secondary accents and status indicators */
    --violet: #1e293b; 
    /* Text: High contrast charcoal */
    --text-high: #0f172a; 
    /* Muted text: Slate gray */
    --text-low: #64748b; 
    /* Borders: Soft blue-tinted gray */
    --border: #e2e8f0; 
    /* Sidebar/Dark Nav context */
    --side: #1e293b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--text-high);
    font-family: 'Plus Jakarta Sans', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- NAVIGATION --- */
.dashboard-nav {
    padding: 15px 5%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0; 
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo { 
    font-weight: 800; 
    font-size: 1.2rem; 
    letter-spacing: 2px; 
    color: var(--text-high); 
    text-decoration: none; 
}
.logo span { color: var(--mint); }

.nav-menu { display: flex; list-style: none; gap: 30px; }
.nav-menu a { text-decoration: none; color: var(--text-low); font-size: 0.9rem; font-weight: 600; transition: 0.3s; }
.nav-menu a.active, .nav-menu a:hover { color: var(--mint); }

.user-meta { display: flex; align-items: center; gap: 20px; color: var(--text-low); }
.notification-dot { position: relative; cursor: pointer; font-size: 1.1rem; }
.notification-dot::after { 
    content: ""; 
    position: absolute; 
    top: 0; right: 0; 
    width: 8px; height: 8px; 
    background: #ef4444; 
    border: 2px solid white; 
    border-radius: 50%; 
}

.avatar { 
    width: 35px; height: 35px; 
    background: var(--violet); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 800; font-size: 0.8rem; 
    color: white; 
}

/* --- CONTENT CONTAINER --- */
.swaps-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 5%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
}

.page-header h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); letter-spacing: -1px; color: var(--text-high); }
.page-header p { color: var(--text-low); font-weight: 500; font-size: 0.95rem; }

.stats-bar { display: flex; gap: 20px; }
.stat-item { display: flex; flex-direction: column; text-align: right; }
.stat-item .label { font-size: 0.65rem; text-transform: uppercase; color: var(--text-low); letter-spacing: 1px; font-weight: 700; }
.stat-item .value { font-size: 1.4rem; font-weight: 800; color: var(--mint); }

/* --- SECTION STYLES --- */
.swap-section { margin-bottom: 50px; }
.section-title { 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    letter-spacing: 1.5px; 
    margin-bottom: 20px; 
    color: var(--text-low); 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-weight: 700; 
}
.section-title i { color: var(--mint); }

/* --- SWAP ROWS --- */
.swap-row {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.swap-row:hover { 
    border-color: var(--mint); 
    transform: translateX(5px); 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08); 
}

.swap-row.pending { border-left: 5px solid var(--violet); }
.swap-info-main { flex: 1; }
.swap-route { font-size: 1.15rem; font-weight: 800; margin-bottom: 4px; color: var(--text-high); }
.swap-route i { font-size: 0.85rem; color: var(--mint); margin: 0 8px; }
.swap-meta { font-size: 0.8rem; color: var(--text-low); font-weight: 500; }

.status-pill { padding: 6px 12px; border-radius: 100px; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.status-pill.warning { background: #fff7ed; color: #ea580c; border: 1px solid #ffedd5; }

.swap-actions { display: flex; gap: 8px; margin-left: 20px; }
.btn-outline, .btn-danger { 
    padding: 8px 16px; 
    border-radius: 10px; 
    font-weight: 700; 
    cursor: pointer; 
    font-size: 0.8rem; 
    transition: 0.2s; 
}
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-high); }
.btn-outline:hover { background: #f1f5f9; }
.btn-danger { background: #fef2f2; border: 1px solid #fee2e2; color: #dc2626; }

.swap-row.completed { background: white; }
.swap-date {
    display: flex; flex-direction: column; align-items: center; 
    padding-right: 25px; border-right: 2px solid #f1f5f9; margin-right: 25px;
    min-width: 60px;
}
.swap-date .month { font-size: 0.65rem; font-weight: 800; color: var(--text-low); text-transform: uppercase; }
.swap-date .day { font-size: 1.5rem; font-weight: 900; line-height: 1; color: var(--violet); }

.swap-details-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.detail-block label { display: block; font-size: 0.55rem; color: var(--text-low); margin-bottom: 2px; font-weight: 700; text-transform: uppercase; }
.detail-block span { font-size: 0.85rem; font-weight: 600; display: block; color: var(--text-high); }
.partner { color: var(--mint) !important; }

.swap-outcome { text-align: right; margin-left: 20px; }
.savings-tag { color: #10b981; font-weight: 800; font-size: 0.8rem; margin-bottom: 8px; }
.btn-download {
    background: var(--violet); color: white; border: none; 
    padding: 10px 16px; border-radius: 10px; font-weight: 700; 
    font-size: 0.8rem; cursor: pointer; display: flex; align-items: center; gap: 8px;
    transition: 0.3s; white-space: nowrap;
}
.btn-download:hover { background: var(--mint); transform: translateY(-2px); }

/* --- MODAL & BOARDING PASS --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: 0.4s;
    padding: 20px;
}

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

.modal-content {
    width: 100%;
    max-width: 420px;
    position: relative;
    transform: translateY(30px);
    transition: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content { transform: translateY(0); }

.close-modal {
    position: absolute;
    top: -45px; right: 0;
    background: transparent; border: none;
    color: white; font-size: 2rem; cursor: pointer;
}

.boarding-pass {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}

.pass-header {
    background: var(--side);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pass-logo { color: white; font-weight: 800; letter-spacing: 1.5px; font-size: 0.85rem; }
.pass-logo span { color: var(--mint); }
.flight-class { color: var(--mint); font-size: 0.6rem; font-weight: 800; border: 1px solid var(--mint); padding: 3px 8px; border-radius: 4px; }

.pass-main { padding: 30px 25px; background: white; }
.pass-route { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.pass-route .code { font-size: 2.2rem; font-weight: 900; color: var(--text-high); line-height: 1; }
.pass-route .full { font-size: 0.75rem; color: var(--text-low); font-weight: 600; text-transform: uppercase; display: block; }
.pass-route i { font-size: 1.2rem; color: var(--mint); }

.pass-details { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pass-details .item label { display: block; font-size: 0.6rem; color: var(--text-low); font-weight: 800; margin-bottom: 4px; }
.pass-details .item strong { font-size: 0.9rem; color: var(--text-high); }

.pass-barcode {
    padding: 25px;
    background: #f8fafc;
    border-top: 2px dashed #e2e8f0;
    text-align: center;
}

.barcode-lines {
    height: 50px; width: 100%;
    background: repeating-linear-gradient(90deg, #1e293b, #1e293b 2px, transparent 2px, transparent 5px);
    margin-bottom: 12px;
}

.ticket-id { font-size: 0.65rem; font-weight: 700; color: var(--text-low); letter-spacing: 1.5px; }

.btn-print {
    width: 100%; margin-top: 15px;
    background: white; color: var(--text-high);
    border: none; padding: 16px; border-radius: 12px;
    font-weight: 800; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 900px) {
    .page-header { flex-direction: column; align-items: flex-start; gap: 20px; }
    .stats-bar { width: 100%; justify-content: flex-start; }
    .stat-item { text-align: left; }
    
    .swap-row { flex-direction: column; align-items: flex-start; gap: 15px; }
    .swap-date { 
        border-right: none; border-bottom: 1px solid #f1f5f9; 
        width: 100%; padding: 0 0 10px 0; margin-right: 0; 
        flex-direction: row; justify-content: flex-start; gap: 10px;
    }
    .swap-details-grid { grid-template-columns: 1fr 1fr; width: 100%; gap: 15px; }
    .swap-outcome { margin-left: 0; width: 100%; text-align: left; padding-top: 10px; border-top: 1px solid #f1f5f9; }
    .btn-download { width: 100%; justify-content: center; }
    .swap-actions { margin-left: 0; width: 100%; }
    .swap-actions button { flex: 1; text-align: center; }
}

@media (max-width: 768px) {
    .nav-menu { display: none; } /* Mobile would use a hamburger menu usually */
    .dashboard-nav { padding: 10px 4%; }
    .nav-container { gap: 10px; }
}

@media (max-width: 480px) {
    .swaps-container { margin: 20px auto; }
    .swap-details-grid { grid-template-columns: 1fr; }
    .pass-route .code { font-size: 1.8rem; }
    .pass-main { padding: 20px; }
    .pass-header { padding: 15px 20px; }
    .modal-content { max-width: 100%; }
}

/* Print Overrides */
@media print {
    .dashboard-nav, .page-header, .swap-section, .mini-footer, .close-modal, .btn-print { display: none !important; }
    .modal-overlay { position: relative; background: white; opacity: 1; pointer-events: auto; }
    .boarding-pass { box-shadow: none; border: 1px solid #eee; }
}


/* Footer */
.mini-footer { text-align: center; padding: 40px; color: var(--text-low); font-size: 0.8rem; border-top: 1px solid var(--border); margin-top: 40px; }
