/* ============================================
   NEXUS MALL - Admin Panel CSS
   Modern Glassmorphism Theme
   ============================================ */

/* CSS Variables */
:root {
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #4F46E5;
    --primary-bg: rgba(99, 102, 241, 0.08);

    --bg: #F1F5F9;
    --bg-white: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-hover: #F8FAFC;
    --bg-elevated: #F1F5F9;

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;

    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.04);
    --shadow-glow: 0 4px 20px rgba(99, 102, 241, 0.2);

    --sidebar-width: 260px;
    --header-height: 64px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-size: 14px;
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============ Login Page ============ */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.3;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo h1 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

/* ============ Layout ============ */
.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0,0,0,0.04);
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px 0 24px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.admin-logo-switch {
    position: relative;
    min-width: 0;
    flex: 1;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px;
    cursor: pointer;
    padding-right: 2px;
}

.admin-logo-switch h2 {
    min-width: 0;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    white-space: nowrap;
    overflow: visible;
    line-height: 1.1;
}

.admin-logo-switch h2.logo-mini {
    font-size: 16px;
    letter-spacing: 1.5px;
}

.admin-logo-switch i {
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
    flex-shrink: 0;
}

.admin-logo-switch:hover > i,
.admin-logo-switch.open > i {
    color: var(--primary);
}

.admin-panel-menu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    min-width: 150px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-white);
    box-shadow: var(--shadow-lg);
    z-index: 400;
    animation: slideUp 0.18s ease;
}

.admin-logo-switch.open .admin-panel-menu {
    display: block;
}

.admin-panel-menu button {
    width: 100%;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.admin-panel-menu button i {
    width: 18px;
    color: var(--text-muted);
    font-size: 15px;
}

.admin-panel-menu button:hover,
.admin-panel-menu button.active {
    background: var(--primary-bg);
    color: var(--primary);
}

.admin-panel-menu button:hover i,
.admin-panel-menu button.active i {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-group {
    display: none;
}

.nav-group.active {
    display: block;
}

.nav-section-label {
    padding: 4px 12px 10px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-md);
    gap: 12px;
    font-size: 14px;
    margin-bottom: 4px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    font-weight: 600;
}

.nav-item i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    transition: var(--transition);
}

.nav-item:hover i {
    transform: scale(1.1);
}

/* Main Content */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: var(--header-height);
    min-height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    z-index: 20;
    position: relative;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-promo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    background: var(--bg);
    border: 1px solid var(--border);
    font-weight: 500;
}

.topbar-promo:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
    color: var(--primary);
}

.topbar-promo i {
    color: var(--primary);
    font-size: 16px;
}

.promo-modal {
    max-width: 720px;
}

.promo-body {
    padding: 24px;
}

.promo-entry-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.promo-entry-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    padding: 18px;
}

.promo-entry-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.promo-entry-head i {
    color: var(--primary);
    font-size: 20px;
}

.promo-entry-title {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.promo-entry-desc {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.promo-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 260px;
    color: var(--text-secondary);
    font-size: 13px;
}

.promo-qr-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    min-height: 234px;
}

.promo-qr-container img,
.promo-qr-container canvas {
    display: block;
    width: 200px;
    height: 200px;
}

.promo-mini-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    line-height: 1.6;
}

.promo-tip {
    font-size: 13px;
    color: var(--text-tertiary);
    text-align: center;
}

.admin-dropdown {
    position: relative;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    background: var(--bg);
    border: 1px solid var(--border);
    font-weight: 500;
}

.admin-info:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
    color: var(--primary);
}

.admin-info i {
    color: var(--primary);
    font-size: 16px;
}

.admin-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 300;
    border: 1px solid var(--border);
    animation: slideUp 0.2s ease;
}

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

.admin-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.admin-dropdown-menu a:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.admin-dropdown-menu a i {
    font-size: 15px;
    width: 18px;
    text-align: center;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: var(--bg);
}

.content-area::-webkit-scrollbar {
    width: 6px;
}

.content-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

/* Footer */
.admin-footer {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
    background: var(--bg-white);
    font-weight: 500;
}

/* ============ Cards ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.mini-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

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

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

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:nth-child(1)::before { background: linear-gradient(180deg, var(--primary), var(--primary-light)); }
.stat-card:nth-child(2)::before { background: linear-gradient(180deg, var(--success), #34D399); }
.stat-card:nth-child(3)::before { background: linear-gradient(180deg, var(--info), #60A5FA); }
.stat-card:nth-child(4)::before { background: linear-gradient(180deg, var(--warning), #FBBF24); }
.stat-card:nth-child(5)::before { background: linear-gradient(180deg, var(--danger), #F87171); }
.stat-card:nth-child(6)::before { background: linear-gradient(180deg, #8B5CF6, #A78BFA); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    transition: var(--transition);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

.stat-icon.purple { background: var(--primary-bg); color: var(--primary); }
.stat-icon.green { background: #ECFDF5; color: var(--success); }
.stat-icon.blue { background: #EFF6FF; color: var(--info); }
.stat-icon.orange { background: #FFFBEB; color: var(--warning); }
.stat-icon.red { background: #FEF2F2; color: var(--danger); }
.stat-icon.teal { background: #F0FDFA; color: #14B8A6; }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    transition: var(--transition);
}

.stat-card:hover .stat-info h3 {
    color: var(--primary);
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.mini-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.mini-status-card {
    min-height: 94px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.mini-status-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    font-size: 22px;
}

.mini-status-icon.green { background: #ECFDF5; color: var(--success); }
.mini-status-icon.orange { background: #FFFBEB; color: var(--warning); }

.mini-status-main {
    flex: 1;
    min-width: 0;
}

.mini-status-title {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.mini-status-desc {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============ Tables ============ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    table-layout: fixed;
}

.data-table thead th {
    background: #F8FAFC;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
    transition: var(--transition);
    word-break: break-all;
    overflow: hidden;
}

.data-table tbody tr {
    transition: var(--transition);
}

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

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

.data-table .thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-elevated);
    transition: var(--transition);
}

.data-table tbody tr:hover .thumb {
    transform: scale(1.05);
}

.data-table .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-elevated);
}

.admin-users-table td,
.admin-users-table th {
    word-break: keep-all;
}

.user-order-summary,
.order-user-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.user-order-meta,
.order-user-cell small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

.order-user-cell strong {
    display: block;
    max-width: 100%;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
    white-space: nowrap;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #4338CA);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

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

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    font-size: 14px;
}

.btn-block {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* ============ Forms ============ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    border-radius: 26px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ============ Modal ============ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: translateY(30px) scale(0.95);
    transition: var(--transition);
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal-lg {
    max-width: 720px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-light);
}

.mini-auth-body {
    padding-top: 22px;
}

.mini-auth-status {
    display: flex;
    gap: 14px;
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(59, 130, 246, 0.04));
}

.mini-auth-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--bg-white);
    color: var(--primary);
    font-size: 22px;
    box-shadow: var(--shadow-sm);
}

.mini-auth-copy {
    min-width: 0;
    flex: 1;
}

.mini-auth-kicker {
    margin-bottom: 3px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.mini-auth-title {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.mini-auth-buy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: var(--transition);
}

.mini-auth-buy:hover {
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.mini-auth-buy span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.mini-auth-buy .bi-bag-check {
    color: var(--primary);
}

.mini-auth-buy > .bi-box-arrow-up-right {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.mini-auth-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mini-auth-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    cursor: help;
}

.mini-auth-help:hover {
    color: var(--primary);
}

.mini-auth-help::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 9px);
    top: 50%;
    width: 230px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: var(--text-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    box-shadow: var(--shadow-md);
    transform: translate(-4px, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--transition);
    z-index: 1200;
}

.mini-auth-help::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    border: 5px solid transparent;
    border-right-color: var(--text-primary);
    transform: translate(-4px, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--transition);
    z-index: 1200;
}

.mini-auth-help:hover::after,
.mini-auth-help:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
}

/* ============ Toolbar ============ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    padding-left: 36px;
    width: 260px;
}

/* ============ Filter Tabs ============ */
.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-white);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.filter-tab {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    font-family: var(--font-family);
    font-weight: 500;
}

.filter-tab:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

.filter-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ============ Pagination ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 0;
    border-top: 1px solid var(--border-light);
    margin-top: 20px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-btns {
    display: flex;
    gap: 8px;
}

.pagination-btn {
    padding: 8px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
    font-family: var(--font-family);
    font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============ Status Badges ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #ECFDF5; color: #059669; }
.badge-warning { background: #FFFBEB; color: #D97706; }
.badge-danger { background: #FEF2F2; color: #DC2626; }
.badge-info { background: #EFF6FF; color: #2563EB; }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); }
.badge-purple { background: var(--primary-bg); color: var(--primary); }
.badge-secondary { background: var(--bg-elevated); color: var(--text-secondary); }

.user-group-badge {
    justify-content: flex-start;
    padding: 0;
    background: transparent;
    border-radius: 0;
    color: var(--primary);
}

/* ============ Progress Bar ============ */
.progress-bar-wrapper {
    margin-bottom: 16px;
}

.progress-bar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.progress-bar-header span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-bar-header span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

.progress-bar {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.purple { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.progress-bar-fill.green { background: linear-gradient(90deg, var(--success), #34D399); }
.progress-bar-fill.blue { background: linear-gradient(90deg, var(--info), #60A5FA); }
.progress-bar-fill.orange { background: linear-gradient(90deg, var(--warning), #FBBF24); }

/* ============ Template Cards ============ */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.template-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.template-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.template-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.template-color-bar {
    height: 4px;
    transition: var(--transition);
}

.template-card:hover .template-color-bar {
    height: 5px;
}

.template-card-body {
    padding: 20px;
}

.template-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.template-card-icon {
    font-size: 28px;
}

.template-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.template-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ============ Tabs ============ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 24px;
}

.tab-item {
    padding: 14px 24px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-family);
    margin-bottom: -2px;
    font-weight: 500;
}

.tab-item:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* ============ Toast Notifications ============ */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 24px;
    z-index: 12000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 14px;
    font-weight: 500;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-info { border-left: 4px solid var(--info); }

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ============ Confirm Dialog ============ */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}

.confirm-box {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: var(--transition);
}

.confirm-overlay.show .confirm-box {
    transform: scale(1);
}

.confirm-icon {
    font-size: 48px;
    color: var(--warning);
    margin-bottom: 20px;
}

.confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ============ Loading ============ */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-muted);
    gap: 12px;
    font-weight: 500;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    font-weight: 500;
}

/* ============ Expandable Row ============ */
.expand-row {
    display: none;
}

.expand-row.show {
    display: table-row;
    animation: fadeIn 0.3s ease;
}

.expand-content {
    padding: 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

.expand-content pre {
    background: var(--bg-white);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
}

.expand-toggle {
    cursor: pointer;
    color: var(--primary);
    font-size: 16px;
    transition: var(--transition);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.expand-toggle:hover {
    background: var(--primary-bg);
    transform: scale(1.1);
}

/* ============ Detail Info ============ */
.detail-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 16px;
    font-size: 13px;
}

.detail-label {
    color: var(--text-muted);
    font-weight: 500;
}

.detail-value {
    color: var(--text-primary);
    word-break: break-all;
    font-weight: 500;
}

/* ============ Animations ============ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============ Sidebar Toggle Button ============ */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 8px;
    font-size: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.sidebar-toggle-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary-light);
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-left: auto;
}

.sidebar-close-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* ============ Responsive ============ */
@media (max-width: 1200px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mini-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-close-btn {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        box-shadow: none;
    }

    .sidebar-open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.15);
    }

    .sidebar-logo {
        justify-content: space-between;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .mini-stat-grid,
    .mini-status-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left, .toolbar-right {
        flex-wrap: wrap;
    }

    .search-box input {
        width: 100%;
    }

    .content-area {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-promo span {
        display: none;
    }

    .topbar-promo {
        padding: 8px;
    }

    .admin-info span {
        display: none;
    }

    .admin-info {
        padding: 8px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 12px;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
        border-radius: var(--radius-lg);
    }

    .modal-body {
        padding: 16px;
    }

    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .filter-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .template-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }

    .card {
        padding: 16px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .stat-info h3 {
        font-size: 22px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .login-card {
        padding: 32px 24px;
    }
}

/* ============ Utility ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-10 { gap: 10px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* Card hover effect */
.card-hover {
    transition: var(--transition);
}

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

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glass effect */
.glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
