/* =============================================
   ADMIN DASHBOARD - PREMIUM DARK THEME
   ============================================= */

/* ---- CSS Variables / Design Tokens ---- */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --bg-input: rgba(15, 23, 42, 0.8);
    --bg-sidebar: rgba(8, 12, 25, 0.95);
    --bg-overlay: rgba(0, 0, 0, 0.6);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-cyan: #22d3ee;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    --border-color: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.3);

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    --gradient-emerald: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-amber: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --gradient-rose: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
    --gradient-bg: linear-gradient(135deg, #0a0e1a 0%, #1a1040 50%, #0a0e1a 100%);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --sidebar-width: 260px;
    --header-height: 70px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gradient-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--accent-primary);
}

/* ---- Background Particles ---- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(34, 211, 238, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Layout ---- */
.admin-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    transition: transform var(--transition-normal);
}

.sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.sidebar-brand h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-brand small {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--gradient-primary);
    border-radius: 0 3px 3px 0;
}

.nav-item .icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--gradient-rose);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.sidebar-user .user-info {
    flex: 1;
}

.sidebar-user .user-info .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-user .user-info .role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

/* ---- Header ---- */
.header {
    height: var(--header-height);
    background: rgba(10, 14, 26, 0.8);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.1rem;
    position: relative;
}

.header-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.header-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-rose);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ---- Page Content ---- */
.page-content {
    padding: 2rem;
}

/* ---- Stats Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.05;
    transform: translate(30%, -30%);
}

.stat-card.purple::after { background: var(--accent-primary); }
.stat-card.cyan::after { background: var(--accent-cyan); }
.stat-card.emerald::after { background: var(--accent-emerald); }
.stat-card.rose::after { background: var(--accent-rose); }
.stat-card.amber::after { background: var(--accent-amber); }

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.stat-card.purple .stat-icon { background: rgba(99, 102, 241, 0.15); color: var(--accent-primary); }
.stat-card.cyan .stat-icon { background: rgba(34, 211, 238, 0.15); color: var(--accent-cyan); }
.stat-card.emerald .stat-icon { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.stat-card.rose .stat-icon { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.stat-card.amber .stat-icon { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ---- Tables ---- */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 0.85rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.05);
    color: var(--text-secondary);
}

table tbody tr {
    transition: background var(--transition-fast);
}

table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
}

.badge-blocked {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
}

.badge-paused {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.badge-expired {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.badge-inactive {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.badge-owner {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

.badge-admin {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-secondary);
}

.badge-seller {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
}

.badge-test {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-danger {
    background: var(--gradient-rose);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}

.btn-success {
    background: var(--gradient-emerald);
    color: white;
}

.btn-warning {
    background: var(--gradient-amber);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
}

.btn-icon:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
}

.btn-icon.danger:hover {
    border-color: var(--accent-rose);
    color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.08);
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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 8.825L.375 3.2 1.2 2.375 6 7.175l4.8-4.8.825.825z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ---- Modals ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 1.1rem;
}

.modal-close:hover {
    background: rgba(244, 63, 94, 0.2);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ---- Notifications / Toasts ---- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    width: calc(100% - 2rem);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    min-width: 280px;
    display: flex;
    align-items: flex-start;
    gap: 0;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0,0,0,0.3);
    transform: translateX(110%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(110%); opacity: 0; }

.toast.toast-success { border-left: 3px solid var(--accent-emerald); }
.toast.toast-error { border-left: 3px solid var(--accent-rose); }
.toast.toast-warning { border-left: 3px solid var(--accent-amber); }
.toast.toast-info { border-left: 3px solid var(--accent-cyan); }

.toast-left { display: flex; align-items: flex-start; gap: 0.65rem; flex: 1; min-width: 0; }

.toast .toast-icon {
    flex-shrink: 0;
    margin-top: 1px;
}
.toast-success .toast-icon { color: var(--accent-emerald); }
.toast-error .toast-icon { color: var(--accent-rose); }
.toast-warning .toast-icon { color: var(--accent-amber); }
.toast-info .toast-icon { color: var(--accent-cyan); }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.toast-success .toast-title { color: var(--accent-emerald); }
.toast-error .toast-title { color: var(--accent-rose); }
.toast-warning .toast-title { color: var(--accent-amber); }
.toast-info .toast-title { color: var(--accent-cyan); }
.toast .toast-message { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; }

.toast .toast-close {
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast);
    background: none;
    border: none;
    padding: 2px;
    margin-left: 0.5rem;
    flex-shrink: 0;
}
.toast .toast-close:hover { color: var(--text-primary); }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255,255,255,0.05);
}
.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toastShrink linear forwards;
}
.toast-success .toast-progress-bar { background: var(--accent-emerald); }
.toast-error .toast-progress-bar { background: var(--accent-rose); }
.toast-warning .toast-progress-bar { background: var(--accent-amber); }
.toast-info .toast-progress-bar { background: var(--accent-cyan); }

@keyframes toastShrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---- Admin Notification Banner (full-screen overlay) ---- */
.admin-notif-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.admin-notif-overlay.active { display: flex; }

.admin-notif {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    max-width: 420px;
    width: 100%;
    position: relative;
    overflow: hidden;
    animation: dialogScaleIn 0.25s ease;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(99, 102, 241, 0.1);
}

.admin-notif-glow {
    position: absolute;
    top: -1px; left: 15%; right: 15%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), var(--accent-cyan), transparent);
    border-radius: 2px;
}

.admin-notif-icon { margin-bottom: 1rem; }
.admin-notif h2 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
}
.admin-notif .key-display {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-cyan);
    background: var(--bg-primary);
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(34, 211, 238, 0.2);
    word-break: break-all;
    letter-spacing: 0.08em;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

.admin-notif-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.admin-notif-actions .btn { flex: 1; min-height: 44px; }

@media (max-width: 480px) {
    .admin-notif { padding: 2rem 1.5rem 1.5rem; }
    .admin-notif-actions { flex-direction: column; }
}

/* ---- Security Alert Popup ---- */
.security-alert-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.security-alert-popup.active {
    display: flex;
}

.security-alert-card {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-rose);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    animation: scaleIn 0.3s ease;
    box-shadow: 0 0 40px rgba(244, 63, 94, 0.2);
}

.security-alert-card .alert-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(244, 63, 94, 0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.security-alert-card .alert-header .alert-icon {
    width: 48px;
    height: 48px;
    background: rgba(244, 63, 94, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: pulse-dot 2s infinite;
}

.security-alert-card .alert-header h3 {
    color: var(--accent-rose);
    font-size: 1.1rem;
}

.security-alert-card .alert-body {
    padding: 1.5rem;
}

.security-alert-card .alert-info {
    display: grid;
    gap: 0.75rem;
}

.security-alert-card .alert-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(99, 102, 241, 0.05);
}

.security-alert-card .alert-info-row .label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.security-alert-card .alert-info-row .value {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
}

.security-alert-card .alert-actions {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.security-alert-card .alert-actions .btn {
    flex: 1;
    justify-content: center;
    min-width: 100px;
}

/* Block Type Selection (inside security alert) */
.block-options {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(244, 63, 94, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid rgba(244, 63, 94, 0.15);
}

.block-options.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.block-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.block-options label:hover {
    background: rgba(244, 63, 94, 0.08);
}

.block-options input[type="radio"] {
    accent-color: var(--accent-rose);
}

/* ---- Toolbar ---- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.toolbar .search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.toolbar .search-box input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
}

.toolbar .search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.toolbar .search-box .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.toolbar select {
    padding: 0.65rem 2rem 0.65rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    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 8.825L.375 3.2 1.2 2.375 6 7.175l4.8-4.8.825.825z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.toolbar select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ---- Notification Popup ---- */
.notification-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    z-index: 2500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.notification-popup-overlay.active {
    display: flex;
}

.notification-popup {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    animation: scaleIn 0.4s ease;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.2);
    overflow: hidden;
}

.notification-popup .popup-header {
    padding: 1.5rem;
    background: rgba(99, 102, 241, 0.05);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-popup .popup-header .popup-icon {
    font-size: 1.5rem;
}

.notification-popup .popup-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.notification-popup .popup-body {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.8;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.notification-popup .popup-body h1,
.notification-popup .popup-body h2,
.notification-popup .popup-body h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.notification-popup .popup-body ul,
.notification-popup .popup-body ol {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.notification-popup .popup-body a {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.notification-popup .popup-body strong {
    color: var(--text-primary);
}

.notification-popup .popup-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notification-popup .popup-footer .btn {
    min-width: 160px;
    justify-content: center;
}

/* ---- Key Details ---- */
.key-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.key-detail-item {
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.05);
}

.key-detail-item .detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
}

.key-detail-item .detail-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
    word-break: break-all;
}

/* ---- Markdown Preview ---- */
.markdown-preview {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    min-height: 100px;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.markdown-preview ul, .markdown-preview ol {
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.markdown-preview strong {
    color: var(--text-primary);
}

.markdown-preview a {
    color: var(--accent-cyan);
}

.markdown-preview code {
    background: rgba(99, 102, 241, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination button:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination button.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Responsive ---- */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .page-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .key-detail-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
    }

    .toolbar .search-box {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Mobile Card Table ---- */
@media (max-width: 768px) {
    .table-container {
        overflow-x: visible;
    }

    table, table thead, table tbody, table th, table td, table tr {
        display: block;
    }

    table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    table tbody tr {
        background: rgba(15, 23, 42, 0.4);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        display: block;
    }

    table tbody tr:hover {
        background: rgba(99, 102, 241, 0.06);
    }

    table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem 0.25rem;
        border-bottom: 1px solid rgba(99, 102, 241, 0.05);
        font-size: 0.85rem;
        text-align: right;
        min-height: 36px;
        gap: 0.75rem;
    }

    table td:last-child {
        border-bottom: none;
        padding-bottom: 0.25rem;
    }

    table td:first-child {
        padding-top: 0.25rem;
    }

    table td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
        flex-shrink: 0;
        min-width: 80px;
    }

    /* Hide actions label - just show buttons */
    table td[data-label="Hành động"]::before,
    table td[data-label="Actions"]::before {
        display: none;
    }

    table td[data-label="Hành động"],
    table td[data-label="Actions"] {
        justify-content: flex-end;
        padding-top: 0.5rem;
    }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.3);
}

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-emerald); }
.text-danger { color: var(--accent-rose); }
.text-warning { color: var(--accent-amber); }
.text-cyan { color: var(--accent-cyan); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* ---- Copy Button ---- */
.copy-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
}

.copy-btn:hover {
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.1);
}

/* ---- Log Item ---- */
.log-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(99, 102, 241, 0.05);
}

.log-item:last-child {
    border-bottom: none;
}

.log-item .log-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.log-item .log-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
}

.log-item .log-icon.failed {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
}

.log-item .log-content {
    flex: 1;
}

.log-item .log-action {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.log-item .log-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    gap: 0;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* ---- SVG Icon Alignment ---- */
.nav-item .icon,
.card-header h3,
.header-left h1,
.btn,
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item .icon svg,
.card-header h3 svg,
.header-left h1 svg,
.btn svg,
.btn-icon svg,
.copy-btn svg {
    flex-shrink: 0;
    vertical-align: middle;
}

.sidebar-brand .brand-icon svg {
    color: white;
}

/* ---- Enhanced Mobile Support ---- */
@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
        height: 56px;
    }

    .header-left h1 {
        font-size: 1rem;
    }

    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        top: 0.5rem;
    }

    .toast {
        min-width: 0;
        max-width: 100%;
    }

    .notification-popup {
        max-width: calc(100% - 2rem);
    }

    .modal {
        max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem);
    }

    .security-alert-card {
        max-width: calc(100% - 2rem);
    }

    table td, table th {
        padding: 0.65rem 0.5rem;
        font-size: 0.8rem;
    }

    .btn-icon {
        min-width: 36px;
        min-height: 36px;
    }

    .toolbar select {
        width: 100%;
        min-height: 44px;
    }

    .toolbar .search-box input {
        min-height: 44px;
        font-size: 16px;
    }

    .form-control {
        min-height: 44px;
        font-size: 16px;
    }
}

/* iOS Safe Area */
@supports(padding: max(0px)) {
    .sidebar {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .page-content {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }

    .modal-overlay,
    .notification-popup-overlay,
    .security-alert-popup {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Prevent iOS zoom on input focus */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Touch-friendly action buttons */
@media (hover: none) and (pointer: coarse) {
    .btn-icon {
        min-width: 40px;
        min-height: 40px;
    }

    .nav-item {
        padding: 0.85rem 0.75rem;
    }

    .copy-btn {
        padding: 0.4rem 0.6rem;
    }
}

/* ---- Custom Dialog (replaces browser confirm/alert) ---- */
.custom-dialog-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none; align-items: center; justify-content: center;
    padding: 1rem;
}
.custom-dialog-overlay.active { display: flex; }
.custom-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: dialogScaleIn 0.2s ease;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}
@keyframes dialogScaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.custom-dialog-icon { margin-bottom: 1rem; }
.custom-dialog h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.5rem; }
.custom-dialog p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 1.25rem; }
.custom-dialog-actions { display: flex; gap: 0.75rem; }
.custom-dialog-actions .btn { flex: 1; min-height: 42px; }
.custom-dialog .key-display {
    font-family: 'Courier New', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-cyan);
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    word-break: break-all;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}
@media (max-width: 480px) {
    .custom-dialog { padding: 1.5rem; }
    .custom-dialog-actions { flex-direction: column; }
}

/* ---- Markdown Sticker & Image ---- */
.md-sticker {
    display: inline-block;
    width: 24px; height: 24px;
    vertical-align: middle;
    margin: 0 2px;
    border-radius: 4px;
}
.md-image {
    display: block;
    max-width: 100%;
    border-radius: 10px;
    margin: .5rem 0;
}
.markdown-preview blockquote {
    border-left: 3px solid var(--accent-primary);
    padding: .5rem 1rem;
    margin: .5rem 0;
    background: rgba(99,102,241,.05);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}
.markdown-preview pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: .75rem 1rem;
    overflow-x: auto;
    font-size: .82rem;
}
.markdown-preview code {
    background: rgba(99,102,241,.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .82rem;
    color: var(--accent-cyan);
}
.markdown-preview pre code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
}
.markdown-preview hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}
.markdown-preview del {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* ---- Bulk Key Creation Results ---- */
.bulk-result-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.bulk-result-badge {
    background: var(--gradient-primary);
    color: white;
    font-size: .75rem;
    font-weight: 700;
    padding: .35rem .85rem;
    border-radius: 20px;
    letter-spacing: .03em;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.bulk-key-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.bulk-key-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.bulk-key-row:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.04);
}

.bulk-key-index {
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 28px;
    text-align: center;
    background: rgba(99, 102, 241, 0.1);
    padding: .15rem .4rem;
    border-radius: 6px;
    flex-shrink: 0;
}

.bulk-key-value {
    flex: 1;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: .78rem;
    color: var(--accent-cyan);
    word-break: break-all;
    letter-spacing: .02em;
}

.bulk-key-row .copy-btn {
    flex-shrink: 0;
}
