/* ============================================
   Admin CSS - eTicket
   ============================================ */

/* ============================================
   THEME VARIABLES (Light / Dark)
   ============================================ */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --card-bg: rgba(255, 255, 255, 0.8);
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
}

.dark {
    --bg-primary: #020617;
    --bg-secondary: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #1e293b;
    --card-bg: rgba(15, 23, 42, 0.8);
}

/* Base Styles */
body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* ============================================
   reCAPTCHA — Ẩn badge, hiện text notice
   ============================================ */
.grecaptcha-badge { visibility: hidden !important; }

.recaptcha-notice {
    font-size: 0.7rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 0.5rem;
}
.recaptcha-notice a {
    color: #6b7280;
    text-decoration: underline;
}
.dark .recaptcha-notice { color: #6b7280; }
.dark .recaptcha-notice a { color: #9ca3af; }

/* ============================================
   SKELETON LOADER — Inline loading (non-blocking)
   ============================================ */
.skeleton-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.skeleton-line {
    height: 1rem;
    border-radius: 0.25rem;
    background: linear-gradient(90deg, var(--border-color) 25%, transparent 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(43, 85, 133, 0.2);
    border-radius: 20px;
}

.scrolling-touch {
    -webkit-overflow-scrolling: touch;
}

/* Sidebar mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998 !important;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   SHARED FORM COMPONENTS (dùng chung cho mọi view)
   ============================================ */
.lbl {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 0.375rem;
}
.dark .lbl { color: #94a3b8; }

.inp {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #1e293b;
    transition: all 0.15s;
}
.inp:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.dark .inp {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
.dark .inp:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
select.inp { appearance: auto; }
textarea.inp { resize: vertical; }

.btn-primary {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: #2563eb;
    border-radius: 0.5rem;
    transition: all 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-primary-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    background: #2563eb;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-primary-sm:hover { background: #1d4ed8; }

.btn-secondary {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    transition: all 0.15s;
}
.btn-secondary:hover { background: #f8fafc; }
.dark .btn-secondary {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

.btn-secondary-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-secondary-sm:hover { background: #f8fafc; }
.dark .btn-secondary-sm {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

/* Tab active state (Settings, etc.) */
.tab-active {
    border-color: #2563eb !important;
    color: #2563eb !important;
    font-weight: 600;
}
.dark .tab-active {
    color: #60a5fa !important;
    border-color: #60a5fa !important;
}

/* ============================================
   SIDEBAR — Desktop Collapsible + Mobile Slide
   ============================================ */

/* Desktop: smooth width transition */
@media (min-width: 1024px) {
    .admin-sidebar {
        transition: width 0.2s ease;
    }

    /* Collapsed state: icon-only */
    .admin-sidebar.collapsed {
        width: 4rem !important; /* 64px */
        min-width: 4rem;
    }

    .admin-sidebar.collapsed .sidebar-label,
    .admin-sidebar.collapsed .sidebar-section-title,
    .admin-sidebar.collapsed .sidebar-logout-label {
        display: none;
    }

    .admin-sidebar.collapsed .sidebar-badge {
        position: absolute;
        top: 4px;
        right: 4px;
        font-size: 0;
        width: 8px;
        height: 8px;
        padding: 0;
        min-width: unset;
    }

    .admin-sidebar.collapsed nav a {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
        position: relative;
    }

    .admin-sidebar.collapsed nav a .material-symbols-outlined {
        margin: 0;
    }

    .admin-sidebar.collapsed .sidebar-bottom {
        justify-content: center;
    }

    .admin-sidebar.collapsed .sidebar-bottom a {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    /* Tooltip on hover when collapsed */
    .admin-sidebar.collapsed nav a::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: #1e293b;
        color: #f1f5f9;
        font-size: 0.75rem;
        padding: 0.25rem 0.625rem;
        border-radius: 0.375rem;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s;
        z-index: 100;
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    }

    .admin-sidebar.collapsed nav a:hover::after {
        opacity: 1;
    }
}

/* Mobile sidebar */
@media (max-width: 1023px) {
    .admin-sidebar {
        display: none;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        position: fixed;
        top: 56px;
        left: 0;
        height: calc(100vh - 56px);
        height: calc(100dvh - 56px);
        z-index: 9999 !important;
        flex-direction: column;
    }

    .admin-sidebar.active {
        display: flex;
        transform: translateX(0);
        pointer-events: auto;
    }

    .admin-sidebar.active * {
        pointer-events: auto;
    }

    .admin-sidebar.active a {
        position: relative;
        z-index: 51;
        cursor: pointer;
    }
}
