/* ============================================================
   blackvolta - Global Styles
   ============================================================ */

:root {
    --ep-primary: #0369a1;
    --ep-secondary: #0c4a6e;
    --ep-accent: #0d9488;
    --ep-sidebar-width: 250px;
    --ep-sidebar-bg: #082f49;
}

.text-accent {
    color: var(--ep-accent) !important;
}

/* Layout */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f5f8fa;
    overflow-x: hidden;
}

#wrapper {
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--ep-sidebar-width);
    height: 100vh;
    max-height: 100vh;
    background: var(--ep-sidebar-bg) !important;
    transition: margin 0.25s ease-out;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar .list-group-item {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    border-radius: 0 !important;
    transition: all 0.2s;
}

.sidebar .list-group-item:hover,
.sidebar .list-group-item.active {
    background-color: rgba(13, 148, 136, 0.18) !important;
    color: #2dd4bf !important;
    border-left: 3px solid var(--ep-accent);
}

.sidebar .list-group-item i {
    width: 20px;
    text-align: center;
}

/* Collapsible group headers — chevron rotates when group is open */
.sidebar .sidebar-group-toggle { cursor: pointer; }
.sidebar .sidebar-group-toggle .sidebar-chevron { transition: transform 0.2s; opacity: 0.6; }
.sidebar .sidebar-group-toggle[aria-expanded="true"] .sidebar-chevron { transform: rotate(180deg); opacity: 1; }
.sidebar .sidebar-group-toggle:hover { background-color: rgba(255,255,255,0.04) !important; color: #fff !important; border-left: 0 !important; }

/* Page content offset for sidebar */
#page-content-wrapper {
    margin-left: var(--ep-sidebar-width);
    transition: margin 0.25s ease-out;
    min-height: 100vh;
}

/* Sidebar collapsed */
body.sidebar-collapsed .sidebar {
    margin-left: calc(-1 * var(--ep-sidebar-width));
}
body.sidebar-collapsed #page-content-wrapper {
    margin-left: 0;
}

/* Cards */
.card {
    border-radius: 12px;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
}

/* Buttons */
.btn-primary {
    background-color: var(--ep-primary);
    border-color: var(--ep-primary);
}
.btn-primary:hover {
    background-color: var(--ep-secondary);
    border-color: var(--ep-secondary);
}

.btn-danger {
    background-color: var(--ep-accent);
    border-color: var(--ep-accent);
}

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #e9ecef;
}

.table td {
    vertical-align: middle;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
}

/* Badge */
.badge-status {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 50px;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.2);
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--ep-sidebar-width));
    }
    #page-content-wrapper {
        margin-left: 0;
    }
    body.sidebar-open .sidebar {
        margin-left: 0;
    }
    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Dark Mode
   ============================================================ */
[data-bs-theme="dark"] {
    --ep-sidebar-bg: #111318;
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] {
    background-color: #1a1d23 !important;
    color: #dee2e6;
}

[data-bs-theme="dark"] .navbar,
[data-bs-theme="dark"] .bg-white {
    background-color: #212529 !important;
    border-color: #2d3238 !important;
}

[data-bs-theme="dark"] .navbar-text,
[data-bs-theme="dark"] .text-dark {
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .card {
    background-color: #212529;
    border-color: #2d3238;
}

[data-bs-theme="dark"] .card-header {
    background-color: #272b30 !important;
    border-color: #2d3238;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #dee2e6;
    --bs-table-border-color: #2d3238;
}

[data-bs-theme="dark"] .table th {
    color: #9ca3af;
    border-color: #2d3238;
}

[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table-hover tbody tr:hover {
    --bs-table-bg: #2d3238;
    --bs-table-color: #dee2e6;
}

[data-bs-theme="dark"] .table-warning {
    --bs-table-bg: #332d1a;
    --bs-table-color: #ffc107;
}

[data-bs-theme="dark"] .table-danger {
    --bs-table-bg: #331a1a;
    --bs-table-color: #dc3545;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #2d3238;
    border-color: #3d4248;
    color: #dee2e6;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #343a40;
    border-color: var(--ep-primary);
    color: #fff;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #272b30;
    border-color: #3d4248;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #dee2e6;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #2d3238;
    color: #fff;
}

[data-bs-theme="dark"] .alert-info {
    background-color: #1a2a3a;
    border-color: #2a3a4a;
    color: #6bb8e0;
}

[data-bs-theme="dark"] .alert-warning {
    background-color: #332d1a;
    border-color: #4a3f1a;
    color: #e0c36b;
}

[data-bs-theme="dark"] .alert-light {
    background-color: #272b30;
    border-color: #3d4248;
    color: #dee2e6;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #272b30 !important;
}

[data-bs-theme="dark"] .border-bottom {
    border-color: #2d3238 !important;
}

[data-bs-theme="dark"] .shadow-sm {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
}

[data-bs-theme="dark"] .text-muted {
    color: #8b929a !important;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #212529;
    border-color: #3d4248;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: #3d4248;
}

[data-bs-theme="dark"] .sidebar {
    background: var(--ep-sidebar-bg) !important;
}

[data-bs-theme="dark"] .accordion-button {
    background-color: #272b30;
    color: #dee2e6;
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #2d3238;
    color: #fff;
}

[data-bs-theme="dark"] .payment-info,
[data-bs-theme="dark"] .bg-f8f9fa {
    background-color: #272b30 !important;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.theme-toggle:hover {
    background-color: rgba(0,0,0,0.05);
}

[data-bs-theme="dark"] .theme-toggle {
    border-color: #3d4248;
    color: #ffc107;
}

[data-bs-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255,255,255,0.1);
}
