/* ============================================
   FLY Portal — Employee Flight Booking
   Design System & Component Styles
   ============================================ */

:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #93C5FD;
    --primary-50: rgba(59, 130, 246, 0.08);
    --primary-100: rgba(59, 130, 246, 0.15);

    --secondary: #1f2937;
    --secondary-light: #374151;

    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --info: #06b6d4;
    --info-light: rgba(6, 182, 212, 0.12);

    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --bg-input: #f9fafb;

    --border: #e5e7eb;
    --border-light: #f3f4f6;

    --text: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.06);
    --shadow-primary: 0 4px 14px rgba(59, 130, 246, 0.35);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --header-height: 64px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }

#app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 20px;
    background: var(--bg);
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Layout --- */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.header-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-primary);
}

.header-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.04em;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-nav-item {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    position: relative;
    border: none;
    background: none;
    font-family: var(--font);
}

.header-nav-item:hover {
    color: var(--text);
    background: var(--bg);
}

.header-nav-item.active {
    color: var(--primary);
    background: var(--primary-50);
    font-weight: 600;
}

.header-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -13px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: none;
    font-family: var(--font);
}

.header-user:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.header-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.header-user-company {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px;
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left { display: flex; flex-direction: column; gap: 4px; }

.page-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
    transform: translateY(-1px);
}

.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-light); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; height: 32px; }

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-sm); }

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.card-body { padding: 22px; }

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-50); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }

.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* --- Data Table --- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
}

.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.data-table th {
    background: var(--bg);
    padding: 12px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--primary-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: var(--primary-100); }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: #16a34a; }
.badge-warning { background: var(--warning-light); color: #d97706; }
.badge-danger { background: var(--danger-light); color: #dc2626; }
.badge-info { background: var(--info-light); color: #0891b2; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-primary { background: var(--primary-50); color: var(--primary); }

/* --- Forms --- */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }

.form-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: var(--font);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #fff;
}

.form-input::placeholder { color: var(--text-muted); }

.form-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: var(--font);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    transition: all var(--transition-fast);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background-color: #fff;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.25s ease;
}

.modal-header {
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); }

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; }

.modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--primary-50);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.empty-state-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state-text { font-size: 0.875rem; color: var(--text-secondary); max-width: 340px; line-height: 1.6; }

/* --- Login --- */
.login-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

.login-form-side {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-visual-side {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary), #1d4ed8);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.login-visual-side::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-visual-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
    padding: 40px;
}

.login-visual-title { font-size: 2rem; font-weight: 700; margin-bottom: 12px; }
.login-visual-text { font-size: 1rem; opacity: 0.85; max-width: 320px; margin: 0 auto; line-height: 1.7; }

.login-form-container { width: 100%; max-width: 400px; }

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }

.login-brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-primary);
}

.login-brand-name { font-size: 1.35rem; font-weight: 700; color: var(--text); letter-spacing: 0.04em; }

.login-welcome { margin-bottom: 32px; }
.login-welcome h2 { font-size: 1.45rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-welcome p { font-size: 0.9rem; color: var(--text-secondary); }

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }
.form-input-lg { padding: 14px 16px; font-size: 0.95rem; border-radius: var(--radius); }

/* --- Flight Card --- */
.flight-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all var(--transition);
}

.flight-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

/* --- Booking Timeline --- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 20px;
    border-left: 2px solid var(--border);
    margin-left: 8px;
}

.timeline-item {
    position: relative;
    padding: 12px 0 12px 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary-light);
}

.timeline-item.completed::before { background: var(--success); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3); }
.timeline-item.pending::before { background: var(--warning); box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3); }
.timeline-item.cancelled::before { background: var(--danger); box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3); }

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    animation: slideIn 0.35s ease;
    border-left: 4px solid var(--border);
    min-width: 300px;
}

.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-error { border-left-color: var(--danger); }

.toast-icon { flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.toast-success .toast-icon { color: var(--success); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-error .toast-icon { color: var(--danger); }

.toast-body { flex: 1; }
.toast-title { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.toast-message { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    transition: color var(--transition-fast);
}

.toast-close:hover { color: var(--text); }

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* --- Utilities --- */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .main-content { padding: 20px 16px; }
    .app-header { padding: 0 16px; }
    .header-nav { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .login-split { grid-template-columns: 1fr; }
    .login-visual-side { display: none; }
    .toast-container { left: 16px; right: 16px; max-width: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
