/* ============================================
   ADMIN PANEL MASTER STYLESHEET
   All admin pages share this file
   ============================================ */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #8296f0;
    --secondary: #764ba2;
    --success: #48bb78;
    --success-dark: #38a169;
    --danger: #e53e3e;
    --danger-dark: #c53030;
    --warning: #ed8936;
    --warning-dark: #dd6b20;
    --info: #4299e1;
    --dark: #2d3748;
    --gray: #718096;
    --gray-light: #a0aec0;
    --light: #f7fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================
   FONT AWESOME ICON COLOR/PICKER HELPERS (2026-07-11)
   ============================================ */
.icon-success { color: var(--success); }
.icon-danger  { color: var(--danger); }
.icon-warning { color: var(--warning); }
.icon-muted   { color: var(--gray-light); }

.char-count-over { color: var(--danger); font-weight: 600; }

/* Role icon picker (admin/roles.php, admin/master-roles.php) - a grid of
   clickable Font Awesome icon buttons replacing the old free-text emoji
   input. */
.icon-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.icon-picker-option {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    font-size: 18px;
    color: var(--gray);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.icon-picker-option:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.icon-picker-option.selected {
    border-color: var(--primary);
    background: var(--light);
    color: var(--primary);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.5;
}

/* ============================================
   LAYOUT
   ============================================ */

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: relative;
    width: 280px;
    background: linear-gradient(180deg, var(--dark) 0%, #1a202c 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-scroller { width:100%; height:100%; overflow-y: auto; }

.sidebar-header {
    display:flex; justify-content:flex-start; align-items:center; gap:.8rem;
    padding: 30px 15px 20px 15px;
    /*text-align: center;*/
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
}

.sidebar-header h3 {
    font-size: 1rem;
    line-height:1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-footer { padding: 30px 20px 20px 20px; font-size:.75rem; color:#FFFFFF; opacity:.4; }

.sidebar-brand-logo {
    max-height: 32px;
    max-width: 160px;
    vertical-align: middle;
    display: inline-block;
}

.sidebar-header small {
    color: var(--gray-light);
    font-size: 12px;
}

.sidebar-nav {
    padding: 0 15px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 4px 10px;
    margin: 3px 0;
    color: #cbd5e0;
    text-decoration: none;
    transition: all 0.3s;
    font-size: .95rem;
    border-radius: 10px;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(5px);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.nav-icon {
    display:flex; justify-content: center; align-items: center;
    flex-shrink: 0;
    width:4%; height:20px;
}

.nav-label {
    white-space: nowrap;
    overflow: hidden;
}

/* Collapsible nav-group sections (e.g. "Catalog", "Settings") - a group
   header looks/sits exactly like a regular .sidebar-nav a link, but is a
   <button> that toggles a nested item list instead of navigating. See
   assets/js/admin.js's initNavGroups() for the click/persistence logic. */
.nav-group-header {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 7px 15px;
    margin: 3px 0;
    background: none;
    border: none;
    color: #cbd5e0;
    font-size: .95rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s;
}

.nav-group-header:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-group-header .nav-label {
    flex: 1;
}

.nav-group-chevron {
    flex-shrink: 0;
    font-size: 11px;
    opacity: 0.7;
    transition: transform 0.2s;
}

.nav-group.expanded .nav-group-chevron {
    transform: rotate(180deg);
}

.nav-group-items {
    display: none;
}

.nav-group.expanded .nav-group-items {
    display: block;
    animation: slideDown 0.2s ease;
}

/* Indented under the group header's icon/label start - reset back to the
   regular left padding once the sidebar collapses to an icon-only rail
   (see the @media (min-width: 769px) collapsed-rail rules further down). */
.nav-group-items a {
    padding-left: 34px;
    font-size: .85rem;
    opacity: .7;
}
.nav-group-items a:hover { opacity:1; }

/* Desktop collapse-to-icon-rail toggle - hidden on mobile, see the
   MOBILE NAVIGATION MENU section further down for the .collapsed rules
   themselves and the mobile-only hide of this button. */
.sidebar-collapse-toggle {
    position: absolute;
    display:flex; justify-content:center; align-items:center;
    top: 5px;
    right: 0;
    width: 18px;
    height: 23px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 16px;
    line-height:1;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-collapse-toggle:hover {
    background: rgba(255,255,255,0.15);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 25px;
    min-height: 100vh;
}

/* Header */
.admin-header {
    background: var(--white);
    padding: 20px 25px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.admin-header h1 {
    font-size: 24px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--light);
    padding: 8px 15px;
    border-radius: 30px;
}

.admin-user span {
    color: var(--gray);
    font-size: 14px;
}

.admin-user strong {
    color: var(--dark);
}

/* ============================================
    REPORTS PAGE SPECIFIC STYLES
    ============================================ */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #e2e8f0;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.summary-card h3 {
    font-size: 13px;
    color: #718096;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card .value {
    font-size: 28px;
    font-weight: bold;
    color: #2d3748;
}

.summary-card .value.paid {
    color: #48bb78;
}

.summary-card .value.checked-in {
    color: #4299e1;
}

.summary-card .value.pending {
    color: #ed8936;
}

.summary-card small {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: #a0aec0;
}

.report-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.tab-btn:hover:not(.active) {
    background: #f7fafc;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-container h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #2d3748;
}

canvas {
    max-height: 300px;
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.data-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f7fafc;
    padding: 5px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 5px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

.data-table tr:hover {
    background: #f7fafc;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Inactive/disabled record - same dimmed treatment as the card-based
   modules (.channel-card.inactive, .category-card.inactive, etc), applied
   generically here since every table-based listing (coupons, users,
   roles, ...) shares this one .data-table class. */
.data-table tr.inactive {
    opacity: 0.55;
}

.data-table tr.inactive:hover {
    opacity: 0.8;
}

.usage-bar {
    width: 80px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.usage-fill {
    height: 100%;
    background: #48bb78;
    transition: width 0.3s;
}

.text-center {
    text-align: center;
}

@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .summary-card .value {
        font-size: 20px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .report-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        text-align: center;
    }
}

/* ============================================
   STATS CARDS
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: var(--dark);
}

.stat-sub {
    font-size: 12px;
    color: var(--success);
    margin-top: 8px;
}

/* ============================================
   FILTERS BAR
   ============================================ */

.filters-bar {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.filters-form {display: flex; gap: 15px; flex-wrap: wrap; align-items: flex-end;}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 180px;
    transition: all 0.3s;
    background: var(--white);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.value paid {}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-decoration: none;
    white-space:nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: var(--danger-dark);
}

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

.btn-warning:hover {
    background: var(--warning-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    gap: 5px;
}

/* ============================================
   TABLES
   ============================================ */

.data-table {
    width: 100%;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.data-table th,
.data-table td {
    padding: 5px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--light);
    font-weight: 600;
    color: var(--gray);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: var(--light);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space:nowrap;
}

.status-paid,
.status-active,
.status-success {
    background: #c6f6d5;
    color: #22543d;
}

.status-pending,
.status-warning {
    background: #fef5e7;
    color: #975a16;
}

.status-failed,
.status-inactive,
.status-danger {
    background: #fed7d7;
    color: #742a2a;
}

.status-expired {
    background: #e2e8f0;
    color: #4a5568;
}

/* ============================================
   CARDS & SECTIONS
   ============================================ */

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.card-header h3 {
    font-size: 18px;
    color: var(--dark);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.info-section {
    background: var(--light);
    padding: 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.info-section h4 {
    margin-bottom: 12px;
    color: var(--dark);
    font-size: 14px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.info-section p {
    margin: 8px 0;
    font-size: 14px;
}

/* ============================================
   ORDER CARDS (Collapsible)
   ============================================ */

.order-card {
    background: var(--white);
    border-radius: var(--radius);
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.order-card:hover {
    box-shadow: var(--shadow-md);
}

.order-header {
    background: var(--light);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.order-header:hover {
    background: #edf2f7;
}

.order-details {
    padding: 0;
    display: none;
    border-top: 1px solid var(--border);
}

.order-details.active {
    display: block;
    padding: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   FORMS & MODAL
   ============================================ */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--gray);
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Show/hide toggle for password fields - assets/js/admin.js's
   initPasswordToggles() wires up any .password-toggle button next to a
   .password-wrapper input generically, no per-page JS needed. */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-light);
    font-size: 16px;
    padding: 5px;
    line-height: 1;
}

.password-toggle:hover {
    color: var(--gray);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

/* .modal-content used to be the scroll container itself (overflow-y:
   auto directly on it), which meant an absolutely-positioned close
   button anchored to it scrolled away too - position:absolute only
   removes an element from flow, it doesn't exempt it from its own
   containing block's internal scroll. Fixed by making .modal-content a
   fixed-height flex column that never scrolls itself: .modal-header
   (flex-shrink:0) keeps its natural size, and its sibling - the <form>
   (or content div) every modal wraps its body in - is the one flex
   item that grows and scrolls internally (see ".modal-header + *"
   below). The close button then lives in the non-scrolling outer box
   and stays fixed regardless of how far the form body is scrolled. */
.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 550px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    padding-right: 36px;
    border-bottom: 2px solid var(--border);
}

.modal-header h2 {
    color: var(--dark);
    font-size: 22px;
}

/* The actual scrolling region - whatever immediately follows the header
   (a <form> in every modal in this app, occasionally a plain content
   div). min-height: 0 is required on a flex item for its own overflow
   to work at all; without it the item refuses to shrink below its
   content's natural height and just expands .modal-content instead. */
.modal-header + * {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Pinned to the modal box's own top-right corner (position: relative on
   .modal-content above) - lives in the non-scrolling header area, so it
   stays put regardless of how far the form body is scrolled.
   Click-outside-to-close is intentionally disabled app-wide (see each
   module's JS - the listener is still there, just neutralized) since it
   was too easy to trigger by accident and lose an in-progress form;
   this is the only way to close a modal now, so it needs to be reliably
   reachable at all times. */
.close-modal {
    position: absolute;
    top: 18px;
    right: 20px;
    z-index: 2;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: var(--gray-light);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger);
}

/* ============================================
   PROGRESS BARS
   ============================================ */

.usage-bar {
    width: 100px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}

.usage-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    background: var(--white);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--primary);
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination .active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    border-color: transparent;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid;
    white-space: pre-line;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border-left-color: var(--success);
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border-left-color: var(--danger);
}

.alert-info {
    background: #bee3f8;
    color: #2c5282;
    border-left-color: var(--info);
}

.alert-warning {
    background: #fef5e7;
    color: #975a16;
    border-left-color: var(--warning);
}

.subscription-locked-banner {
    margin: 20px 30px 0;
}

.subscription-locked-banner a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* Small colored dot used INSIDE a toast's message content (e.g. the
   concurrent-edit presence notification, assets/js/edit-presence.js) to
   distinguish "actively viewing" from "idle" - kept as a standalone
   decoration rather than a toast-level concept, so the generic toast
   module (below) stays fully decoupled from presence-specific meaning. */
.presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.presence-dot--active {
    background: var(--info);
    animation: presencePulse 1.6s ease-in-out infinite;
}

.presence-dot--idle {
    background: #a0aec0;
}

@keyframes presencePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Reusable stacking toast notifications (assets/js/toast.js) - floating,
   closable, color-coded, bottom-left. Reuses the exact same
   .alert-success/.alert-error/.alert-info/.alert-warning palette above
   rather than a new one. #toast-container is created lazily by JS, not
   rendered server-side - no HTML dependency, genuinely portable with just
   the one <script> tag. */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    animation: toastSlideIn 0.25s ease;
}

.toast-message {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: pre-line;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    color: inherit;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

.toast-refresh-btn {
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.12);
    border: none;
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: inherit;
    cursor: pointer;
}

.toast-refresh-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.toast--success { background: #c6f6d5; color: #22543d; border-left-color: var(--success); }
.toast--error   { background: #fed7d7; color: #742a2a; border-left-color: var(--danger); }
.toast--info    { background: #bee3f8; color: #2c5282; border-left-color: var(--info); }
.toast--warning { background: #fef5e7; color: #975a16; border-left-color: var(--warning); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }

.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }

.gap-1 { gap: 5px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-wrap { flex-wrap: wrap; }

/* ============================================
   PROGRAMS
   ============================================ */
.programs-container {
    padding: 20px;
}

.add-program-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.add-program-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.program-card {
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s;
    display: flex;
    flex-wrap: wrap;
}

.program-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.program-image {
    width: 200px;
    height: 150px;
    object-fit: cover;
    background: #f7fafc;
}

.program-info {
    flex: 1;
    padding: 15px 20px;
}

.program-title {
    font-size: 18px;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 8px;
}

.program-desc {
    color: #718096;
    font-size: 13px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.program-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 13px;
}

.program-meta span {
    color: #4a5568;
}

.program-price {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.quota-bar {
    width: 150px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}

.quota-fill {
    height: 100%;
    background: #48bb78;
    transition: width 0.3s;
}

.program-actions {
    padding: 15px 20px;
    display: flex;
    gap: 8px;
    align-items: center;
    border-left: 1px solid #e2e8f0;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
}

.status-active { background: #c6f6d5; color: #22543d; }
.status-inactive { background: #fed7d7; color: #742a2a; }
.status-sold_out { background: #fef5e7; color: #975a16; }
.status-coming_soon { background: #bee3f8; color: #2b6cb0; }
.status-expired { background: #e2e8f0; color: #4a5568; }

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 650px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.form-row {
    margin-bottom: 18px;
}

.form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.form-row textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    outline: none;
    border-color: #667eea;
}

/*
 * Shared native color-picker sizing, used by any admin form's
 * <input type="color"> (admin/companies.php, admin/company-groups.php -
 * assets/css/themes.css has its own near-identical copy scoped to its
 * own .branding-color-row context). Without this, the generic
 * `.form-row input` rule above (width:100%, padding:10px 12px) stretches
 * a color input into a long bar with a big empty inset around the
 * actual color swatch - reported as "padding on outer box, and longer
 * width." A native color input's *visible* swatch is also a separate
 * browser-internal element with its own default padding
 * (::-webkit-color-swatch / ::-moz-color-swatch) that has to be reset
 * directly, not just the outer input's own box.
 *
 * Two selectors, one per context this class is actually used in -
 * `.form-row .color-picker-input` (2 classes) still needed anywhere this
 * ends up inside a plain .form-row, `.color-fields-row .color-picker-input`
 * for the packed side-by-side layout below - both need two classes to
 * out-specificity `.form-row input` above (a single class alone ties on
 * specificity with it, and `.form-row input`'s extra type selector wins
 * any tie).
 */
.form-row .color-picker-input,
.color-fields-row .color-picker-input {
    width: 72px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    overflow: hidden;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-input::-webkit-color-swatch {
    border: none;
}

.color-picker-input::-moz-color-swatch {
    border: none;
}

/*
 * Packs two (or more) color-picker fields (Primary/Secondary Color) into
 * one compact row instead of two separate full-width, stacked .form-row
 * blocks - each field sized to its own content (flex: none, not
 * flex-grow) so they sit packed next to each other as columns rather
 * than stretching to fill the row, with a fixed 20px gap between them.
 * Each field is its own 2-row column - label on top, swatch directly
 * below it (not side by side like assets/css/themes.css's
 * .branding-color-row, which is a genuinely different layout for a
 * different context - a checkbox+label+swatch single row). Used by
 * admin/companies.php and admin/company-groups.php.
 */
.color-fields-row {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.color-field-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex: none;
}

.color-field-item label {
    margin-bottom: 0;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
    white-space: nowrap;
}

.image-preview {
    margin-top: 10px;
    max-width: 150px;
}

.image-preview img {
    width: 100%;
    border-radius: 8px;
}

/* ============================================
   CATEGORIES
   ============================================ */
.categories-container {
    padding: 20px;
}

.add-category-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.category-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.category-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.category-name {
    font-size: 18px;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 5px;
}

.category-slug {
    font-size: 12px;
    color: #718096;
    font-family: monospace;
    margin-bottom: 10px;
}

.category-desc {
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 15px;
    line-height: 1.4;
}

.category-stats {
    font-size: 12px;
    color: #667eea;
    margin-bottom: 15px;
}

.category-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    .main-content {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {
    /* .sidebar's mobile positioning (off-canvas panel) is handled in the
       MOBILE NAVIGATION MENU section further down, which needs to win the
       cascade over the width/height here - not repeated in both places. */
    .main-content {
        margin-left: 0;
    }
    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .filters-bar {
        flex-direction: column;
    }
    .filter-group select,
    .filter-group input {
        min-width: 100%;
    }
    .data-table {
        font-size: 12px;
        overflow-x: auto;
        display: block;
    }
    .data-table th,
    .data-table td {
        padding: 10px;
        white-space: nowrap;
    }
    .info-grid {
        grid-template-columns: 1fr;
    }
    .program-card {
        flex-direction: column;
    }
    .program-image {
        width: 100%;
        height: 180px;
    }
    .program-actions {
        border-left: none;
        border-top: 1px solid #e2e8f0;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px;
    }
    .stat-number {
        font-size: 28px;
    }
    .order-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .sidebar,
    .admin-header .btn,
    .filters-bar,
    .pagination,
    .action-buttons,
    .btn {
        display: none;
    }
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    .order-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    .stat-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   MOBILE NAVIGATION MENU
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
}

/* Close button - only meaningful on the mobile off-canvas panel, hidden
   on desktop below */
.sidebar-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    color: white;
    cursor: pointer;
    background: none;
    border: none;
}

/* Responsive - the single #app-sidebar becomes an off-canvas panel here
   instead of the old separate .sidebar-mobile markup */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100%;
        z-index: 1003;
        transition: left 0.3s ease;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* A desktop "collapsed" rail never makes sense once the sidebar is
       opened as a full mobile off-canvas panel - always show full width
       and labels here regardless of the collapsed state persisted for
       desktop. */
    .sidebar.collapsed {
        width: 280px;
    }
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .sidebar-header small,
    .sidebar.collapsed .sidebar-brand-text {
        display: inline !important;
    }
    .sidebar-collapse-toggle {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 70px;
    }

    .admin-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .admin-header h1 {
        font-size: 20px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle,
    .sidebar-overlay,
    .sidebar-close {
        display: none !important;
    }

    /* Icon-only collapsed rail */
    .sidebar.collapsed {
        width: 72px;
    }
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .sidebar-header small,
    .sidebar.collapsed .sidebar-brand-text,
    .sidebar.collapsed .nav-divider,
    .sidebar.collapsed .nav-group-header {
        display: none;
    }
    .sidebar.collapsed .sidebar-nav a {
        justify-content: center;
    }
    /* Copyright footer shrinks to just the (c) symbol via the shared
       .nav-label hide above - center it in the narrow icon rail instead
       of leaving it stranded at the padded left edge. */
    .sidebar.collapsed .sidebar-footer {
        text-align: center;
        padding-left: 0;
        padding-right: 0;
    }
    /* A group's own header (its expand/collapse control) has nowhere to
       go in an icon-only rail, so it's hidden above - but its items still
       need real navigable icons, same as before groups existed. Force
       them visible regardless of expanded/collapsed state and drop the
       expanded view's extra indentation, so the rail degrades back to a
       flat icon list exactly like every other top-level link. */
    .sidebar.collapsed .nav-group-items {
        display: block !important;
    }
    .sidebar.collapsed .nav-group-items a {
        padding-left: 15px;
    }
    .sidebar.collapsed + .main-content {
        margin-left: 72px;
    }
    .sidebar.collapsed .sidebar-collapse-toggle {
        transform: scaleX(-1);
    }
}

/* ============================================
   SCANNER PAGE STYLES
   ============================================ */

.scanner-container {
    padding: 20px;
}

.scanner-header {
    background: white;
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.scanner-header h2 {
    font-size: 24px;
    color: var(--dark);
}

.scanner-user {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--light);
    padding: 8px 15px;
    border-radius: 30px;
}

.scanner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.scanner-box,
.result-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.scanner-box h3,
.result-box h3,
.history-box h3 {
    margin-bottom: 15px;
    font-size: 18px;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.video-container {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    min-height: 300px;
    position: relative;
}

#video {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
}

.scan-error {
    margin-bottom: 15px;
}

.manual-entry {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.manual-entry h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--gray);
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

.result-box {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-pending,
.result-success,
.result-error {
    text-align: center;
    padding: 30px;
}

.result-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.success-icon {
    font-size: 64px;
    color: var(--success);
    margin-bottom: 20px;
}

.error-icon {
    font-size: 64px;
    color: var(--danger);
    margin-bottom: 20px;
}

.result-success h2,
.result-error h2,
.result-pending h3 {
    margin-bottom: 10px;
}

.attendee-details {
    margin-top: 15px;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
    text-align: left;
}

.attendee-details div {
    margin: 5px 0;
}

.history-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.history-log {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-empty {
    color: var(--gray-light);
    text-align: center;
    padding: 20px;
}

.history-success {
    color: var(--success);
}

.history-error {
    color: var(--danger);
}

.sales-label.cancelled { color: #e53e3e; }
.sales-number.cancelled { color: #e53e3e; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .scanner-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .scanner-grid {
        grid-template-columns: 1fr;
    }
    
    .video-container {
        min-height: 250px;
    }
    
    #video {
        min-height: 250px;
        object-fit: cover;
    }
    
    .result-box {
        min-height: 300px;
    }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .summary-card .value {
        font-size: 18px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }
    
    .filters-form {
        flex-direction: column;
    }
    
    .filter-group input,
    .filter-group select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .report-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        text-align: center;
    }
}

.list-button { display:flex; gap:.8rem; align-items:center; margin-bottom:1rem; }
.list-group { display:flex; gap:.8rem; }
.list-group a { text-decoration:none; border:1px #CCCCCC solid; padding:4px 14px; border-radius:5px; font-size:.75rem; text-transform:uppercase; color:#333333; }
.list-group a:hover { background:#EEEEEE; }

.nav-divider {
    padding: 15px 15px 8px;
    color: var(--gray-light);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    opacity: 0.6;
}

/* ============================================
   COMPANY SWITCHER (Master Admin Only)
   ============================================ */

.company-switcher {
    position: relative;
    display: inline-block;
    margin-left: 15px;
}

.company-switcher-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border);
    user-select: none;
}

.company-switcher-trigger:hover {
    background: #edf2f7;
    border-color: var(--primary);
}

.company-switcher-icon {
    font-size: 16px;
}

.company-switcher-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-switcher-arrow {
    font-size: 10px;
    color: var(--gray);
    transition: transform 0.3s;
}

.company-switcher-trigger.active .company-switcher-arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.company-switcher-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    max-width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    padding: 8px 0;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    animation: dropdownSlideDown 0.2s ease;
}

.company-switcher-dropdown.show {
    display: block;
}

@keyframes dropdownSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.company-switcher-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 13px;
}

.company-switcher-item:hover {
    background: var(--light);
}

.company-switcher-item.active {
    background: #ebf4ff;
    color: var(--primary);
}

.company-switcher-item.all-companies {
    font-weight: 600;
    color: var(--primary);
}

.company-switcher-item .check-mark {
    margin-left: auto;
    color: var(--success);
    font-weight: 700;
}

/* Disabled company row in the master-admin switcher (2026-07-17) -
   still clickable (master admin can switch into it to view data), just
   visually distinct - same dim treatment as .data-table tr.inactive,
   plus a small badge matching .status-inactive's color language. */
.company-switcher-item.disabled-company {
    opacity: 0.6;
}

.company-switcher-item .disabled-badge {
    margin-left: auto;
    background: #fed7d7;
    color: #742a2a;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.company-switcher-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 12px;
}

/* ============================================
   USER ACCOUNT MENU (header avatar + name -> dropdown)
   ============================================ */

/* Base avatar - an <img> (real photo) or a .user-avatar-placeholder
   <span> (circular fa-user icon) - see renderUserAvatar() in
   includes/functions.php, which always emits one of these two shapes so
   every user-representing surface in the app renders consistently. */
.user-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    background: var(--light);
    border: 1px solid var(--border);
}

.user-avatar-sm { width: 32px; height: 32px; font-size: 14px; }
.user-avatar-md { width: 48px; height: 48px; font-size: 20px; }
.user-avatar-lg { width: 120px; height: 120px; font-size: 48px; }

.user-menu {
    position: relative;
    display: inline-block;
    margin-left: 15px;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 6px;
    background: var(--light);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border);
    user-select: none;
}

.user-menu-trigger:hover {
    background: #edf2f7;
    border-color: var(--primary);
}

.user-menu-trigger strong {
    font-size: 14px;
    color: var(--dark);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-arrow {
    font-size: 10px;
    color: var(--gray);
    transition: transform 0.3s;
}

.user-menu-trigger.active .user-menu-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    max-width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    padding: 8px 0;
    z-index: 1000;
    animation: dropdownSlideDown 0.2s ease;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px 14px;
}

.user-menu-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.user-menu-header-info strong {
    font-size: 14px;
    color: var(--dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-header-info span {
    font-size: 12px;
    color: var(--gray);
}

.user-menu-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 16px 8px;
    padding: 4px 10px;
    background: var(--light);
    border-radius: 6px;
    font-size: 12px;
    color: var(--dark);
}

.user-menu-badge-primary {
    color: var(--primary);
    font-weight: 600;
    background: #ebf4ff;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 12px;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 13px;
    background: none;
    border: none;
    text-align: left;
    font-family: inherit;
}

.user-menu-item:hover {
    background: var(--light);
}

.user-menu-item-danger {
    color: var(--danger);
}

.profile-card {
    max-width: 520px;
}

/* Responsive */
@media (max-width: 768px) {
    .company-switcher {
        margin-left: 0;
        width: 100%;
    }
    
    .company-switcher-trigger {
        justify-content: center;
        width: 100%;
    }
    
    .company-switcher-dropdown {
        right: auto;
        left: 0;
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .company-switcher-label {
        max-width: 100px;
        font-size: 12px;
    }
}

/* Company Badges */
.company-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #ebf4ff;
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.viewing-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #fef5e7;
    color: #975a16;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(237, 137, 54, 0.2);
}

/* Program Card Layout */
.program-card {
    display: flex;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s;
    min-height: 200px;
}

.program-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.program-image-wrapper {
    flex: 0 0 220px;
    min-height: 200px;
    overflow: hidden;
    position: relative;
}

.program-image-wrapper .program-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.program-image-wrapper.placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.program-image-placeholder {
    font-size: 48px;
    color: white;
    text-align: center;
}

.program-info {
    flex: 1;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.program-title {
    font-size: 18px;
    font-weight: bold;
    color: #2d3748;
}

/* Slug Styles */
.program-slug {
    font-size: 12px;
    color: #718096;
    margin: 2px 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.slug-label {
    color: #4a5568;
    font-weight: 500;
}

.slug-link {
    color: #4299e1;
    text-decoration: none;
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
}

.slug-link:hover {
    text-decoration: underline;
    color: #2b6cb0;
}

.copy-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 0 4px 2px 4px;
    cursor: pointer;
    font-size: .7rem;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #e2e8f0;
}

.slug-preview-row {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.slug-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    min-height: 40px;
}

.slug-prefix {
    color: #718096;
    font-size: 12px;
}

.slug-preview-value {
    font-weight: 600;
    color: #2d3748;
    font-family: monospace;
}

.slug-preview-value em {
    color: #a0aec0;
    font-style: italic;
    font-weight: normal;
}

.slug-hint {
    color: #718096;
    font-size: 12px;
    margin-top: 4px;
}

.program-desc {
    color: #718096;
    font-size: 13px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.program-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 10px;
}

/* Sales Display */
.program-sales {
    padding: 10px 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 5px;
}

.sales-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 25px;
    margin-bottom: 8px;
}

.sales-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.sales-label {
    color: #4a5568;
    font-weight: 500;
}

.sales-label.paid { color: #48bb78; }
.sales-label.pending { color: #ed8936; }
.sales-label.failed { color: #e53e3e; }
.sales-label.expired { color: #718096; }

.sales-number {
    font-weight: bold;
    color: #2d3748;
}

.sales-number.paid { color: #48bb78; }
.sales-number.pending { color: #ed8936; }
.sales-number.failed { color: #e53e3e; }
.sales-number.expired { color: #718096; }

.quota-bar-container {
    margin-top: 5px;
}

.quota-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.quota-fill {
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.quota-fill.paid-fill { background: #48bb78; z-index: 4; }
.quota-fill.pending-fill { background: #ed8936; z-index: 3; }
.quota-fill.failed-fill { background: #e53e3e; z-index: 2; }
.quota-fill.expired-fill { background: #718096; z-index: 1; }

.quota-legend {
    display: flex;
    gap: 15px;
    margin-top: 5px;
    font-size: 11px;
    color: #718096;
}

.quota-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.program-actions {
    flex: 0 0 200px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-left: 1px solid #e2e8f0;
    background: #fafafa;
}

.program-price {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

/* Responsive */
@media (max-width: 768px) {
    .program-card {
        flex-direction: column;
    }
    
    .program-image-wrapper {
        flex: 0 0 180px;
        width: 100%;
        min-height: 180px;
    }
    
    .program-image-wrapper .program-image {
        position: relative;
        height: 180px;
    }
    
    .program-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        padding: 15px;
    }
    
    .sales-summary {
        gap: 8px 15px;
    }
    
    .sales-item {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .program-image-wrapper {
        flex: 0 0 140px;
        min-height: 140px;
    }
    
    .program-image-wrapper .program-image {
        height: 140px;
    }
}

/* List Header */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.list-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    background:#EEEEEE;
    padding:5px 5px 5px 20px;
    border-radius:10px;
}

.record-count {
    font-size: 13px;
    color: #718096;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4a5568;
}

.per-page-selector select {
    padding: 5px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

/* Pagination */
.pagination-link {
    display: inline-block;
    padding: 8px 14px;
    background: white;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.pagination-link:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.pagination-current {
    display: inline-block;
    padding: 8px 14px;
    background: #667eea !important;
    color: white !important;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .list-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .list-controls {
        justify-content: space-between;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .list-controls {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    
    .per-page-selector {
        flex: 1;
    }
    
    .per-page-selector select {
        width: 100%;
    }
}