/* =========================================
   LMS GLOBAL THEME
========================================= */

:root {
    --lms-primary: #0B1A2E;
    --lms-secondary: #132843;
    --lms-gold: #F5D742;
    --lms-success: #198754;
    --lms-danger: #dc3545;
    --lms-warning: #ffc107;
    --lms-info: #0dcaf0;
    --lms-bg: #f4f7fb;
    --lms-card-bg: #ffffff;
    --lms-text: #1d2939;
    --lms-muted: #667085;
}

/* =========================================
   BODY & HTML – Prevent horizontal scroll
========================================= */

html,
body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--lms-bg);
    color: var(--lms-text);
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
    padding: 0;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* Fix for Safari/iOS */
}

/* =========================================
   FIX NAVMENU - Sticky sidebar & Prevent page scroll
========================================= */

/* Main page wrapper */
.page {
    display: flex !important;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* Fix for Safari/iOS */
    overflow: hidden; /* Prevents full-page scrolling on desktop */
}

/* Sidebar container – sticky on desktop */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    z-index: 100;
    background: var(--lms-primary);
}

/* Main navigation menu inside sidebar */
.verano-sidebar {
    background-color: #0b1a2e !important;
    width: 260px;
    max-width: 260px;
    flex-shrink: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    color: #e8edf3 !important;
    overflow-x: hidden;
}

/* Main content area – scrolls vertically */
main {
    flex: 1;
    overflow-y: auto;
    height: 100vh;
    overflow-x: hidden;
    min-width: 0;
}

.content {
    overflow-x: hidden;
    max-width: 100%;
}

/* =========================================
   PAGE LAYOUT
========================================= */

.page-container {
    padding: 1rem;
    max-width: 100%;
    overflow-x: hidden;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    color: var(--lms-primary);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

.page-subtitle {
    color: var(--lms-muted);
    font-size: .95rem;
}

/* =========================================
   CARDS
========================================= */

.lms-card {
    background: var(--lms-card-bg);
    border: none;
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
    transition: .3s;
    max-width: 100%;
    overflow: hidden;
}

    .lms-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 15px 35px rgba(0,0,0,.10);
    }

/* =========================================
   KPI CARDS
========================================= */

.kpi-card {
    background: white;
    border-radius: 18px;
    border: none;
    padding: 1.25rem;
    transition: .3s;
}

    .kpi-card:hover {
        transform: translateY(-4px);
    }

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(11,26,46,.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.kpi-card h3 {
    font-weight: 700;
    margin-bottom: 0;
}

.kpi-card h6 {
    margin-bottom: .35rem;
}

/* =========================================
   TABLES – Only tables scroll horizontally
========================================= */

.table-responsive {
    border-radius: 16px;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

    .table-responsive table {
        min-width: 600px;
        width: 100%;
        margin-bottom: 0;
        background: white;
    }

.lms-table {
    margin-bottom: 0;
    background: white;
}

    .lms-table thead {
        background: var(--lms-primary);
        color: white;
    }

    .lms-table th {
        font-weight: 600;
        padding: 14px;
        border: none;
        white-space: nowrap;
    }

    .lms-table td {
        padding: 14px;
        vertical-align: middle;
    }

    .lms-table tbody tr {
        transition: .25s;
    }

        .lms-table tbody tr:hover {
            background: rgba(245,215,66,.08);
        }

            .lms-table tbody tr:hover td {
                color: var(--lms-primary);
            }

/* =========================================
   FIX DROPDOWN OVERFLOW
========================================= */

.form-select {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-responsive .form-select {
    max-width: 120px;
    min-width: 80px;
}

select.form-select option {
    max-width: 100%;
    word-wrap: break-word;
}

@media (max-width: 576px) {
    .table-responsive .form-select {
        max-width: 80px;
        min-width: 60px;
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
        min-height: 30px;
    }
}

/* =========================================
   SEARCH AREA & FILTER CONTROLS
========================================= */

.search-panel {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 5px 20px rgba(0,0,0,.05);
    max-width: 100%;
    overflow-x: hidden;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}

    .filter-controls .filter-item {
        flex: 1 1 150px;
        min-width: 120px;
    }

        .filter-controls .filter-item label {
            display: block;
            font-size: 0.85rem;
            margin-bottom: 0.2rem;
            font-weight: 600;
        }

        .filter-controls .filter-item .form-control,
        .filter-controls .filter-item .form-select {
            width: 100%;
            min-height: 38px;
            font-size: 0.9rem;
        }

/* =========================================
   TOOLBAR / HEADER ACTION BUTTONS
========================================= */

.toolbar,
.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

    .toolbar > *,
    .header-actions > * {
        flex: 0 1 auto;
        min-width: fit-content;
    }

/* =========================================
   FORMS
========================================= */

.form-control,
.form-select {
    border-radius: 12px;
    min-height: 46px;
    border: 1px solid #d0d5dd;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--lms-gold);
        box-shadow: 0 0 0 .15rem rgba(245,215,66,.30);
    }

label {
    font-weight: 600;
    margin-bottom: .4rem;
}

/* =========================================
   BUTTONS
========================================= */

.btn {
    border-radius: 10px;
    font-weight: 600;
    padding-left: 14px;
    padding-right: 14px;
}

.btn-lms-primary {
    background: var(--lms-primary);
    color: white;
    border: none;
}

    .btn-lms-primary:hover {
        background: var(--lms-secondary);
        color: white;
    }

.btn-lms-gold {
    background: var(--lms-gold);
    color: var(--lms-primary);
    border: none;
}

    .btn-lms-gold:hover {
        opacity: .9;
    }

.btn-success,
.btn-warning,
.btn-danger,
.btn-info {
    font-weight: 600;
}

/* =========================================
   BADGES
========================================= */

.badge {
    padding: .6rem .8rem;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
}

/* =========================================
   DETAILS PAGE
========================================= */

.details-section {
    margin-bottom: 1rem;
}

    .details-section h6 {
        color: var(--lms-primary);
        font-weight: 700;
        margin-bottom: .75rem;
    }

.details-value {
    color: var(--lms-text);
}

/* =========================================
   DASHBOARD WIDGETS
========================================= */

.dashboard-card {
    background: white;
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,.05);
}

    .dashboard-card h5 {
        color: var(--lms-primary);
        font-weight: 700;
    }

/* =========================================
   SCROLLBAR
========================================= */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(11,26,46,.25);
    border-radius: 10px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(11,26,46,.45);
    }

/* =========================================
   ADD BUTTON (GLOBAL)
========================================= */

.btn-add {
    background: var(--lms-success);
    color: white;
    border: none;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 14px;
    transition: .2s;
}

    .btn-add:hover {
        background: #146c43;
        color: white;
        transform: translateY(-1px);
    }

/* =========================================
   SIDEBAR HEADER & TOGGLE (for NavMenu)
========================================= */

/* Sidebar header (logo + toggle) */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.verano-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: default;
    margin: 0;
    padding: 0;
    border-bottom: none;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, filter 0.25s ease;
    filter: drop-shadow(0 0 10px rgba(245, 215, 66, 0.3));
}

    .brand-logo:hover {
        transform: scale(1.08);
        filter: drop-shadow(0 0 24px rgba(245, 215, 66, 0.7));
    }

    .brand-logo svg {
        display: block;
    }

.brand-name {
    color: #f5d742 !important;
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

.brand-sub {
    color: #f5d742 !important;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.9;
}

/* Toggle button (hamburger) */
.sidebar-toggle {
    background: transparent;
    border: none;
    color: #e8edf3;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    transition: background 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .sidebar-toggle:hover {
        background: rgba(255, 255, 255, 0.12);
    }

/* Navigation scroll container */
.nav-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem 0;
    transition: all 0.3s ease;
}

    .nav-scroll.collapsed {
        display: none !important;
    }

/* Nav items – keep existing styles */
.verano-sidebar .nav-link {
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    border-radius: 6px;
    color: #d0d9e6 !important;
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: right;
    cursor: pointer;
}

    .verano-sidebar .nav-link i {
        font-size: 1.1rem;
        margin-left: 0.75rem;
        margin-right: 0.5rem;
        color: #f5d742 !important;
        width: 1.4rem;
        text-align: center;
    }

    .verano-sidebar .nav-link:hover {
        background-color: rgba(245, 215, 66, 0.15) !important;
        color: #fff8e0 !important;
    }

        .verano-sidebar .nav-link:hover i {
            color: #ffe066 !important;
        }

.verano-sidebar .nav-pills .nav-link.active,
.verano-sidebar .nav-pills .show > .nav-link {
    background-color: rgba(245, 215, 66, 0.2) !important;
    color: #fff8e0 !important;
    border-right: 3px solid #f5d742;
}

    .verano-sidebar .nav-pills .nav-link.active i,
    .verano-sidebar .nav-pills .show > .nav-link i {
        color: #ffe066 !important;
    }

.verano-sidebar .logout-btn {
    background: transparent;
    border: none;
    color: #d0d9e6 !important;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    width: 100%;
    text-align: right;
    display: flex;
    align-items: center;
}

    .verano-sidebar .logout-btn i {
        font-size: 1.1rem;
        margin-left: 0.75rem;
        margin-right: 0.5rem;
        color: #f5d742 !important;
        width: 1.4rem;
        text-align: center;
    }

    .verano-sidebar .logout-btn:hover {
        background-color: rgba(245, 215, 66, 0.15) !important;
        color: #fff8e0 !important;
    }

        .verano-sidebar .logout-btn:hover i {
            color: #ffe066 !important;
        }

.verano-sidebar .hr-gold {
    border-color: rgba(245, 215, 66, 0.3);
    margin: 0.75rem 0;
}

.verano-sidebar .nav-scroll::-webkit-scrollbar {
    width: 4px;
}

.verano-sidebar .nav-scroll::-webkit-scrollbar-track {
    background: #0b1a2e;
}

.verano-sidebar .nav-scroll::-webkit-scrollbar-thumb {
    background: #f5d742;
    border-radius: 4px;
}

/* =========================================
   RESPONSIVE – COMPLETE REWRITE
   ========================================= */

/* ===== TABLET & MOBILE (max-width: 992px) ===== */
@media (max-width: 992px) {

    /* Stack sidebar and main content vertically */
    .page {
        flex-direction: column !important;
        overflow: visible !important; /* Allow scrolling */
    }

    /* Sidebar becomes full-width, not sticky */
    .sidebar {
        position: relative !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-y: visible !important;
    }

    .verano-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        padding: 0 !important;
    }

    /* Main content takes full width */
    main {
        height: auto !important;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        overflow-y: visible !important;
        padding: 0.5rem !important;
    }

    .content {
        padding: 0.5rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .page-container {
        padding: 0.5rem !important;
    }

    /* Table adjustments */
    .table-responsive table {
        min-width: 550px !important;
    }
}

/* ===== TABLET (768px – 992px) ===== */
@media (min-width: 768px) and (max-width: 992px) {
    .page {
        flex-direction: row !important; /* Sidebar and content side?by?side */
    }

    .sidebar {
        width: 220px !important;
        max-width: 220px !important;
        height: 100vh !important;
        position: sticky !important;
    }

    .verano-sidebar {
        width: 220px !important;
        max-width: 220px !important;
        padding: 0.5rem !important;
        height: 100vh !important;
    }

    main {
        flex: 1 !important;
        height: 100vh !important;
        overflow-y: auto !important;
        padding: 0.5rem !important;
    }

    .table-responsive table {
        min-width: 550px !important;
    }

    /* Hide toggle button on tablet (menu always open) */
    .sidebar-toggle {
        display: none !important;
    }

    .nav-scroll.collapsed {
        display: block !important;
    }
}

/* ===== MOBILE (max-width: 767px) ===== */
@media (max-width: 767px) {

    .page {
        flex-direction: column !important;
        overflow: visible !important;
    }

    .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        height: auto !important;
    }

    .verano-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        padding: 0 !important;
    }

    main {
        height: auto !important;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        overflow-y: visible !important;
        padding: 0.25rem !important;
    }

    .content {
        padding: 0.25rem !important;
    }

    .page-container {
        padding: 0.25rem !important;
    }

    /* Smaller fonts */
    .page-title {
        font-size: 1.2rem !important;
    }

    .page-subtitle {
        font-size: 0.8rem !important;
    }

    .lms-card {
        padding: 0.75rem !important;
    }

    /* Tables – smaller min-width for horizontal scroll */
    .table-responsive table {
        min-width: 400px !important;
    }

    /* KPI cards */
    .kpi-card {
        margin-bottom: 0.5rem !important;
    }

    .kpi-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
    }

    .kpi-card h3 {
        font-size: 1.2rem !important;
    }

    .kpi-card h6 {
        font-size: 0.8rem !important;
    }

    /* Filters – single column */
    .filter-controls .filter-item {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }

        .filter-controls .filter-item label {
            font-size: 0.75rem !important;
        }

        .filter-controls .filter-item .form-control,
        .filter-controls .filter-item .form-select {
            min-height: 32px !important;
            font-size: 0.8rem !important;
        }

    /* Buttons – full width */
    .btn:not(.btn-sm) {
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }

    /* Toolbar – vertical */
    .toolbar,
    .header-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.3rem !important;
    }

        .toolbar > *,
        .header-actions > * {
            width: 100% !important;
            max-width: 100% !important;
        }

        .toolbar .btn,
        .header-actions .btn {
            width: 100% !important;
            font-size: 0.8rem !important;
            padding: 0.3rem 0.5rem !important;
            min-height: 32px !important;
        }

        .toolbar .form-control,
        .toolbar .form-select,
        .header-actions .form-control,
        .header-actions .form-select {
            max-width: 100% !important;
            width: 100% !important;
            min-height: 32px !important;
            font-size: 0.8rem !important;
        }

    /* Show toggle button on mobile */
    .sidebar-toggle {
        display: flex !important;
    }

    .nav-scroll.collapsed {
        display: none !important;
    }

    /* Remove old Blazor nav overrides that conflict */
    .verano-sidebar .navbar,
    .verano-sidebar .collapse,
    .verano-sidebar .navbar-collapse {
        background-color: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        border: none !important;
        box-shadow: none !important;
    }

    .verano-sidebar .nav-item,
    .verano-sidebar li {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
    }

    .verano-sidebar .nav-link,
    .verano-sidebar a {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        color: #e8edf3 !important;
        padding: 0.4rem 0.6rem !important;
        border-radius: 8px !important;
        text-decoration: none !important;
        font-size: 0.9rem !important;
        background: transparent !important;
        border: none !important;
    }

        .verano-sidebar .nav-link:hover,
        .verano-sidebar a:hover {
            background: rgba(255, 255, 255, 0.08) !important;
            color: #ffffff !important;
        }

    .verano-sidebar .navbar-toggler {
        display: none !important;
    }

    .verano-sidebar .collapse:not(.show) {
        display: flex !important;
        visibility: visible !important;
        height: auto !important;
    }
}

/* ===== DESKTOP (>= 768px) – hide toggle ===== */
@media (min-width: 768px) {
    .sidebar-toggle {
        display: none !important;
    }

    .nav-scroll.collapsed {
        display: block !important;
    }
}

/* ===== iPad Mini specific (768x1024) ===== */
@media only screen and (device-width: 768px) and (device-height: 1024px) and (orientation: portrait), only screen and (device-width: 1024px) and (device-height: 768px) and (orientation: landscape) {
    .verano-sidebar {
        width: 220px !important;
        max-width: 220px !important;
        padding: 0.5rem !important;
    }

        .verano-sidebar .nav-link {
            padding: 0.4rem 0.6rem !important;
            font-size: 0.85rem !important;
        }
}

/* ===== Extra small devices (max-width: 576px) – additional tweaks ===== */
@media (max-width: 576px) {
    .lms-card {
        padding: 0.5rem !important;
    }

    .kpi-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }

    .kpi-card h3 {
        font-size: 1rem !important;
    }

    .kpi-card h6 {
        font-size: 0.7rem !important;
    }

    .table-responsive table {
        min-width: 350px !important;
    }

    .btn-sm {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.4rem !important;
    }
}
