/* ===== AUTHENTICATED AREA - AGGRESSIVE RACING THEME ===== */
/* Professional dark theme with WCAG AA contrast compliance */

/* ===== HIGH CONTRAST TEXT FIXES ===== */
#app-content h1,
#app-content h2,
#app-content h3 {
    color: #F9FAFB !important;
}

#app-content h4,
#app-content h5,
#app-content h6 {
    color: #E5E7EB !important;
}

#app-content p,
#app-content li,
#app-content label,
#app-content td,
#app-content span {
    color: #E5E7EB !important;
}

#app-content .section-title,
#app-content .chart-title {
    color: #EA580C !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

#app-content .metadata,
#app-content .hint,
#app-content .timestamp,
#app-content small {
    color: #9CA3AF !important;
}

/* Setores Automáticos table - dark text on light background for readability */
#app-content .table-light.sectors-table th {
    color: #1F2937 !important;
}
#app-content .table-light.sectors-table th:first-child {
    color: #EA580C !important;
}
#app-content .table-light.sectors-table td {
    color: #374151 !important;
}
#app-content .table-light.sectors-table td:first-child {
    color: #111827 !important;
}

/* ===== BORDER VISIBILITY FIXES ===== */
#app-content .card {
    border: 1px solid #374151 !important;
    background: #0F0F0F !important;
}

#app-content hr {
    border-color: #4B5563 !important;
    border-width: 1px !important;
    opacity: 1 !important;
}

#app-content .card-header {
    border-bottom: 1px solid #374151 !important;
}

/* Scrollbar styling (dark theme) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0A0A0A;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #B91C1C;
}

/* Selection color */
::selection {
    background: #B91C1C;
    color: #FFFFFF;
}

/* Content area (apply to #app-content) */
#app-content {
    background: linear-gradient(180deg, #0A0A0A 0%, #111827 100%) !important;
}

.content-area {
    background: linear-gradient(180deg, #0A0A0A 0%, #111827 100%) !important;
}

/* Sidebar nav link hover/active (Dash NavLink) */
#app-sidebar .nav-link {
    color: #D1D5DB !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-radius: 6px !important;
    border-left: 3px solid transparent !important;
    padding: 12px 16px !important;
    margin-bottom: 6px !important;
    transition: all 0.2s ease !important;
}

#app-sidebar .nav-link:hover {
    background: #1C1C1C !important;
    border-left-color: #B91C1C !important;
    color: #F9FAFB !important;
    box-shadow: 0 0 20px rgba(185, 28, 28, 0.2) !important;
}

#app-sidebar .nav-link.active {
    background: #1C1C1C !important;
    border-left-color: #EA580C !important;
    color: #EA580C !important;
    font-weight: 800 !important;
    box-shadow: 0 0 20px rgba(234, 88, 12, 0.3) !important;
}

#app-sidebar .sidebar-logout-btn:hover {
    background: #7F1D1D !important;
    border-color: #B91C1C !important;
    color: #F9FAFB !important;
    box-shadow: 0 0 20px rgba(185, 28, 28, 0.4) !important;
}

#mobile-topbar .mobile-menu-btn:hover {
    color: #B91C1C !important;
}

/* Plotly chart overrides */
.js-plotly-plot .plotly .modebar {
    background: transparent !important;
}

.js-plotly-plot .plotly .modebar-btn path {
    fill: #9CA3AF !important;
}

.js-plotly-plot .plotly .modebar-btn:hover path {
    fill: #B91C1C !important;
}

/* Dash DataTable */
.dash-table-container {
    background: #0F0F0F !important;
    border: 1px solid #374151 !important;
    border-radius: 8px !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner table {
    background: #0F0F0F !important;
    color: #D1D5DB !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner th {
    background: #1C1C1C !important;
    color: #EA580C !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-bottom: 2px solid #B91C1C !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner td {
    background: #0F0F0F !important;
    color: #E5E7EB !important;
    border-bottom: 1px solid #374151 !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td {
    background: #1C1C1C !important;
}

.dash-table-container {
    border: 1px solid #374151 !important;
}

/* Plotly chart text overrides for readability */
.js-plotly-plot text {
    fill: #E5E7EB !important;
}

.js-plotly-plot .xtick text,
.js-plotly-plot .ytick text {
    fill: #D1D5DB !important;
}

/* Page header (authenticated pages) */
.page-header-auth {
    margin-bottom: 32px !important;
    padding-bottom: 16px !important;
    border-bottom: 2px solid #4B5563 !important;
}

.page-title-auth {
    font-size: clamp(28px, 4vw, 42px) !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: -0.02em !important;
    color: #F9FAFB !important;
    margin-bottom: 8px !important;
    text-shadow: 0 0 30px rgba(185, 28, 28, 0.3) !important;
}

.page-subtitle-auth {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #9CA3AF !important;
    line-height: 1.5 !important;
}

/* Card dark theme */
.card-auth {
    background: #0F0F0F !important;
    border: 1px solid #374151 !important;
    border-radius: 12px !important;
    padding: 24px !important;
    margin-bottom: 24px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

.card-auth-accent {
    border-left: 4px solid #B91C1C !important;
}

/* Bootstrap Card overrides in authenticated area */
#app-content .card {
    background: #0F0F0F !important;
    border: 1px solid #374151 !important;
    border-radius: 12px !important;
}

#app-content .card-header,
#app-content .card-body {
    background: #0F0F0F !important;
    border-color: #374151 !important;
    color: #E5E7EB !important;
}

#app-content .card-header {
    color: #EA580C !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-bottom: 1px solid #374151 !important;
}

/* Button overrides in authenticated area */
#app-content .btn-primary,
#app-content .btn-danger {
    background: #B91C1C !important;
    border-color: #B91C1C !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    box-shadow: 0 0 20px rgba(185, 28, 28, 0.4) !important;
}

#app-content .btn-primary:hover,
#app-content .btn-danger:hover {
    background: #7F1D1D !important;
    border-color: #7F1D1D !important;
    box-shadow: 0 0 30px rgba(185, 28, 28, 0.6) !important;
    transform: translateY(-2px);
}

/* Checklist and form elements in dark theme */
#app-content .form-check label,
#app-content .form-check .form-check-label,
#app-content .dash-checklist-container label {
    color: #E5E7EB !important;
}

/* Override any Bootstrap/form light backgrounds that slip through */
#app-content .card .card-header[style*="f8f9fa"],
#app-content .card .card-header[style*="f3f4f6"] {
    background: #1C1C1C !important;
    color: #EA580C !important;
}

/* Formando o Grid - conversation list items hover */
#app-content .grid-conv-item:hover {
    background: #1F2937 !important;
    cursor: pointer;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #app-content {
        margin-left: 0 !important;
        padding-top: 72px !important;
    }

    .page-title-auth {
        font-size: clamp(24px, 6vw, 32px) !important;
    }
}

/* ── Grid input contrast fix ─────────────────────────────────── */
#grid-input-pilot-id,
#grid-input-message,
#grid-modal-add-pilot-input,
#grid-modal-rename-group-input {
    color: #F9FAFB !important;
    background-color: #111827 !important;
    -webkit-text-fill-color: #F9FAFB !important;
    caret-color: #F9FAFB !important;
}

#grid-input-pilot-id::placeholder,
#grid-input-message::placeholder,
#grid-modal-add-pilot-input::placeholder,
#grid-modal-rename-group-input::placeholder {
    color: #6B7280 !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #6B7280 !important;
}

#grid-input-pilot-id:-webkit-autofill,
#grid-modal-add-pilot-input:-webkit-autofill,
#grid-modal-rename-group-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 100px #111827 inset !important;
    -webkit-text-fill-color: #F9FAFB !important;
    caret-color: #F9FAFB !important;
}

#grid-input-pilot-id:focus,
#grid-input-message:focus,
#grid-modal-add-pilot-input:focus,
#grid-modal-rename-group-input:focus {
    color: #F9FAFB !important;
    background-color: #111827 !important;
    -webkit-text-fill-color: #F9FAFB !important;
    border-color: #EA580C !important;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.25) !important;
}
