/* --- CRITICAL ADMIN BAR PATCH --- */
/* This restores the WordPress top bar that Tailwind tries to hide */
#wpadminbar {
    box-sizing: content-box !important;
    z-index: 99999 !important;
}
#wpadminbar * {
    box-sizing: content-box !important;
}
html {
    margin-top: 32px !important;
}
@media screen and (max-width: 782px) {
    html { margin-top: 46px !important; }
}

/* --- DARK MODE --- */
/* Uses #id specificity to override Tailwind CDN runtime styles */
#tfa-dashboard-root.tfa-dark-mode {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}

#tfa-dashboard-root.tfa-dark-mode header {
    background-color: #020617 !important;
    border-color: #334155 !important;
}

#tfa-dashboard-root.tfa-dark-mode .bg-white,
#tfa-dashboard-root.tfa-dark-mode .bg-slate-50,
#tfa-dashboard-root.tfa-dark-mode .bg-slate-100 {
    background-color: #1e293b !important;
}

#tfa-dashboard-root.tfa-dark-mode .bg-gradient-to-br,
#tfa-dashboard-root.tfa-dark-mode .bg-gradient-to-r {
    background: #1e293b !important;
}

#tfa-dashboard-root.tfa-dark-mode .text-slate-900,
#tfa-dashboard-root.tfa-dark-mode .text-slate-800,
#tfa-dashboard-root.tfa-dark-mode .text-slate-700 {
    color: #f1f5f9 !important;
}

#tfa-dashboard-root.tfa-dark-mode .text-slate-600,
#tfa-dashboard-root.tfa-dark-mode .text-slate-500,
#tfa-dashboard-root.tfa-dark-mode .text-slate-400 {
    color: #94a3b8 !important;
}

#tfa-dashboard-root.tfa-dark-mode .text-lg,
#tfa-dashboard-root.tfa-dark-mode h2,
#tfa-dashboard-root.tfa-dark-mode h3,
#tfa-dashboard-root.tfa-dark-mode h4 {
    color: #f1f5f9 !important;
}

#tfa-dashboard-root.tfa-dark-mode .border-slate-200,
#tfa-dashboard-root.tfa-dark-mode .border-slate-100,
#tfa-dashboard-root.tfa-dark-mode .border {
    border-color: #334155 !important;
}

#tfa-dashboard-root.tfa-dark-mode .divide-slate-100 > :not(:last-child) {
    border-color: #334155 !important;
}

#tfa-dashboard-root.tfa-dark-mode input,
#tfa-dashboard-root.tfa-dark-mode select {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

#tfa-dashboard-root.tfa-dark-mode .shadow-sm,
#tfa-dashboard-root.tfa-dark-mode .shadow-md {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

#tfa-dashboard-root.tfa-dark-mode .rounded-xl.border,
#tfa-dashboard-root.tfa-dark-mode .rounded-lg.border {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

#tfa-dashboard-root.tfa-dark-mode table thead,
#tfa-dashboard-root.tfa-dark-mode table thead th {
    background-color: #0f172a !important;
    color: #94a3b8 !important;
}

#tfa-dashboard-root.tfa-dark-mode table tbody tr {
    border-color: #1e293b !important;
}

#tfa-dashboard-root.tfa-dark-mode table tbody td {
    color: #cbd5e1 !important;
}

#tfa-dashboard-root.tfa-dark-mode table tbody .font-bold {
    color: #f1f5f9 !important;
}

#tfa-dashboard-root.tfa-dark-mode table tbody .text-indigo-600 {
    color: #818cf8 !important;
}

#tfa-dashboard-root.tfa-dark-mode table tbody .text-emerald-600 {
    color: #34d399 !important;
}

#tfa-dashboard-root.tfa-dark-mode .bg-indigo-50,
#tfa-dashboard-root.tfa-dark-mode .bg-blue-50 {
    background-color: #1e1b4b !important;
}

#tfa-dashboard-root.tfa-dark-mode .bg-green-50,
#tfa-dashboard-root.tfa-dark-mode .bg-emerald-50 {
    background-color: #022c22 !important;
}

#tfa-dashboard-root.tfa-dark-mode .bg-red-50 {
    background-color: #450a0a !important;
}

#tfa-dashboard-root.tfa-dark-mode .text-indigo-900,
#tfa-dashboard-root.tfa-dark-mode .text-indigo-800 {
    color: #c7d2fe !important;
}

#tfa-dashboard-root.tfa-dark-mode .text-emerald-800,
#tfa-dashboard-root.tfa-dark-mode .text-emerald-700 {
    color: #6ee7b7 !important;
}

#tfa-dashboard-root.tfa-dark-mode .border-l-4.border-emerald-500 {
    background: #022c22 !important;
}

#tfa-dashboard-root.tfa-dark-mode .border-l-4.border-red-500 {
    background: #450a0a !important;
}

#tfa-dashboard-root.tfa-dark-mode .bg-gradient-to-r.from-blue-50 {
    background: #1e1b4b !important;
}

#tfa-dashboard-root.tfa-dark-mode .bg-green-600 {
    background-color: #16a34a !important;
}

#tfa-dashboard-root.tfa-dark-mode .tfa-status {
    color: #64748b !important;
    border-color: #334155 !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-dark-mode-toggle,
#tfa-dashboard-root.tfa-dark-mode #tfa-fullscreen-toggle {
    border-color: #475569 !important;
    background-color: #1e293b !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-dark-mode-toggle:hover,
#tfa-dashboard-root.tfa-dark-mode #tfa-fullscreen-toggle:hover {
    background-color: #334155 !important;
}

#tfa-dashboard-root.tfa-dark-mode canvas {
    filter: brightness(0.85);
}

#tfa-dashboard-root.tfa-dark-mode #tfa-ticker-tape {
    background: #020617 !important;
}

/* Dark Mode: Flight Manifest */
#tfa-dashboard-root.tfa-dark-mode #tfa-flight-log .bg-slate-100 {
    background-color: #0f172a !important;
}

#tfa-dashboard-root.tfa-dark-mode .tfa-filter-btn {
    background-color: #334155 !important;
    color: #cbd5e1 !important;
    border: 1px solid #475569 !important;
}

#tfa-dashboard-root.tfa-dark-mode .tfa-filter-btn:hover {
    background-color: #475569 !important;
    color: #f1f5f9 !important;
}

#tfa-dashboard-root.tfa-dark-mode .tfa-filter-btn.active {
    background-color: #2563eb !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flight-search {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flight-search::placeholder {
    color: #64748b !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table thead {
    background-color: #0f172a !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table thead th {
    background-color: #0f172a !important;
    color: #64748b !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table thead th:hover {
    background-color: #1e293b !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table tbody tr {
    border-color: #1e293b !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table tbody td {
    color: #cbd5e1 !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table tbody td a {
    color: #60a5fa !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table .bg-red-50 {
    background-color: #450a0a !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table .bg-red-100 {
    background-color: #7f1d1d !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table .text-red-700,
#tfa-dashboard-root.tfa-dark-mode #tfa-flights-table .text-red-900 {
    color: #fca5a5 !important;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-flight-log .bg-slate-50 {
    background-color: #0f172a !important;
}

/* --- ENHANCED ANIMATIONS --- */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* --- SKELETON LOADING --- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

#tfa-dashboard-root.tfa-dark-mode .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

/* --- ENHANCED HOVER EFFECTS --- */
.hover-lift {
    transition: all 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* --- DASHBOARD STYLES --- */
#tfa-dashboard-root {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.tfa-status {
    padding: 8px 16px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    text-align: right;
}

.tfa-chart-container {
    padding-bottom: 20px;
}

/* --- ENHANCED TABLE STYLES --- */
#tfa-dataTableBody tr {
    transition: all 0.2s ease-in-out;
    border-left: 3px solid transparent;
}

#tfa-dataTableBody tr:hover {
    background-color: rgba(59, 130, 246, 0.05) !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
    position: relative;
    z-index: 10;
}

#tfa-dashboard-root.tfa-dark-mode #tfa-dataTableBody tr:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

/* --- SPARKLINE STYLES --- */
.sparkline {
    display: block;
    width: 100%;
}

.sparkline polyline {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.sparkline:hover polyline {
    opacity: 1;
}

/* --- FILTER BUTTON STYLES --- */
.tfa-filter-btn {
    background-color: #e2e8f0;
    color: #475569;
    cursor: pointer;
    border: 1px solid transparent;
}

.tfa-filter-btn:hover {
    background-color: #cbd5e1;
    color: #334155;
}

.tfa-filter-btn.active {
    background-color: #2563eb !important;
    color: #fff !important;
    border-color: #2563eb !important;
}

/* --- SEARCH INPUT STYLES --- */
#tfa-flight-search {
    min-width: 200px;
}

#tfa-flight-search::placeholder {
    color: #94a3b8;
}

#tfa-flight-search:focus {
    outline: none;
}

/* --- HOURLY TABLE ROW HIGHLIGHTING --- */
.tfa-rush-hour-row {
    animation: tfaTablePulse 2s ease-in-out infinite;
    border-left: 4px solid #dc2626 !important;
}

@keyframes tfaTablePulse {
    0%, 100% {
        background-color: rgba(254, 226, 226, 0.3);
        box-shadow: 0 0 0px rgba(220, 38, 38, 0);
    }
    50% {
        background-color: rgba(254, 226, 226, 0.7);
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.3), inset 0 0 20px rgba(220, 38, 38, 0.1);
    }
}

#tfa-dashboard-root.tfa-dark-mode .tfa-rush-hour-row {
    animation: tfaTablePulseDark 2s ease-in-out infinite;
}

@keyframes tfaTablePulseDark {
    0%, 100% {
        background-color: rgba(127, 29, 29, 0.3);
        box-shadow: 0 0 0px rgba(220, 38, 38, 0);
    }
    50% {
        background-color: rgba(127, 29, 29, 0.6);
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.4), inset 0 0 20px rgba(220, 38, 38, 0.2);
    }
}


/* --- STATUS BADGES --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.delayed {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.cancelled {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.ontime {
    background-color: #d1fae5;
    color: #065f46;
}

/* --- SCROLLBAR STYLING --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#tfa-dashboard-root.tfa-dark-mode ::-webkit-scrollbar-track {
    background: #0f172a;
}

#tfa-dashboard-root.tfa-dark-mode ::-webkit-scrollbar-thumb {
    background: #475569;
}

/* --- RESPONSIVE ENHANCEMENTS --- */
@media (max-width: 768px) {
    #tfa-kpi-box > div {
        padding: 1rem !important;
    }
    
    #tfa-kpiCurrent,
    #tfa-kpiAvgValue,
    #tfa-kpiLyValue {
        font-size: 2rem !important;
    }
}

/* --- FULLSCREEN MODE --- */
#tfa-dashboard-root:fullscreen,
#tfa-dashboard-root:-webkit-full-screen {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #f8fafc !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

#tfa-dashboard-root.tfa-dark-mode:fullscreen,
#tfa-dashboard-root.tfa-dark-mode:-webkit-full-screen {
    background: #0f172a !important;
}

#tfa-dashboard-root:fullscreen header,
#tfa-dashboard-root:-webkit-full-screen header {
    position: sticky;
    top: 0;
    z-index: 50;
}

#tfa-dashboard-root:fullscreen .p-4.sm\:p-6,
#tfa-dashboard-root:-webkit-full-screen .p-4.sm\:p-6 {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 32px !important;
}