/* ===== ADMIN DASHBOARD — PROFESSIONAL STYLES ===== */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #0F172A;
    --sidebar-accent: #334155;
    --sidebar-text: rgba(148, 163, 184, 0.7);
    --sidebar-text-active: #F8FAFC;
    --topbar-height: 72px;
    --content-bg: #020617;
    --card-bg: #1E293B;
    --card-radius: 12px;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.4);
    --border: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --primary: #64748B;
    --accent: #3B82F6;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
}

/* ===== SIDEBAR ===== */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    transition: width 0.3s ease;
    border-right: 1px solid var(--border);
}

.sidebar-header {
    padding: 1.75rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.sidebar-subtitle {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--sidebar-text);
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 10px;
    position: relative;
}

.sidebar-nav-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.sidebar-nav-item:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-nav-item.active i {
    color: var(--accent);
}

.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    padding: 0.75rem 1rem 0.25rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
}

.admin-info i {
    color: var(--accent);
    flex-shrink: 0;
    font-size: 0.875rem;
}

.admin-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 8px;
    color: #FCA5A5;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.2px;
}

.sidebar-logout-btn:hover {
    background: rgba(239,68,68,0.18);
    border-color: rgba(239,68,68,0.4);
    color: #FEE2E2;
}

/* ===== MAIN CONTENT ===== */
.admin-main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--content-bg);
}

/* ===== TOPBAR ===== */
.admin-topbar {
    background: var(--card-bg);
    padding: 0 2rem;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,0.2);
}

.topbar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.3px;
}

.page-subtitle {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-icon-only {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-icon-only:hover {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-icon-only.spinning i {
    animation: spin-icon 0.8s linear infinite;
}

@keyframes spin-icon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.session-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.875rem;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 9px;
    color: #FCD34D;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.session-timer i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.session-timer.warning {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
}

/* ===== CONTENT AREA ===== */
.admin-content {
    flex: 1;
    padding: 1.75rem 2rem;
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.stat-card:nth-child(1) .stat-icon { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.stat-card:nth-child(2) .stat-icon { background: rgba(59, 130, 246, 0.15); color: #3B82F6; }
.stat-card:nth-child(3) .stat-icon { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }
.stat-card:nth-child(4) .stat-icon { background: rgba(239, 68, 68, 0.15); color: #EF4444; }

.stat-card:nth-child(1) { border-top: 3px solid #10B981; }
.stat-card:nth-child(2) { border-top: 3px solid #3B82F6; }
.stat-card:nth-child(3) { border-top: 3px solid #F59E0B; }
.stat-card:nth-child(4) { border-top: 3px solid #EF4444; }

.stat-number {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* ===== SECTION CARDS ===== */
.section-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.section-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.section-card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-card-title i {
    color: var(--accent);
    font-size: 0.875rem;
}

.section-card-body {
    padding: 1.5rem;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: 0 0 var(--card-radius) var(--card-radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: rgba(51, 65, 85, 0.3);
    border-bottom: 2px solid var(--border);
}

th {
    color: var(--text-primary);
    padding: 0.875rem 1.125rem;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.7px;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(148, 163, 184, 0.08);
}

tbody tr:last-child {
    border-bottom: none;
}

td {
    padding: 0.875rem 1.125rem;
    color: var(--text-primary);
    vertical-align: middle;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-badge.status-active {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
}
.status-badge.status-active::before { background: #10B981; }

.status-badge.status-redeemed {
    background: rgba(59, 130, 246, 0.15);
    color: #60A5FA;
}
.status-badge.status-redeemed::before { background: #3B82F6; }

.status-badge.status-expired {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
}
.status-badge.status-expired::before { background: #EF4444; }

/* ===== TABLE CODE ===== */
.table-code {
    font-family: 'SF Mono', 'Fira Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    padding: 0.3rem 0.6rem !important;
    border-radius: 5px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    white-space: nowrap;
}

/* ===== SEARCH BAR ===== */
.search-bar {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
    background: var(--card-bg);
}

.search-input {
    flex: 1;
    border: none !important;
    outline: none;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    background: transparent;
    color: var(--text-primary);
    min-width: 0;
}

.search-input::placeholder { color: var(--text-tertiary); }

.search-bar .btn {
    border-radius: 0;
    border: none;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
}

/* ===== REDEEM CARDS ===== */
.redeem-method-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2.5rem 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--card-radius);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    width: 100%;
}

.redeem-method-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.redeem-method-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--accent);
    transition: all 0.25s ease;
}

.redeem-method-card:hover .redeem-method-icon {
    background: var(--accent);
    color: white;
}

.redeem-method-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.redeem-method-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== VOUCHER DETAIL GRID ===== */
.voucher-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    background: rgba(51, 65, 85, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.125rem;
}

.detail-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-tertiary);
    margin: 0 0 0.375rem 0;
}

.detail-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    word-break: break-word;
}

.detail-value.highlight {
    color: var(--accent);
    font-family: 'SF Mono', 'Fira Mono', monospace;
    font-size: 0.875rem;
}

/* ===== CONFIRM MODAL ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.modal.show { display: flex !important; }

.modal-content {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 2.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.25s ease;
    border: 1px solid var(--border);
}

@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(245, 158, 11, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.625rem;
    color: #F59E0B;
    margin: 0 auto 1.5rem;
}

/* ===== ANALYTICS QUICK STATS ===== */
.quick-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.quick-stat-row:last-child { border-bottom: none; }

.quick-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.quick-stat-value {
    font-size: 0.925rem;
    font-weight: 700;
    color: var(--accent);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--card-bg);
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    animation: slideInRight 0.3s cubic-bezier(0.34,1.56,0.64,1);
    min-width: 280px;
    max-width: 420px;
}

.toast .toast-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: 12px 0 0 12px;
}

.toast.success .toast-bar { background: #10B981; }
.toast.error .toast-bar { background: #EF4444; }

.toast i {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.toast.success i { color: #10B981; }
.toast.error i { color: #EF4444; }

.toast span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== LOGIN ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a0f0a 0%, #3d1f13 40%, #704538 100%);
    padding: 2rem;
}

.login-card {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}

.login-card .logo-container img {
    width: 80px;
    margin: 0 auto;
    display: block;
}

/* ===== SKELETON LOADER ===== */
.skeleton {
    background: linear-gradient(90deg, #F3F4F6 25%, #E9EAEC 50%, #F3F4F6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

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

.skeleton-text { height: 1rem; }
.skeleton-card { height: 100px; border-radius: var(--card-radius); }

/* ===== LOADING STATES ===== */
.table-loading {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.375rem;
    margin-top: 1.25rem;
}

.pagination button {
    padding: 0.4rem 0.875rem;
    border: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pagination button:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.15);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

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

.pagination button.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

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

@media (max-width: 1024px) {
    :root { --sidebar-width: 220px; }
}

@media (max-width: 768px) {
    :root { --sidebar-width: 68px; }

    .sidebar-brand,
    .sidebar-nav-item span,
    .sidebar-logout-btn span,
    .nav-section-label,
    .admin-info span,
    .sidebar-subtitle { display: none; }

    .sidebar-header { justify-content: center; padding: 1.25rem 0.75rem; }
    .sidebar-nav-item { justify-content: center; padding: 0.875rem; }
    .sidebar-nav-item i { width: auto; font-size: 1.125rem; }
    .sidebar-logout-btn { padding: 0.7rem; justify-content: center; }
    .admin-info { justify-content: center; }

    .admin-topbar {
        padding: 0 1rem;
        gap: 0.75rem;
    }

    .admin-content { padding: 1rem; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== PRINT ===== */
@media print {
    .admin-sidebar, .admin-topbar, .btn, .pagination, .toast { display: none !important; }
    .admin-main-content { margin-left: 0; }
}
