/* KoreCloud Lab - Sistema de Ordens de Serviço */

:root {
    /* KoreCloud Brand Colors */
    --kc-purple: #7C3AED;
    --kc-purple-dark: #5B21B6;
    --kc-purple-light: #8B5CF6;
    --kc-purple-lighter: #A78BFA;
    --kc-purple-faint: #EDE9FE;

    /* Light mode semantic tokens */
    --body-bg: #F5F3FF;
    --surface-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --text-primary: #1E1033;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border-color: #E5E7EB;
    --input-bg: #FAFAFA;
    --input-border: #D1D5DB;
    --table-hover: rgba(124, 58, 237, 0.05);
    --shadow-color: rgba(124, 58, 237, 0.1);
    --success-color: #22C55E;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #06B6D4;
}

[data-theme="dark"] {
    --body-bg: #0D0820;
    --surface-bg: #160E2E;
    --card-bg: #1C1040;
    --text-primary: #F3E8FF;
    --text-secondary: #C4B5FD;
    --text-muted: #7C6FAB;
    --border-color: #2D1B69;
    --input-bg: #160E2E;
    --input-border: #3D2A7E;
    --table-hover: rgba(167, 139, 250, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.4);
}

* {
    font-family: 'Inter', sans-serif;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==============================
   SIDEBAR
   ============================== */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(160deg, #2D1B69 0%, #5B21B6 100%);
    box-shadow: 2px 0 20px rgba(91, 33, 182, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .sidebar {
    background: linear-gradient(160deg, #160E2E 0%, #2D1B69 100%);
}

.sidebar .logo-section {
    padding: 1.75rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar .logo-section h4 {
    color: white;
    font-weight: 700;
    margin: 0;
    font-size: 1.4rem;
}

.sidebar .logo-section .logo-img {
    max-width: 170px;
    height: auto;
    margin-bottom: 0.5rem;
}

.sidebar .subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78rem;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar .nav {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.7rem 1.25rem;
    margin: 0.15rem 0.75rem;
    border-radius: 10px;
    transition: all 0.25s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.sidebar .nav-link i {
    margin-right: 0.75rem;
    width: 18px;
    text-align: center;
}

/* Itens bloqueados (sem permissão) */
.sidebar .nav-link.locked {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar .nav-link.locked:hover {
    background: transparent;
    transform: none;
}

.sidebar .nav-link.locked .lock-icon {
    margin-left: auto;
    margin-right: 0;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Tooltip para itens bloqueados */
.sidebar .nav-link.locked[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* Seção do usuário */
.sidebar .user-section {
    flex-shrink: 0;
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar .user-info {
    text-align: center;
}

.sidebar .user-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.sidebar .user-level {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Sidebar toggle row — theme + money side by side */
.sidebar-toggle-row {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

/* Dark mode toggle button in sidebar */
.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.78rem;
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    flex: 1;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

/* Money visibility toggle button in sidebar */
.btn-money-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 0.4rem 0.65rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.btn-money-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.sidebar .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
}

.sidebar .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.sidebar .btn-logout {
    background: rgba(239, 68, 68, 0.8);
    border-color: transparent;
    color: white;
    font-size: 0.78rem;
}

.sidebar .btn-logout:hover {
    background: #EF4444;
    border-color: transparent;
}

/* Floating theme toggle (mobile only) */
.floating-theme-toggle {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1100;
    background: #7C3AED;
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.4);
    transition: all 0.25s ease;
    align-items: center;
    justify-content: center;
}

.floating-theme-toggle:hover {
    background: #5B21B6;
    transform: scale(1.05);
}

/* Floating money toggle (mobile only) — positioned left of theme toggle */
.floating-money-toggle {
    display: none;
    position: fixed;
    top: 15px;
    right: 65px;
    z-index: 1100;
    background: #7C3AED;
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.4);
    transition: all 0.25s ease;
    align-items: center;
    justify-content: center;
}

.floating-money-toggle:hover {
    background: #5B21B6;
    transform: scale(1.05);
}

/* Money blur — activated via data-money="hidden" on <html> */
[data-money="hidden"] .kc-money {
    filter: blur(7px);
    user-select: none;
    pointer-events: none;
}

/* ==============================
   MAIN CONTENT
   ============================== */
.main-content {
    margin-left: 260px;
    padding: 1.5rem;
    min-height: 100vh;
    width: calc(100% - 260px);
    max-width: none;
    background-color: var(--body-bg);
    transition: background-color 0.3s ease;
}

.main-content .container-fluid {
    max-width: none;
    padding: 0;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    background: #7C3AED;
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.4);
    transition: all 0.25s ease;
}

.mobile-menu-toggle:hover {
    background: #5B21B6;
    transform: scale(1.05);
}

.mobile-menu-toggle.active {
    background: #5B21B6;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Mobile Responsive Styles */
@media (max-width: 991px) {
    /* Esconde o botão hamburger quando há versão mobile app */
    .mobile-menu-toggle {
        display: none !important;
    }

    .floating-theme-toggle,
    .floating-money-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 70px;
        width: 100%;
    }

    .page-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 0.75rem;
        padding-top: 70px;
    }

    .page-header {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        gap: 0.75rem;
    }

    .page-header h1 {
        font-size: 1.1rem;
    }

    /* Stats Cards Mobile */
    .stats-card {
        padding: 0.75rem;
        min-height: auto;
    }

    .stats-number {
        font-size: 1.25rem;
    }

    .stats-label {
        font-size: 0.65rem;
    }

    .stats-icon,
    .stats-icon-success,
    .stats-icon-warning,
    .stats-icon-info {
        font-size: 1rem;
    }

    /* Cards Mobile */
    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    /* Charts Mobile */
    .chart-container {
        height: 250px !important;
    }

    /* Buttons Mobile */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .btn-group .btn {
        padding: 0.4rem 0.6rem;
    }

    /* Row adjustments */
    .row.mb-4 {
        margin-bottom: 0.75rem !important;
    }

    .col-xl-3,
    .col-xl-6,
    .col-lg-6 {
        margin-bottom: 0.5rem;
    }
}

/* ==============================
   PAGE HEADER
   ============================== */
.page-header {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 12px var(--shadow-color);
    border-left: 4px solid #7C3AED;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    transition: background-color 0.3s ease;
}

.page-header h1 {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
}

/* ==============================
   CARDS
   ============================== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 15px var(--shadow-color);
    transition: all 0.3s ease;
    background-color: var(--card-bg);
}

.card:hover {
    box-shadow: 0 6px 28px var(--shadow-color);
}

.card-header {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    color: white;
    border-radius: 12px 12px 0 0 !important;
    border: none;
    font-weight: 500;
}

.card-body {
    background-color: var(--card-bg);
    color: var(--text-primary);
    transition: background-color 0.3s ease;
}

/* ==============================
   STATS CARDS
   ============================== */
.stats-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: all 0.3s ease;
    border-left: 3px solid #7C3AED;
    height: 100%;
    min-height: 80px;
}

.stats-card:hover {
    box-shadow: 0 6px 25px var(--shadow-color);
}

.stats-card.success {
    border-left-color: #22C55E;
}

.stats-card.warning {
    border-left-color: #F59E0B;
}

.stats-card.info {
    border-left-color: #06B6D4;
}

.stats-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #7C3AED;
    line-height: 1.1;
}

.stats-label {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    margin-bottom: 0.3rem;
}

.stats-detail {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 400;
    margin-top: 0.25rem;
    line-height: 1.2;
    opacity: 0.8;
}

.stats-icon {
    color: #7C3AED;
    opacity: 0.5;
    font-size: 1.3rem;
}

.stats-icon-success {
    color: #22C55E;
    opacity: 0.5;
    font-size: 1.3rem;
}

.stats-icon-warning {
    color: #F59E0B;
    opacity: 0.5;
    font-size: 1.3rem;
}

.stats-icon-info {
    color: #06B6D4;
    opacity: 0.5;
    font-size: 1.3rem;
}

.stats-number-success {
    color: #22C55E !important;
}

.stats-number-warning {
    color: #F59E0B !important;
}

.stats-number-info {
    color: #06B6D4 !important;
}

/* ==============================
   BUTTONS
   ============================== */
.btn-primary {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
    background: linear-gradient(135deg, #7C3AED 0%, #8B5CF6 100%);
    color: white;
}

.btn-warning {
    background: #F59E0B;
    border: none;
    color: white;
}

.btn-warning:hover {
    background: #D97706;
    color: white;
}

/* ==============================
   TABLES
   ============================== */
.table {
    border-radius: 10px;
    overflow: hidden;
    color: var(--text-primary);
}

.table thead th {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    color: white;
    border: none;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: var(--table-hover);
}

.table tbody tr {
    background-color: var(--card-bg);
}

.table tbody td {
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ==============================
   BADGES
   ============================== */
.badge {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

/* ==============================
   FORMS
   ============================== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--input-border);
    padding: 0.75rem;
    transition: all 0.3s ease;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: #7C3AED;
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.2);
    background-color: var(--card-bg);
    color: var(--text-primary);
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Alertas */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

/* ==============================
   STATUS BADGES
   ============================== */
.status-ativa {
    background-color: var(--success-color);
    color: white;
}

.status-manutencao {
    background-color: var(--warning-color);
    color: white;
}

.status-inativa {
    background-color: var(--danger-color);
    color: white;
}

/* ==============================
   LOGIN PAGE
   ============================== */
body.login-page {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(91, 33, 182, 0.35);
    overflow: hidden;
    max-width: 450px;
    width: 100%;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.login-header h2 {
    margin: 0;
    font-weight: 600;
    font-size: 1.8rem;
}

.login-header .subtitle {
    margin-top: 0.5rem;
    opacity: 0.9;
    font-size: 0.95rem;
}

.login-body {
    padding: 3rem 2rem;
}

.btn-login {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    border: none;
    padding: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.3s ease;
    width: 100%;
    color: white;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.35);
    color: white;
}

/* ==============================
   ANIMATIONS
   ============================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ==============================
   UTILITIES
   ============================== */
.text-xs {
    font-size: 0.75rem;
}

.shadow {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

.border-bottom-primary {
    border-bottom: 1px solid #7C3AED !important;
}

/* ==============================
   ERROR PAGE
   ============================== */
body.error-page {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-card {
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    border: none;
}

/* ==============================
   INSTALL PAGE
   ============================== */
body.install-page {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    min-height: 100vh;
}

.install-card {
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    border: none;
}

.step-indicator {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.step {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    margin-right: 10px;
}

.step.active {
    background: #7C3AED;
    color: white;
}

.step.completed {
    background: #22C55E;
    color: white;
}

.step.pending {
    background: #e9ecef;
    color: #6c757d;
}

/* ========================================
   MOBILE TABLE STYLES
   ======================================== */

/* Mobile-friendly table container */
.table-responsive-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    /* Table adjustments for mobile */
    .table-responsive {
        border: 0;
        overflow-x: auto;
    }

    .table-responsive .table {
        min-width: 600px;
    }

    .table thead th {
        font-size: 0.7rem;
        padding: 0.5rem;
        white-space: nowrap;
    }

    .table tbody td {
        font-size: 0.8rem;
        padding: 0.5rem;
        vertical-align: middle;
    }

    /* Action buttons in table */
    .table .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .table .btn-group .btn {
        width: 100%;
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }

    .table .btn-sm {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    /* Badge adjustments */
    .table .badge {
        font-size: 0.65rem;
        padding: 0.3rem 0.5rem;
    }

    /* DataTables mobile adjustments */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: center;
        margin-bottom: 0.5rem;
    }

    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin: 0.25rem 0;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin-top: 0.5rem;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.3rem 0.6rem;
        margin: 0.1rem;
    }

    /* Form responsive adjustments */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents iOS zoom on input focus */
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Alert adjustments */
    .alert {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    /* Extra small screen adjustments */
    .table thead th {
        font-size: 0.65rem;
        padding: 0.4rem;
    }

    .table tbody td {
        font-size: 0.75rem;
        padding: 0.4rem;
    }

    /* Hide less important columns on very small screens */
    .table .hide-mobile {
        display: none;
    }

    /* Compact buttons */
    .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .btn-group-sm > .btn,
    .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }

    /* Stats cards extra compact */
    .stats-card {
        padding: 0.5rem;
    }

    .stats-number {
        font-size: 1.1rem;
    }

    .stats-label {
        font-size: 0.6rem;
    }

    /* Charts smaller on mobile */
    .chart-container {
        height: 200px !important;
    }
}

/* Touch-friendly elements */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .form-control,
    .form-select {
        min-height: 44px;
    }
}


/* ======================================================
   DARK MODE — Bootstrap & Component Overrides
   ====================================================== */

/* Body & Layout */
[data-theme="dark"] body {
    background-color: var(--body-bg);
    color: var(--text-primary);
}

/* Cards */
[data-theme="dark"] .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .card-body {
    background-color: var(--card-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .card-footer {
    background-color: var(--surface-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Tables */
[data-theme="dark"] .table {
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--surface-bg);
}

[data-theme="dark"] .table tbody tr:hover > * {
    background-color: var(--table-hover);
    color: var(--text-primary);
}

/* Forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: #7C3AED;
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.25);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .form-label {
    color: var(--text-primary);
}

[data-theme="dark"] .input-group-text {
    background-color: var(--surface-bg);
    border-color: var(--input-border);
    color: var(--text-secondary);
}

/* Modals */
[data-theme="dark"] .modal-content {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}

/* Dropdowns */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--surface-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-divider {
    border-color: var(--border-color);
}

/* Nav tabs */
[data-theme="dark"] .nav-tabs {
    border-color: var(--border-color);
}

[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--text-secondary);
}

[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: var(--card-bg);
    border-color: var(--border-color) var(--border-color) var(--card-bg);
    color: #8B5CF6;
}

/* List groups */
[data-theme="dark"] .list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Text utilities */
[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

/* Background utilities */
[data-theme="dark"] .bg-white {
    background-color: var(--card-bg) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--surface-bg) !important;
}

/* Borders */
[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-top {
    border-color: var(--border-color) !important;
}

/* Page header dark */
[data-theme="dark"] .page-header {
    background-color: var(--card-bg);
}

/* Stats cards dark */
[data-theme="dark"] .stats-card {
    background-color: var(--card-bg);
}

/* Alerts dark */
[data-theme="dark"] .alert-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86EFAC;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #FCD34D;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .alert-info {
    background: rgba(6, 182, 212, 0.15);
    color: #67E8F9;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

/* DataTables dark */
[data-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter label,
[data-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: var(--text-secondary);
}

[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #7C3AED !important;
    border-color: #7C3AED !important;
    color: white !important;
    border-radius: 6px;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(124, 58, 237, 0.15) !important;
    border-color: #7C3AED !important;
    color: #A78BFA !important;
}

/* Install/Error page dark */
[data-theme="dark"] .install-card,
[data-theme="dark"] .error-card {
    background-color: var(--card-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .step-indicator {
    background-color: var(--surface-bg);
}

/* Scrollbar dark */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--body-bg);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #4C1D95;
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #7C3AED;
}
