/* Admin Theme Variables */

:root {
    /* DEFAULT LIGHT THEME */
    --bg-main: #f1f5f9;
    /* Slate 100 */
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;

    /* Text Colors */
    --text-main: #1e293b;
    /* Slate 800 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    /* UI Elements */
    --border-color: #e2e8f0;
    /* Slate 200 */
    --input-bg: #ffffff;
    --hover-bg: #f8fafc;
    --shadow-color: rgba(0, 0, 0, 0.05);

    /* Brand Colors (Preserved) */
    --kerjoo-primary: #00a884;
    --kerjoo-dark: #0f172a;
    --kerjoo-light-green: #e0fbf4;
    --kerjoo-dark-green: #1ebbf0;
    --primary-gradient: linear-gradient(135deg, #00a884 0%, #008568 100%);
    --theme-gradient-green: linear-gradient(135deg, #1ebbf0 0%, #36dab1 100%);

    /* Status Colors */
    --success-bg: #dcfce7;
    --success-text: #166534;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --info-bg: #e0f2fe;
    --info-text: #075985;

    /* Specifics */
    --sidebar-active-bg: rgba(54, 218, 177, 0.1);
    --sidebar-active-text: #0d9488;
    --table-header-bg: #f8fafc;
    --table-hover-bg: #f1f5f9;
}

/* DARK THEME OVERRIDES */
[data-bs-theme="dark"] {
    /* Backgrounds */
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);

    /* Text Colors */
    --text-main: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* UI Elements */
    --border-color: #334155;
    --input-bg: #0f172a;
    --hover-bg: rgba(255, 255, 255, 0.05);
    --shadow-color: rgba(0, 0, 0, 0.3);

    /* Status Colors */
    --success-bg: rgba(46, 204, 113, 0.2);
    --success-text: #2ecc71;
    --danger-bg: rgba(231, 76, 60, 0.2);
    --danger-text: #e74c3c;
    --warning-bg: rgba(243, 156, 18, 0.2);
    --warning-text: #f39c12;
    --info-bg: rgba(52, 152, 219, 0.2);
    --info-text: #3498db;

    /* Specifics */
    --sidebar-active-bg: rgba(54, 218, 177, 0.1);
    --sidebar-active-text: #36dab1;
    --table-header-bg: rgba(0, 0, 0, 0.3);
    --table-hover-bg: rgba(54, 218, 177, 0.05);
}

/* Global Transitions & Base Styles */
body {
    background-color: var(--bg-main);
    color: var(--text-main);
}

body,
.card,
.admin-sidebar,
.admin-header,
.stat-card,
input,
select,
textarea {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Utility Classes for Theme Consistency */
.text-main {
    color: var(--text-main) !important;
}

.text-secondary-theme {
    color: var(--text-secondary) !important;
}

.bg-theme-card {
    background-color: var(--bg-card) !important;
}

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

.border-theme {
    border-color: var(--border-color) !important;
}

/* Sidebar Adjustments (Default Light) */
.admin-sidebar {
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
}

[data-bs-theme="dark"] .admin-sidebar {
    border-right: none;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    /* Match original dark shadow logic if possible or leave to cascade */
    background: var(--bg-sidebar);
    /* Ensure gradient applies */
}

/* In Light Mode, logo text might need check. In Dark Mode it's white. */
.admin-sidebar .logo h4 {
    color: var(--text-main);
    /* Adapt to theme */
}

[data-bs-theme="dark"] .admin-sidebar .logo h4 {
    color: white;
}

/* Form Controls */
.form-control,
.form-select {
    background-color: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-main);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-main);
    border-color: #36dab1;
    box-shadow: 0 0 0 0.25rem rgba(54, 218, 177, 0.25);
}

/* Placeholder Colors */
::placeholder {
    color: #94a3b8;
}

/* Modal */
.modal-content {
    background-color: var(--bg-card);
    color: var(--text-main);
}

/* Close button - In light mode (default), use standard or invert if needed. 
   Bootstrap 'btn-close' is black by default. 
   'btn-close-white' is white. 
*/
[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* SweetAlert customization */
div:where(.swal2-container) div:where(.swal2-popup) {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
}

/* Theme-aware Table Class */
.table-theme {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-hover-bg: var(--table-hover-bg);
    --bs-table-hover-color: var(--text-main);
    border-color: var(--border-color);
}

.table-theme thead th {
    background-color: var(--table-header-bg);
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table-theme td {
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}