/* DGI LOG - Advanced Premium Theme System v3.0 */

:root {
    /* Default Light Theme - Refined and elegant */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #002B5B;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --header-bg: #ffffff;
    --nav-hover: rgba(255, 255, 255, 0.05);
    --card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --accent: #FF6600;
    --accent-hover: #E55A00;
    --row-hover: #f1f5f9;
}

/* Premium Dark Theme variables - "Deep Space Navy" */
body.theme-premium {
    --bg-main: #090d16;          /* Deep space navy base */
    --bg-card: #131b2e;          /* Elevated surface navy for cards */
    --bg-sidebar: #0d1321;       /* Contrasting deep sidebar */
    --text-primary: #f8fafc;     /* Clean off-white primary text */
    --text-secondary: #94a3b8;   /* High-readability slate gray secondary text */
    --text-muted: #64748b;       /* Muted gray for dates and subtle hints */
    --border-color: rgba(255, 255, 255, 0.08); /* Minimalist borders */
    --header-bg: #131b2e;        /* Clean dark header matching elevated surfaces */
    --nav-hover: rgba(255, 255, 255, 0.04);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --accent: #FF6600;
    --accent-hover: #FF8533;
    --row-hover: rgba(255, 255, 255, 0.02);
}

/* Global Transition Rules */
body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.theme-premium {
    background-color: var(--bg-main) !important;
}

/* ==========================================
   THEME PREMIUM: ROBUST TAILWIND OVERRIDES
   ========================================== */

/* Typography Contrast Overrides */
.theme-premium .text-slate-900,
.theme-premium .text-slate-800,
.theme-premium .text-slate-700,
.theme-premium h1,
.theme-premium h2,
.theme-premium h3,
.theme-premium h4 {
    color: var(--text-primary) !important;
}

.theme-premium .text-slate-600,
.theme-premium .text-slate-500 {
    color: var(--text-secondary) !important;
}

.theme-premium .text-slate-400 {
    color: var(--text-muted) !important;
}

/* Border Control */
.theme-premium .border-slate-100,
.theme-premium .border-slate-200,
.theme-premium .border-slate-300,
.theme-premium .border-slate-400 {
    border-color: var(--border-color) !important;
}

/* Card & Page Backgrounds */
.theme-premium .bg-white,
.theme-premium .md\:bg-white,
.theme-premium .bg-slate-50,
.theme-premium .md\:bg-slate-50,
.theme-premium main,
.theme-premium .flex-1,
.theme-premium .overflow-auto {
    background-color: var(--bg-main) !important;
}

/* Elevated Surfaces */
.theme-premium header,
.theme-premium .h-20.bg-white,
.theme-premium .grid > div.bg-white,
.theme-premium .overflow-hidden.bg-white,
.theme-premium #view-list table,
.theme-premium #view-list .bg-white,
.theme-premium #view-list .md\:bg-white {
    background-color: var(--bg-card) !important;
    box-shadow: var(--card-shadow) !important;
    border-color: var(--border-color) !important;
}

/* Sidebar & Navigation Overrides */
.theme-premium aside#main-sidebar {
    background-color: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border-color) !important;
}

.theme-premium aside#main-sidebar .bg-deepNavy {
    background-color: var(--bg-sidebar) !important;
}

.theme-premium aside nav a {
    color: var(--text-secondary) !important;
    border-radius: 8px;
    margin: 4px 0;
    transition: all 0.2s ease;
}

.theme-premium aside nav a:hover {
    background-color: var(--nav-hover) !important;
    color: var(--text-primary) !important;
}

/* Active Navigation Element */
.theme-premium aside nav a.bg-white\/10,
.theme-premium aside nav a.bg-blue-600,
.theme-premium aside nav a.border-vibrantOrange {
    background-color: rgba(255, 102, 0, 0.1) !important;
    color: var(--accent) !important;
    border-left: 4px solid var(--accent) !important;
}

aside nav a svg {
    width: 1.125rem !important; /* ~18px */
    height: 1.125rem !important;
    color: inherit !important;
}

/* Stat Grid Cards - Dynamic Accents & High Contrast Icons */
.theme-premium .grid > div {
    border: 1px solid var(--border-color) !important;
}

svg {
    width: 1.125rem !important; /* ~18px */
    height: 1.125rem !important;
}

/* Cargas Ativas Stat (Sky Blue Accent) */
.theme-premium #stat-active {
    color: #38bdf8 !important;
}
.theme-premium .bg-blue-50 {
    background-color: rgba(56, 189, 248, 0.1) !important;
    color: #38bdf8 !important;
}

/* Entregas Hoje Stat (Emerald Accent) */
.theme-premium #stat-delivered {
    color: #34d399 !important;
}
.theme-premium .bg-emerald-50 {
    background-color: rgba(52, 211, 153, 0.1) !important;
    color: #34d399 !important;
}

/* Motoristas em Rota Stat (Brand Orange Accent) */
.theme-premium #stat-drivers {
    color: #ff781f !important;
}
.theme-premium .bg-orange-50 {
    background-color: rgba(255, 102, 0, 0.1) !important;
    color: #ff781f !important;
}

/* Comprovantes Hoje Stat (Purple Accent) */
.theme-premium #stat-receipts {
    color: #c084fc !important;
}
.theme-premium .bg-purple-50 {
    background-color: rgba(168, 85, 247, 0.1) !important;
    color: #c084fc !important;
}

/* Universal Button Overrides (Filtros, Paginadores, etc.) */
.theme-premium button.bg-white,
.theme-premium a.bg-white,
.theme-premium button.bg-slate-100,
.theme-premium a.bg-slate-100 {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: none !important;
    transition: all 0.2s ease;
}

.theme-premium button.bg-white:hover,
.theme-premium a.bg-white:hover,
.theme-premium button.bg-slate-100:hover,
.theme-premium a.bg-slate-100:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.theme-premium button:disabled {
    opacity: 0.3 !important;
    background-color: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
}

/* Tables Styling */
.theme-premium table thead tr {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-bottom: 2px solid var(--border-color) !important;
}

.theme-premium table thead th {
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
}

.theme-premium tbody tr {
    background-color: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.theme-premium tbody tr:hover {
    background-color: var(--row-hover) !important;
    transform: translateY(-0.5px);
}

.theme-premium tbody td {
    color: var(--text-primary) !important;
}

/* Quick Filter Buttons (Hoje, 7 Dias, etc.) */
.theme-premium #quick-filters,
.theme-premium .bg-slate-100 {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--border-color) !important;
}

.theme-premium .quick-filter-btn {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: none !important;
    box-shadow: none !important;
}

.theme-premium .quick-filter-btn:hover {
    color: var(--text-primary) !important;
}

.theme-premium .quick-filter-btn.bg-white,
.theme-premium .quick-filter-btn[data-active="true"] {
    background-color: var(--accent) !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.25) !important;
}

/* Status Badges - Beautiful Glowing Pills instead of Pastel Bleed */
.theme-premium .bg-amber-50,
.theme-premium .bg-amber-100/50 {
    background-color: rgba(245, 158, 11, 0.12) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
}
.theme-premium .text-amber-700,
.theme-premium .text-amber-800 {
    color: #fbbf24 !important;
}

.theme-premium .bg-blue-50,
.theme-premium .bg-blue-100/50 {
    background-color: rgba(59, 130, 246, 0.12) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.25) !important;
}
.theme-premium .text-blue-700,
.theme-premium .text-blue-800 {
    color: #60a5fa !important;
}

.theme-premium .bg-emerald-50,
.theme-premium .bg-emerald-100/50 {
    background-color: rgba(16, 185, 129, 0.12) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.25) !important;
}
.theme-premium .text-emerald-700,
.theme-premium .text-emerald-800 {
    color: #34d399 !important;
}

.theme-premium .bg-red-50,
.theme-premium .bg-red-100/50 {
    background-color: rgba(239, 68, 68, 0.12) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
}
.theme-premium .text-red-700,
.theme-premium .text-red-800 {
    color: #f87171 !important;
}

/* Modals & Forms Styling */
.theme-premium .fixed.inset-0.bg-slate-900\/50,
.theme-premium .fixed.inset-0.bg-deepNavy\/80 {
    backdrop-filter: blur(12px) !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
}

.theme-premium #tripModal > div,
.theme-premium #receiptModal > div,
.theme-premium #tripDetailsModal > div,
.theme-premium #filterModal > div,
.theme-premium #driverModal > div,
.theme-premium #vehicleModal > div {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8) !important;
    color: var(--text-primary) !important;
}

.theme-premium #tripModalTitle,
.theme-premium #tripDetailsModal h3,
.theme-premium #receiptModal h3 {
    color: var(--text-primary) !important;
}

/* Modal Headers & Footers */
.theme-premium .bg-slate-50,
.theme-premium .px-8.py-5.border-b,
.theme-premium .px-6.py-4.border-b,
.theme-premium .px-6.py-4.border-t {
    background-color: #1a233d !important;
    border-color: var(--border-color) !important;
}

/* Modal Internal Grouping Cards */
.theme-premium #tripForm .border.border-slate-200.rounded-xl.p-4.bg-white,
.theme-premium #tripForm .border.border-slate-200.rounded-xl.p-4 {
    background-color: #1a233d !important;
    border: 1px solid var(--border-color) !important;
}

/* Form Inputs, Selects and Textareas */
.theme-premium input[type="search"],
.theme-premium input[type="text"],
.theme-premium input[type="datetime-local"],
.theme-premium select,
.theme-premium textarea {
    background-color: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
}

.theme-premium input:focus,
.theme-premium select:focus,
.theme-premium textarea:focus {
    border-color: var(--accent) !important;
    background-color: rgba(0, 0, 0, 0.35) !important;
    box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.2) !important;
}

/* Input Labels */
.theme-premium label.text-slate-400,
.theme-premium label.text-slate-500 {
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
}

/* public tracking banner inside details modal */
.theme-premium .bg-emerald-50.border.border-emerald-100 {
    background-color: rgba(16, 185, 129, 0.05) !important;
    border: 1px solid rgba(16, 185, 129, 0.15) !important;
}
.theme-premium #dt-tracking-url {
    color: #34d399 !important;
}
.theme-premium #copy-tracking-btn {
    color: #34d399 !important;
}

/* Kanban Column Styling */
.theme-premium #view-kanban {
    background-color: var(--bg-main) !important;
}

.theme-premium #view-kanban .bg-slate-100\/50 {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--border-color) !important;
}

.theme-premium #view-kanban .bg-amber-50,
.theme-premium #view-kanban .bg-blue-50,
.theme-premium #view-kanban .bg-emerald-50 {
    background-color: #1a233d !important;
    border-bottom: 2px solid var(--border-color) !important;
}

.theme-premium .kanban-card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--card-shadow) !important;
}

.theme-premium .kanban-card:hover {
    border-color: rgba(255, 102, 0, 0.3) !important;
}

/* Scrollbars */
.theme-premium ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.theme-premium ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.theme-premium ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.theme-premium ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================
   CARGAS V2: PREMIUM ENTERPRISE OVERRIDES
   ========================================== */

/* Top Main Tab Navigation */
.theme-premium .tab-btn {
    color: var(--text-secondary) !important;
    border-bottom-color: transparent !important;
}

.theme-premium .tab-btn:hover {
    color: var(--text-primary) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    background-color: rgba(255, 255, 255, 0.02) !important;
}

.theme-premium .tab-btn.border-vibrantOrange {
    color: var(--accent) !important;
    border-bottom-color: var(--accent) !important;
    background-color: rgba(255, 102, 0, 0.04) !important;
}

.theme-premium .flex.border-b.border-slate-200.bg-slate-50\/50 {
    background-color: var(--bg-card) !important;
    border-bottom-color: var(--border-color) !important;
}

/* Sidebar Tracking List & Completed List Cards (Tabs 2 & 3) */
.theme-premium #track-trips-list .border-slate-100,
.theme-premium #completed-trips-list .border-slate-100 {
    border-color: var(--border-color) !important;
    background-color: transparent !important;
}

.theme-premium #track-trips-list .hover\:bg-slate-50:hover,
.theme-premium #completed-trips-list .hover\:bg-slate-50:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* High Contrast Selected States for Cards (replacing harsh solid lights) */
.theme-premium #track-trips-list .border-blue-500.bg-blue-50\/50 {
    background-color: rgba(59, 130, 246, 0.12) !important;
    border-color: #3b82f6 !important;
}

.theme-premium #completed-trips-list .border-emerald-500.bg-emerald-50\/50 {
    background-color: rgba(16, 185, 129, 0.12) !important;
    border-color: #10b981 !important;
}

/* Placeholder Glowing Icons */
.theme-premium #track-placeholder .bg-slate-100,
.theme-premium #completed-placeholder .bg-slate-100,
.theme-premium #completed-placeholder .bg-emerald-50 {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--accent) !important;
    border: 1px solid var(--border-color) !important;
}

/* Active & Inactive Action Buttons / Icon Hover Cleanups */
.theme-premium button.hover\:bg-orange-50:hover {
    background-color: rgba(255, 102, 0, 0.1) !important;
    color: var(--accent) !important;
}

.theme-premium button.hover\:bg-slate-100:hover,
.theme-premium button.hover\:bg-slate-50:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
}

.theme-premium button.hover\:bg-emerald-50:hover {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: #34d399 !important;
}

/* Table Row Dynamic Hover Readability Override */
.theme-premium tbody tr.hover\:bg-slate-50\/70:hover,
.theme-premium tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Form Vertical Sections Sidebar & Hierarchy */
.theme-premium #crud-form-view {
    background-color: var(--bg-main) !important;
}

.theme-premium #crud-form-view .bg-white {
    background-color: var(--bg-sidebar) !important;
    border-color: var(--border-color) !important;
}

.theme-premium #crud-form-view form#trip-form {
    background-color: var(--bg-main) !important;
}

/* Vertical navigation buttons */
.theme-premium .form-sec-btn {
    background-color: transparent !important;
    color: var(--text-secondary) !important;
    border-left: 4px solid transparent !important;
}

.theme-premium .form-sec-btn:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-primary) !important;
}

.theme-premium .form-sec-btn.bg-orange-50 {
    background-color: rgba(255, 102, 0, 0.08) !important;
    color: var(--accent) !important;
    border-left-color: var(--accent) !important;
}

.theme-premium .form-sec-btn.bg-orange-50 div {
    background-color: rgba(255, 102, 0, 0.25) !important;
    color: var(--accent) !important;
}

.theme-premium .form-sec-btn div {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color) !important;
}

/* Timeline Glowing Nodes */
.theme-premium [id^="icon-node-"].bg-blue-100 {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

.theme-premium [id^="icon-node-"].bg-slate-100 {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-muted) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.theme-premium [id^="icon-node-"].bg-emerald-100 {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

/* Modals, Quick Filters & Active Filters Bar */
.theme-premium #filterModal .bg-white {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.theme-premium #filterModal .bg-slate-50 {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: var(--border-color) !important;
}

.theme-premium #crud-quick-filters {
    background-color: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid var(--border-color) !important;
}

.theme-premium #crud-quick-filters .quick-filter-btn {
    background: transparent !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
}

.theme-premium #crud-quick-filters .quick-filter-btn:hover {
    color: var(--text-primary) !important;
}

.theme-premium #crud-quick-filters .quick-filter-btn.bg-white {
    background-color: var(--accent) !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.25) !important;
}

.theme-premium #active-filters-bar {
    background-color: rgba(255, 102, 0, 0.06) !important;
    border-color: rgba(255, 102, 0, 0.15) !important;
}

.theme-premium #active-filters-list span {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* ==========================================
   THEME TOGGLE: TEMPORARILY HIDDEN
   ========================================== */
/* Hide the dark theme toggle button across all pages */
button[onclick="toggleTheme()"] {
    display: none !important;
}

