/* ============================================================
   Coratec Maps - Dark Theme Overrides
   Applied when <body class="theme-dark">
   ============================================================ */

body.theme-dark {
    background: #141e2e;
    color: #cddaea;
}

/* Top bar */
body.theme-dark .topbar {
    background: #182335;
    border-bottom-color: #253a55;
}

/* Sidebars */
body.theme-dark .sidebar {
    background: #1a2840;
    border-color: #253a55;
}
body.theme-dark .sidebar-toggle {
    background: #1f3050;
    border-color: #2d4a6e;
}
body.theme-dark .sidebar-toggle:hover { background: #274060; }
body.theme-dark .sidebar-header { border-bottom-color: #253a55; }
body.theme-dark .sidebar-search input,
body.theme-dark .element-search input {
    background: #111b2b;
    border-color: #2d4a6e;
    color: #cddaea;
}
body.theme-dark .map-tree-node-header:hover { background: rgba(60,110,160,.25); }
body.theme-dark .map-tree-node-header.active { background: #1f3050; }
body.theme-dark .element-list-item:hover { background: rgba(60,110,160,.18); }
body.theme-dark .element-list-item.selected { background: #1f3050; }
body.theme-dark .filter-btn { background: #111b2b; border-color: #2d4a6e; }
body.theme-dark .filter-btn.active,
body.theme-dark .filter-btn:hover { background: #1f3050; border-color: #5590bb; }

/* Map area */
body.theme-dark .map-area { background: #0f1a28; }
body.theme-dark .map-background-empty {
    background: repeating-linear-gradient(
        45deg, #0f1826, #0f1826 10px, #131f30 10px, #131f30 20px
    );
}
body.theme-dark .bg-placeholder { color: #3a5878; }

/* Zoom controls */
body.theme-dark .zoom-controls {
    background: rgba(15,26,40,.92);
    border-color: #2d4a6e;
}
body.theme-dark .zoom-btn { color: #a0b8cc; }
body.theme-dark .zoom-btn:hover { background: #1f3050; color: #fff; }

/* Edit toolbar */
body.theme-dark .edit-toolbar {
    background: rgba(255,193,7,.08);
    border-color: rgba(255,193,7,.5);
}

/* Element labels */
body.theme-dark .elem-label { background: rgba(0,0,0,.75); color: #cddaea; }

/* Map info overlay */
body.theme-dark .map-name-chip { background: rgba(0,0,0,.7); color: #cddaea; }
body.theme-dark .map-desc-chip  { background: rgba(0,0,0,.55); color: #90aabf; }

/* Alarm panel */
body.theme-dark .alarm-panel {
    background: #141e2e;
    border-top-color: #253a55;
}
body.theme-dark .panel-header { border-bottom-color: #253a55; }
body.theme-dark .panel-tab { color: #5a7a9a; }
body.theme-dark .panel-tab.active { background: #1c2e48; color: #cddaea; border-color: #2d4a6e; }
body.theme-dark .alarm-table thead th { background: #111b2b; border-bottom-color: #253a55; }
body.theme-dark .alarm-table tbody tr { border-bottom-color: #182035; }
body.theme-dark .alarm-table tbody tr:hover { background: rgba(60,110,160,.1); }
body.theme-dark .alarm-table tbody td { color: #a0b8cc; }

/* Modals */
body.theme-dark .modal-dialog {
    background: #1a2840;
    border-color: #2d4a6e;
}
body.theme-dark .modal-header { border-bottom-color: #253a55; }
body.theme-dark .modal-header h3 { color: #cddaea; }
body.theme-dark .modal-footer { border-top-color: #253a55; }

/* Forms */
body.theme-dark .form-group input[type=text],
body.theme-dark .form-group input[type=email],
body.theme-dark .form-group input[type=password],
body.theme-dark .form-group input[type=number],
body.theme-dark .form-group input[type=date],
body.theme-dark .form-group input[type=search],
body.theme-dark .form-group textarea,
body.theme-dark .form-group select {
    background: #111b2b;
    border-color: #2d4a6e;
    color: #cddaea;
}
body.theme-dark .form-group label { color: #90aabf; }
body.theme-dark .form-hint { color: #5a7a9a; }
body.theme-dark .checkbox-label { color: #a0b8cc; }

/* Admin pages */
body.theme-dark .admin-content { background: #141e2e; }
body.theme-dark .page-header { background: #111b2b; border-bottom-color: #253a55; }
body.theme-dark .page-header h1 { color: #cddaea; }
body.theme-dark .data-table thead th { background: #111b2b; border-bottom-color: #253a55; }
body.theme-dark .data-table tbody tr { border-bottom-color: #182035; }
body.theme-dark .data-table tbody tr:hover { background: rgba(60,110,160,.08); }
body.theme-dark .data-table tbody td { color: #a0b8cc; }

/* Settings */
body.theme-dark .settings-section { background: #111b2b; border-color: #253a55; }
body.theme-dark .settings-section-title { color: #90aabf; border-bottom-color: #253a55; }

/* Filter panel */
body.theme-dark .filter-panel { background: #111b2b; border-bottom-color: #253a55; }

/* Auth card */
body.theme-dark .auth-card { background: #1a2840; border-color: #2d4a6e; }
body.theme-dark .auth-title    { color: #cddaea; }
body.theme-dark .auth-subtitle { color: #5a7a9a; }

/* Dropdown */
body.theme-dark .dropdown-menu {
    background: #1a2840;
    border-color: #2d4a6e;
}
body.theme-dark .dropdown-item { color: #a0b8cc; }
body.theme-dark .dropdown-item:hover { background: #1f3050; }

/* Tabs */
body.theme-dark .tab-bar { border-bottom-color: #253a55; }
body.theme-dark .tab-btn { color: #5a7a9a; }
body.theme-dark .tab-btn.active { background: #1c2e48; color: #cddaea; border-color: #2d4a6e; }

/* Status pills */
body.theme-dark .status-pill.status-online  { background: #0d3018; color: #4ade80; border: 1px solid #1f6035; }
body.theme-dark .status-pill.status-offline { background: #330e12; color: #f87171; border: 1px solid #6b2030; }
body.theme-dark .status-pill.status-sconosciuto { background: #1e2535; color: #a0b8cc; border: 1px solid #333f58; }
body.theme-dark .status-pill.status-programmazione { background: #0e2040; color: #60a5fa; border: 1px solid #1e4070; }

/* Role badges */
body.theme-dark .role-admin      { background: #6b1018; color: #fca5a5; }
body.theme-dark .role-supervisore{ background: #8c4515; color: #fdba74; }
body.theme-dark .role-operatore  { background: #234570; color: #93c5fd; }
body.theme-dark .role-readonly   { background: #303848; color: #a0b8cc; }

/* Alarm badges */
body.theme-dark .badge-critico { background: #9b1c1c; }
body.theme-dark .badge-alto    { background: #7c2d12; }
body.theme-dark .badge-medio   { background: #713f12; color: #fde68a; }
body.theme-dark .badge-basso   { background: #374151; }
body.theme-dark .badge-info    { background: #0e4a5a; }

/* Palette */
body.theme-dark .element-palette { border-top-color: #253a55; }
body.theme-dark .palette-item { background: #111b2b; border-color: #2d4a6e; color: #7a9ab8; }
body.theme-dark .palette-item:hover { background: #1c2e48; border-color: #5590bb; }

/* Element count badge */
body.theme-dark .element-count-badge { background: #1c2e48; color: #90aabf; }

/* Tab count */
body.theme-dark .tab-count { background: #253a55; color: #90aabf; }

/* Buttons */
body.theme-dark .btn-outline { border-color: #3a5878; color: #90aabf; }
body.theme-dark .btn-outline:hover { background: rgba(255,255,255,.06); color: #cddaea; }

/* Scrollbars */
body.theme-dark ::-webkit-scrollbar-thumb { background: #2d4a6e; }
body.theme-dark ::-webkit-scrollbar-thumb:hover { background: #3a5f8a; }

/* Log rows */
body.theme-dark .log-row.row-closed { opacity: .5; }

/* Edit mode outline */
body.theme-dark.edit-mode-active .map-canvas-wrapper { outline-color: rgba(255,193,7,.4); }
