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

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    
    --danger: #f43f5e;
    --danger-bg: #fff1f2;
    --danger-border: #fecdd3;
    
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    
    --info: #0284c7;
    --info-bg: #f0f9ff;
    
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: #1e293b;
    --sidebar-border: #1e293b;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.9375rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Mobile Header */
.mobile-header {
    display: none;
    background: var(--sidebar-bg);
    padding: 0.85rem 1.25rem;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--sidebar-border);
}

.mobile-header img {
    height: 32px;
    width: auto;
    filter: brightness(0) invert(1);
}

.mobile-menu-btn {
    background: transparent;
    border: none;
    color: #f8fafc;
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 49;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

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

/* App Container Layout */
.app-container {
    display: flex;
    width: 100%;
    flex: 1;
}

/* Sidebar Styling */
.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 100vh;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    padding: 1.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand img {
    height: 38px;
    width: auto;
    filter: brightness(0) invert(1);
}

.sidebar-brand-text {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.85rem;
    flex: 1;
    gap: 0.35rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    opacity: 0.8;
}

.nav-item:hover {
    background: var(--sidebar-active-bg);
    color: #f8fafc;
}

.nav-item.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-item.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    color: #cbd5e1;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: #64748b;
}

.logout-btn {
    color: var(--danger);
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s ease;
}

.logout-btn:hover {
    background: rgba(244, 63, 94, 0.1);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 2rem 2.5rem;
    background: var(--bg-page);
    min-width: 0;
}

/* Top Action Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header-left h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.page-header-left p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.2rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Filter Controls Header Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg-card);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.75rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.35rem;
}

/* Currency & Period Switchers */
.segmented-control {
    display: inline-flex;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    gap: 0.25rem;
}

.segmented-control a, .segmented-control button {
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    border: none;
    background: transparent;
    cursor: pointer;
}

.segmented-control a.active, .segmented-control button.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.segmented-control a:hover:not(.active), .segmented-control button:hover:not(.active) {
    color: var(--text-primary);
}

/* Dashboard Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.metric-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon-box.indigo { background: #eef2ff; color: #4f46e5; }
.metric-icon-box.blue { background: #e0f2fe; color: #0284c7; }
.metric-icon-box.emerald { background: #ecfdf5; color: #10b981; }
.metric-icon-box.rose { background: #fff1f2; color: #f43f5e; }
.metric-icon-box.amber { background: #fffbeb; color: #d97706; }

.metric-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-amount {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.metric-subtitle {
    font-size: 0.775rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* Cards & Panels */
.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-panel-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.table-custom th {
    background: #f8fafc;
    padding: 0.85rem 1.25rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.table-custom td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

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

.table-custom tr:hover td {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-deposit, .badge-paid, .badge-success {
    background: var(--success-bg);
    color: #047857;
    border: 1px solid var(--success-border);
}

.badge-withdrawal, .badge-void, .badge-danger {
    background: var(--danger-bg);
    color: #b91c1c;
    border: 1px solid var(--danger-border);
}

.badge-due, .badge-warning {
    background: var(--warning-bg);
    color: #b45309;
    border: 1px solid var(--warning-border);
}

.badge-currency {
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #e11d48;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

/* Forms & Inputs */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    line-height: 1.35;
}

/* Airline "Tickets Sold" cards (dashboard) — equal height, logo + big quantity */
.airline-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 1rem;
}

.airline-card {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-hover);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.airline-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.airline-card--active {
    border-left-color: var(--success);
}

.airline-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.airline-logo,
.airline-logo-fallback {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: #ffffff;
    flex-shrink: 0;
}

.airline-logo {
    object-fit: contain;
    padding: 4px;
}

.airline-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

/* Fixed two-line box keeps every card the same height regardless of name length */
.airline-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    min-height: 2.7em;
    margin-bottom: 0.7rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.airline-card-sold {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border-color);
}

.airline-card-qty {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.airline-card-qty--has {
    color: var(--success);
}

.airline-card-qty--none {
    color: var(--text-muted);
    opacity: 0.55;
}

.airline-card-sold-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-align: right;
}

/* Alerts */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: #991b1b;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: #065f46;
}

/* Detail Profile Header */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
}

.profile-info h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}

.profile-balance-box {
    text-align: right;
    background: #f8fafc;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.profile-balance-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.profile-balance-value {
    font-size: 1.4rem;
    font-weight: 700;
}

/* Modal Dialogs */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    padding: 1.5rem;
    overflow-y: auto;
    align-items: flex-start;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 720px;
    margin: auto;
    animation: modal-in 0.15s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Tabs */
.tabs-header {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-item {
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-item:hover:not(.active) {
    color: var(--text-primary);
}

/* Invoice View / Printable Sheet */
.invoice-paper {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    max-width: 850px;
    margin: 0 auto 2rem;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 1.75rem;
    margin-bottom: 1.75rem;
}

.invoice-logo img {
    height: 44px;
    width: auto;
}

.invoice-details {
    text-align: right;
}

.invoice-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.invoice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Media Queries for Responsive Design */
@media (max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0.75rem;
    }
    .modal-body {
        padding: 1.15rem;
    }
    .mobile-header {
        display: flex;
    }
    .sidebar-overlay {
        display: block;
    }
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -260px;
        z-index: 50;
        transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }
    .sidebar.open {
        left: 0;
    }
    .main-content {
        padding: 1.25rem 1rem;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.full-width {
        grid-column: span 1;
    }
    .profile-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .profile-balance-box {
        width: 100%;
        text-align: left;
    }
}

/* Print Styles */
@media print {
    .mobile-header, .sidebar, .sidebar-overlay, .page-header, .no-print, .btn {
        display: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .main-content {
        padding: 0 !important;
    }
    .invoice-paper {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
}
