/**
 * LiveEasy design system — Phase 1 + 2
 * Mobile-aligned tokens, shell overrides, light/dark mode.
 * Loaded after theme.css; overrides CoolAdmin defaults.
 */

/* ------------------------------------------------------------------ */
/* Design tokens — light (default)                                     */
/* ------------------------------------------------------------------ */
:root {
    --le-primary: #D32F2F;
    --le-primary-dark: #B71C1C;
    --le-primary-light: #FFEBEE;
    --le-primary-muted: rgba(211, 47, 47, 0.12);

    --le-bg: #F4F5F7;
    --le-surface: #FFFFFF;
    --le-surface-raised: #FFFFFF;
    --le-border: #E8EAED;

    --le-text: #1A1A2E;
    --le-text-muted: #6B7280;
    --le-text-on-primary: #FFFFFF;

    --le-sidebar-bg: #FFFFFF;
    --le-sidebar-header-bg: var(--le-primary);
    --le-sidebar-logo-bg: #FFFFFF;
    --le-sidebar-link: #4B5563;
    --le-sidebar-link-hover: var(--le-primary);
    --le-sidebar-link-active: var(--le-primary);
    --le-sidebar-sub-bg: #FAFAFA;

    --le-header-bg: var(--le-surface);
    --le-header-border: var(--le-border);

    --le-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --le-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);

    --le-radius: 12px;
    --le-radius-lg: 16px;
    --le-radius-pill: 999px;

    --le-font: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --le-transition: 0.2s ease;
}

/* ------------------------------------------------------------------ */
/* Design tokens — dark                                                  */
/* ------------------------------------------------------------------ */
[data-theme="dark"] {
    --le-primary: #EF5350;
    --le-primary-dark: #E53935;
    --le-primary-light: rgba(239, 83, 80, 0.15);
    --le-primary-muted: rgba(239, 83, 80, 0.2);

    --le-bg: #0F1117;
    --le-surface: #1A1D27;
    --le-surface-raised: #222633;
    --le-border: #2D3348;

    --le-text: #E8EAED;
    --le-text-muted: #9CA3AF;
    --le-text-on-primary: #FFFFFF;

    --le-sidebar-bg: #141720;
    --le-sidebar-header-bg: #1A1D27;
    --le-sidebar-logo-bg: #222633;
    --le-sidebar-link: #9CA3AF;
    --le-sidebar-link-hover: #EF5350;
    --le-sidebar-link-active: #EF5350;
    --le-sidebar-sub-bg: #0F1117;

    --le-header-bg: #1A1D27;
    --le-header-border: #2D3348;

    --le-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --le-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ------------------------------------------------------------------ */
/* Base                                                                 */
/* ------------------------------------------------------------------ */
html {
    scroll-behavior: smooth;
    background: var(--le-bg);
}

body.animsition {
    font-family: var(--le-font);
    background: var(--le-bg);
    color: var(--le-text);
    transition: background-color var(--le-transition), color var(--le-transition);
}

/* CoolAdmin leaves 8vh gray padding below the page — remove it */
.page-wrapper {
    background: var(--le-bg) !important;
    padding-bottom: 0 !important;
}

@media (max-width: 991px) {
    .page-wrapper {
        background: var(--le-bg) !important;
        padding-bottom: 0 !important;
    }
}

.page-container {
    background: var(--le-bg) !important;
}

/* Remove landscape photo + dark overlay from main content shell */
.page-container .container-login100.le-app-shell,
.container-login100.le-app-shell {
    background-image: none !important;
    background-color: var(--le-bg) !important;
    align-items: flex-start;
    padding: 0;
    min-height: auto;
}

.page-container .container-login100.le-app-shell::before,
.container-login100.le-app-shell::before {
    display: none !important;
}

.main-content {
    width: 100%;
    min-height: calc(100vh - 75px);
    padding-bottom: 0 !important;
    display: flex;
    flex-direction: column;
}

.main-content > .animated.fadeIn {
    flex: 1 0 auto;
}

@media (max-width: 991px) {
    .main-content {
        padding-bottom: 0 !important;
        min-height: calc(100vh - 88px);
    }
}

.site-footer {
    flex-shrink: 0;
    margin-top: 2rem;
    background: transparent;
}

/* ------------------------------------------------------------------ */
/* Sidebar                                                              */
/* ------------------------------------------------------------------ */
.menu-sidebar {
    background: var(--le-sidebar-bg) !important;
    border-right: 1px solid var(--le-border);
    box-shadow: var(--le-shadow-sm);
    transition: background-color var(--le-transition), border-color var(--le-transition);
}

.menu-sidebar .logo {
    background: var(--le-sidebar-header-bg) !important;
    border-right: none !important;
    box-shadow: none !important;
    height: 75px;
    padding: 0 24px;
    justify-content: center;
}

.menu-sidebar .logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--le-sidebar-logo-bg);
    border-radius: var(--le-radius);
    padding: 8px 16px;
    box-shadow: var(--le-shadow-sm);
    transition: background-color var(--le-transition);
}

.menu-sidebar .logo img {
    max-height: 44px;
    width: auto;
}

.menu-sidebar2__content {
    background: var(--le-sidebar-bg);
}

.navbar-sidebar2 .navbar__list li a {
    color: var(--le-sidebar-link) !important;
    font-weight: 500;
    font-size: 14px;
    padding: 12px 16px !important;
    border-radius: var(--le-radius);
    margin: 2px 12px;
    transition: background-color var(--le-transition), color var(--le-transition);
}

.navbar-sidebar2 .navbar__list li a > i,
.navbar-sidebar2 .navbar__list li a .menu-icon {
    color: var(--le-sidebar-link);
    width: 20px;
    margin-right: 12px !important;
    transition: color var(--le-transition);
}

.navbar-sidebar2 .navbar__list li a:hover,
.navbar-sidebar2 .navbar__list li:hover > a {
    color: var(--le-sidebar-link-hover) !important;
    background: var(--le-primary-muted);
}

.navbar-sidebar2 .navbar__list li a:hover > i,
.navbar-sidebar2 .navbar__list li:hover > a > i {
    color: var(--le-sidebar-link-hover);
}

.navbar-sidebar2 .navbar__list li.active > a {
    color: var(--le-sidebar-link-active) !important;
    background: var(--le-primary-muted);
    font-weight: 600;
}

.navbar-sidebar2 .navbar__list li.active > a > i {
    color: var(--le-sidebar-link-active);
}

.navbar-sidebar2 .navbar__sub-list {
    background: var(--le-sidebar-sub-bg);
    border-radius: var(--le-radius);
    margin: 4px 12px 8px 24px;
    padding: 4px 0;
}

.navbar-sidebar2 .navbar__sub-list li a {
    font-size: 13px;
    padding: 10px 16px !important;
    margin: 0;
}

.navbar-sidebar2 .navbar__list li .arrow {
    color: var(--le-text-muted);
}

/* ------------------------------------------------------------------ */
/* Desktop header                                                       */
/* ------------------------------------------------------------------ */
.header-desktop {
    background: var(--le-header-bg) !important;
    border-bottom: 1px solid var(--le-header-border);
    box-shadow: var(--le-shadow-sm) !important;
    transition: background-color var(--le-transition), border-color var(--le-transition);
}

.header-desktop .noti__item {
    color: var(--le-text-muted);
    font-weight: 500;
    font-size: 14px;
}

.header-desktop .account-item .content a,
.header-desktop .account-item .content .js-acc-btn {
    color: var(--le-text) !important;
    font-weight: 600;
}

.header-desktop .account-dropdown {
    background: var(--le-surface-raised) !important;
    border: 1px solid var(--le-border);
    border-radius: var(--le-radius);
    box-shadow: var(--le-shadow-md);
}

.header-desktop .account-dropdown .name a,
.header-desktop .account-dropdown .email {
    color: var(--le-text) !important;
}

.header-desktop .account-dropdown__item a {
    color: var(--le-text-muted) !important;
}

.header-desktop .account-dropdown__item a:hover {
    color: var(--le-primary) !important;
    background: var(--le-primary-muted);
}

/* ------------------------------------------------------------------ */
/* Mobile header                                                        */
/* ------------------------------------------------------------------ */
.header-mobile .header-mobile__bar {
    background: var(--le-primary) !important;
    box-shadow: var(--le-shadow-md);
}

.header-mobile .header-mobile-inner .logo img {
    max-height: 40px;
}

.header-mobile .navbar-mobile {
    background: var(--le-sidebar-bg);
    border-bottom: 1px solid var(--le-border);
}

.header-mobile .navbar-mobile .navbar-mobile__list li a {
    color: var(--le-sidebar-link) !important;
}

.header-mobile .navbar-mobile .navbar-mobile__list li a:hover {
    color: var(--le-primary) !important;
}

.header-mobile .hamburger .hamburger-inner,
.header-mobile .hamburger .hamburger-inner::before,
.header-mobile .hamburger .hamburger-inner::after {
    background-color: #333 !important;
}

.header-mobile .hamburger {
    border: none;
    border-radius: 4px;
}

/* ------------------------------------------------------------------ */
/* Content area & cards (shell-level)                                   */
/* ------------------------------------------------------------------ */
.section__content--p30 {
    padding: 24px !important;
}

.card,
.table-data__tool,
.table-data2,
.statistic__item,
.au-card,
.overview-item {
    border-radius: var(--le-radius-lg);
}

.footer-inner.bg-white {
    background: var(--le-surface) !important;
    border-top: 1px solid var(--le-border);
    color: var(--le-text-muted);
    transition: background-color var(--le-transition), border-color var(--le-transition);
    margin-bottom: 0;
    padding-bottom: 1.5rem;
}

.copyright p {
    color: var(--le-text-muted);
    margin-bottom: 4px;
}

/* Tables & panels — dark mode base */
[data-theme="dark"] .table-data2 .table tbody,
[data-theme="dark"] .au-card {
    background-color: var(--le-surface) !important;
    color: var(--le-text);
}

[data-theme="dark"] .table thead th,
[data-theme="dark"] .table-data2 .table thead tr th {
    background: var(--le-surface-raised) !important;
    color: var(--le-text);
    border-color: var(--le-border) !important;
}

[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] .table-data2 .table tbody tr td {
    border-color: var(--le-border) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .au-input,
[data-theme="dark"] select.form-control {
    background: var(--le-surface-raised);
    border-color: var(--le-border);
    color: var(--le-text);
}

[data-theme="dark"] .alert {
    border-radius: var(--le-radius);
}

[data-theme="dark"] .card {
    background-color: var(--le-surface) !important;
    color: var(--le-text);
    border: 1px solid var(--le-border) !important;
    border-radius: var(--le-radius-lg) !important;
    overflow: hidden;
}

[data-theme="dark"] .card-header {
    background-color: var(--le-surface-raised) !important;
    color: var(--le-text);
    border-bottom: 1px solid var(--le-border) !important;
    border-radius: 0 !important;
}

[data-theme="dark"] .card-body {
    background-color: var(--le-surface) !important;
    color: var(--le-text);
    border-radius: 0 !important;
}

[data-theme="dark"] .card-title,
[data-theme="dark"] .card-header strong {
    color: var(--le-text) !important;
}

/* Striped tables — both row shades must stay dark (fixes invisible text on white rows) */
[data-theme="dark"] .table-striped tbody tr,
[data-theme="dark"] .table-striped tbody tr td,
[data-theme="dark"] .table.table-striped tbody tr,
[data-theme="dark"] .table.table-striped tbody tr td {
    color: var(--le-text) !important;
    border-color: var(--le-border) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) td,
[data-theme="dark"] .table.table-striped tbody tr:nth-of-type(odd),
[data-theme="dark"] .table.table-striped tbody tr:nth-of-type(odd) td {
    background-color: var(--le-surface) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(even),
[data-theme="dark"] .table-striped tbody tr:nth-of-type(even) td,
[data-theme="dark"] .table.table-striped tbody tr:nth-of-type(even),
[data-theme="dark"] .table.table-striped tbody tr:nth-of-type(even) td {
    background-color: var(--le-surface-raised) !important;
}

[data-theme="dark"] .table tbody tr:hover td,
[data-theme="dark"] .table-striped tbody tr:hover td {
    background-color: var(--le-primary-muted) !important;
    color: var(--le-text) !important;
}

[data-theme="dark"] .table tbody tr td a,
[data-theme="dark"] .table tbody tr td span:not([class*="btn-"]) {
    color: var(--le-text);
}

[data-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: var(--le-text-muted);
}

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

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--le-primary) !important;
    border-color: var(--le-primary) !important;
    color: #fff !important;
}

/* ------------------------------------------------------------------ */
/* Buttons — brand red (matches sidebar primary)                        */
/* ------------------------------------------------------------------ */
.btn-primary,
.btn-info,
.au-btn--submit,
.au-btn--blue,
.au-btn--green,
.au-btn.au-btn--blue,
input[type="submit"].btn-primary,
input[type="submit"].btn-info,
input[type="submit"]:not(.btn-outline-danger):not(.btn-outline-secondary):not(.btn-secondary),
button[type="submit"].btn-primary,
button[type="submit"].btn-info,
button[type="submit"].btn-lg,
button[type="submit"]:not(.btn-outline-danger):not(.btn-outline-secondary):not(.btn-secondary),
.btn-lg.btn-info,
.btn-lg.btn-primary,
a.btn.btn-info,
a .btn.btn-info {
    background-color: var(--le-primary) !important;
    border-color: var(--le-primary) !important;
    color: var(--le-text-on-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-info:hover,
.btn-info:focus,
.au-btn--submit:hover,
.au-btn--blue:hover,
.au-btn--green:hover,
.au-btn.au-btn--blue:hover,
input[type="submit"].btn-primary:hover,
input[type="submit"].btn-info:hover,
button[type="submit"].btn-primary:hover,
button[type="submit"].btn-info:hover,
button[type="submit"].btn-lg:hover,
.btn-lg.btn-info:hover,
.btn-lg.btn-primary:hover,
a.btn.btn-info:hover,
a .btn.btn-info:hover {
    background-color: var(--le-primary-dark) !important;
    border-color: var(--le-primary-dark) !important;
    color: var(--le-text-on-primary) !important;
}

.btn-primary:active,
.btn-primary.active,
.btn-info:active,
.btn-info.active,
button[type="submit"].btn-primary:active,
button[type="submit"].btn-info:active {
    background-color: var(--le-primary-dark) !important;
    border-color: var(--le-primary-dark) !important;
}

/* Non-submit action buttons that use .btn-primary styling */
button.btn-primary,
a.btn-primary {
    background-color: var(--le-primary) !important;
    border-color: var(--le-primary) !important;
    color: var(--le-text-on-primary) !important;
}

/* ------------------------------------------------------------------ */
/* Dark mode toggle button                                              */
/* ------------------------------------------------------------------ */
.le-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--le-border);
    border-radius: var(--le-radius);
    background: var(--le-surface-raised);
    color: var(--le-text);
    cursor: pointer;
    margin-right: 16px;
    flex-shrink: 0;
    transition: background-color var(--le-transition), border-color var(--le-transition),
                color var(--le-transition), transform 0.15s ease;
}

.le-theme-toggle:hover {
    background: var(--le-primary-muted);
    border-color: var(--le-primary);
    color: var(--le-primary);
    transform: scale(1.05);
}

.le-theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--le-primary-muted);
}

.le-theme-toggle .le-icon-light,
.le-theme-toggle .le-icon-dark {
    font-size: 16px;
    line-height: 1;
}

/* Light mode: show moon (switch to dark) */
.le-theme-toggle .le-icon-light { display: none; }
.le-theme-toggle .le-icon-dark  { display: inline; }

/* Dark mode: show sun (switch to light) */
[data-theme="dark"] .le-theme-toggle .le-icon-light { display: inline; }
[data-theme="dark"] .le-theme-toggle .le-icon-dark  { display: none; }

.header-mobile .le-theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    margin-right: 12px;
}

.header-mobile .le-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: #fff;
    color: #fff;
}

.header-button {
    display: flex;
    align-items: center;
}

.header-mobile-inner {
    gap: 8px;
}

.header-mobile-inner .logo {
    flex-shrink: 0;
}

.header-mobile-inner .le-theme-toggle {
    margin-left: auto;
}

.header-mobile-inner .hamburger {
    flex-shrink: 0;
}

/* Standalone pages (base_2 — no sidebar/header) */
.le-standalone-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
}

/* Loader respects theme */
.fallback-loader {
    background: var(--le-bg) !important;
}

/* ------------------------------------------------------------------ */
/* Toastr — compact notifications, clear of fixed header                  */
/* ------------------------------------------------------------------ */
#toast-container {
    z-index: 999999 !important;
}

#toast-container.toast-top-right {
    top: 20px;
    right: 20px;
}

@media (min-width: 992px) {
    /* Below fixed desktop header (75px) */
    body.animsition #toast-container.toast-top-right {
        top: 88px;
        right: 24px;
    }
}

#toast-container.toast-top-right > .toast,
#toast-container.toast-top-right > div {
    width: 360px !important;
    max-width: calc(100vw - 40px) !important;
    opacity: 1 !important;
    padding: 14px 18px 14px 50px !important;
    border-radius: var(--le-radius) !important;
    box-shadow: var(--le-shadow-md) !important;
    font-family: var(--le-font);
    font-size: 14px !important;
    line-height: 1.45 !important;
    background-position: 16px center !important;
    background-size: 22px !important;
}

#toast-container > .toast-success {
    background-color: #2E7D32 !important;
}

#toast-container > .toast-info {
    background-color: var(--le-primary) !important;
}

#toast-container > .toast-warning {
    background-color: #F57C00 !important;
}

#toast-container > .toast-error {
    background-color: #C62828 !important;
}

#toast-container .toast-close-button {
    font-size: 18px !important;
    font-weight: 400 !important;
    opacity: 0.85;
    top: -2px;
    right: 4px;
}

#toast-container .toast-progress {
    opacity: 0.5;
}

[data-theme="dark"] #toast-container.toast-top-right > .toast,
[data-theme="dark"] #toast-container.toast-top-right > div {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

/* ------------------------------------------------------------------ */
/* Mobile dashboard — Quick Menu card (desktop tiles unchanged)         */
/* ------------------------------------------------------------------ */
@media (max-width: 991px) {
    .le-quick-menu-card .card-body {
        padding: 16px;
    }

    .le-quick-menu-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px 10px;
    }

    /* Three items: one row of three */
    .le-quick-menu-grid:has(> :nth-child(3):last-child) {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Five or six items: three per row */
    .le-quick-menu-grid:has(> :nth-child(5):last-child),
    .le-quick-menu-grid:has(> :nth-child(6):last-child) {
        grid-template-columns: repeat(3, 1fr);
    }

    .le-quick-menu-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        text-decoration: none !important;
        padding: 4px 2px;
        border-radius: var(--le-radius);
        transition: background-color var(--le-transition);
    }

    .le-quick-menu-item:active {
        background: rgba(211, 47, 47, 0.06);
    }

    .le-quick-menu-item__icon {
        width: 54px;
        height: 54px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 8px;
        font-size: 22px;
    }

    .le-quick-menu-item__label {
        font-size: 12px;
        font-weight: 600;
        line-height: 1.25;
        color: var(--le-primary);
    }

    .le-quick-menu-item--c1 .le-quick-menu-item__icon {
        background: rgba(252, 70, 107, 0.14);
        color: #e91e63;
    }

    .le-quick-menu-item--c2 .le-quick-menu-item__icon {
        background: rgba(56, 239, 125, 0.14);
        color: #11998e;
    }

    .le-quick-menu-item--c3 .le-quick-menu-item__icon {
        background: rgba(255, 106, 0, 0.14);
        color: #ee0979;
    }

    .le-quick-menu-item--c4 .le-quick-menu-item__icon {
        background: rgba(220, 227, 91, 0.18);
        color: #45b649;
    }

    [data-theme="dark"] .le-quick-menu-item__label {
        color: #ff8a80;
    }

    [data-theme="dark"] .le-quick-menu-item--c1 .le-quick-menu-item__icon {
        background: rgba(252, 70, 107, 0.22);
        color: #ff80ab;
    }

    [data-theme="dark"] .le-quick-menu-item--c2 .le-quick-menu-item__icon {
        background: rgba(56, 239, 125, 0.18);
        color: #69f0ae;
    }

    [data-theme="dark"] .le-quick-menu-item--c3 .le-quick-menu-item__icon {
        background: rgba(255, 106, 0, 0.2);
        color: #ffab91;
    }

    [data-theme="dark"] .le-quick-menu-item--c4 .le-quick-menu-item__icon {
        background: rgba(220, 227, 91, 0.16);
        color: #c6ff00;
    }
}
