/* ============================================================
   Xaura Indexer - Premium Dark SaaS Dashboard
   ============================================================ */

:root {
    --bg-primary:    #0B0F19;
    --bg-secondary:  #121826;
    --bg-card:       #1A2235;
    --bg-card-hover: #1F2940;
    --accent:        #4F46E5;
    --accent-hover:  #4338CA;
    --accent-light:  rgba(79, 70, 229, 0.15);
    --success:       #22C55E;
    --success-light: rgba(34, 197, 94, 0.15);
    --warning:       #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger:        #EF4444;
    --danger-light:  rgba(239, 68, 68, 0.15);
    --info:          #3B82F6;
    --info-light:    rgba(59, 130, 246, 0.15);
    --text-primary:  #FFFFFF;
    --text-secondary:#94A3B8;
    --text-muted:    #64748B;
    --border:        rgba(255, 255, 255, 0.06);
    --border-focus:  rgba(79, 70, 229, 0.5);
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg:     0 8px 40px rgba(0, 0, 0, 0.5);
    --transition:    all 0.2s ease;
    --sidebar-width: 260px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }
::selection { background: var(--accent-light); color: var(--accent); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ============================================================
   Layout
   ============================================================ */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-hidden .sidebar { transform: translateX(-100%); }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

@media (max-width: 992px) {
    .main-content { margin-left: 0; }
    .sidebar { transform: translateX(-100%); }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-overlay { display: block; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-text { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.sidebar-brand-sub  { font-size: 11px; color: var(--text-muted); }

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

.sidebar-section { margin-bottom: 8px; }

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 10px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.sidebar-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-user:hover { background: var(--bg-card); }

.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--accent);
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
    height: 65px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.topbar-toggle:hover { background: var(--bg-card); color: var(--text-primary); }

@media (max-width: 992px) { .topbar-toggle { display: flex; align-items: center; } }

.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
    width: 38px; height: 38px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    position: relative;
}

.topbar-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-focus); }

.notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-secondary);
}

.topbar-credits {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--accent-light);
    border: 1px solid rgba(79,70,229,0.25);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

/* ============================================================
   Page Content
   ============================================================ */
.page-content { flex: 1; padding: 28px 24px; }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.card-subtitle { font-size: 13px; color: var(--text-secondary); }

.card-body { padding: 22px; }

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.1);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: rgba(79,70,229,0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 12px 0 80px;
    opacity: 0.06;
}

.stat-card.accent::after  { background: var(--accent); }
.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.danger::after  { background: var(--danger); }
.stat-card.info::after    { background: var(--info); }

.stat-icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}

.stat-icon.accent  { background: var(--accent-light);  color: var(--accent); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger  { background: var(--danger-light);  color: var(--danger); }
.stat-icon.info    { background: var(--info-light);    color: var(--info); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

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

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 20px;
}

.stat-change.up   { background: var(--success-light); color: var(--success); }
.stat-change.down { background: var(--danger-light);  color: var(--danger); }

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
}

.data-table td {
    padding: 13px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.data-table .url-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-accent    { background: var(--accent-light);  color: var(--accent); }
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-secondary { background: rgba(148,163,184,0.1); color: var(--text-secondary); }

.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

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

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

.form-control, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.form-control:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

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

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
    cursor: pointer;
}

.form-select option { background: var(--bg-card); }

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group-append .btn  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.file-upload-area:hover, .file-upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

.file-upload-icon { margin-bottom: 12px; opacity: 0.5; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 9px; }
.btn-block { width: 100%; justify-content: center; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #16a34a; border-color: #16a34a; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-warning { background: var(--warning); color: #000; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; color: #000; }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-card); color: var(--text-primary); border-color: rgba(255,255,255,0.1); }

.btn-ghost { background: transparent; border: none; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-card); }

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

.btn-loading .btn-text { display: none; }
.btn-loading .btn-spinner { display: flex; }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ============================================================
   Progress Bars
   ============================================================ */
.progress {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.5s ease;
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ============================================================
   Toast Notifications
   ============================================================ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

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

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-error   .toast-icon { color: var(--danger); }
.toast.toast-warning .toast-icon { color: var(--warning); }
.toast.toast-info    .toast-icon { color: var(--info); }

.toast-content { flex: 1; }
.toast-title   { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.toast-message { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.toast-close {
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 0; flex-shrink: 0;
    transition: var(--transition);
}
.toast-close:hover { color: var(--text-primary); }

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

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

.toast.removing { animation: slideOut 0.3s ease forwards; }

/* ============================================================
   Skeleton Loaders
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 70%; }
.skeleton-title { height: 20px; margin-bottom: 12px; width: 60%; }
.skeleton-stat  { height: 60px; }
.skeleton-row   { height: 48px; margin-bottom: 4px; }

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

/* ============================================================
   Charts
   ============================================================ */
.chart-container { position: relative; }
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}
.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.chart-legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.page-link:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-link.disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.2s ease;
}

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

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 4px; border-radius: var(--radius-sm);
    transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.modal-body   { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

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

/* ============================================================
   Dropdown
   ============================================================ */
.dropdown { position: relative; }

.dropdown-menu {
    position: absolute;
    right: 0; top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 500;
    overflow: hidden;
    animation: scaleIn 0.15s ease;
    display: none;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-light); }

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-header  { padding: 10px 16px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

/* ============================================================
   Alert
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid rgba(59,130,246,0.2); }

/* ============================================================
   Auth Pages
   ============================================================ */
.auth-wrapper {
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79,70,229,0.12) 0%, transparent 70%);
    top: -200px; left: -100px;
    pointer-events: none;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34,197,94,0.06) 0%, transparent 70%);
    bottom: -100px; right: -100px;
    pointer-events: none;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand-logo {
    width: 52px; height: 52px;
    background: var(--accent);
    border-radius: 14px;
    display: inline-flex;
    align-items: center; justify-content: center;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(79,70,229,0.35);
}

.auth-brand-name { font-size: 22px; font-weight: 700; }
.auth-brand-tagline { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================================
   Tabs
   ============================================================ */
.tab-nav {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   Plan Cards
   ============================================================ */
.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.plan-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.plan-card.selected { border-color: var(--accent); background: var(--accent-light); }
.plan-card.popular::before {
    content: 'Most Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

.plan-name   { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.plan-price  { font-size: 36px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.plan-period { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.plan-credits {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}
.plan-credits-label { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }

.plan-features { list-style: none; text-align: left; margin-bottom: 24px; }
.plan-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 5px 0;
}
.plan-features li svg { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }

/* ============================================================
   Timeline
   ============================================================ */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 0; bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item { position: relative; margin-bottom: 24px; }

.timeline-dot {
    position: absolute;
    left: -24px; top: 4px;
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.timeline-dot.success { background: var(--success); box-shadow: 0 0 0 3px var(--success-light); }
.timeline-dot.warning { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-light); }
.timeline-dot.danger  { background: var(--danger);  box-shadow: 0 0 0 3px var(--danger-light); }

.timeline-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.timeline-meta  { font-size: 12px; color: var(--text-muted); }
.timeline-desc  { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

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

.empty-state-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.empty-state-title   { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-message { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }

/* ============================================================
   API Key Display
   ============================================================ */
.api-key-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

.api-key-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.copy-btn {
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 4px; border-radius: 4px;
    transition: var(--transition); flex-shrink: 0;
}
.copy-btn:hover { color: var(--accent); }
.copy-btn.copied { color: var(--success); }

/* ============================================================
   Code Block
   ============================================================ */
.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    overflow-x: auto;
    position: relative;
}

.code-block .copy-btn {
    position: absolute;
    top: 10px; right: 10px;
}

/* ============================================================
   Utilities
   ============================================================ */
.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-accent    { color: var(--accent) !important; }
.text-success   { color: var(--success) !important; }
.text-warning   { color: var(--warning) !important; }
.text-danger    { color: var(--danger) !important; }

.bg-card     { background: var(--bg-card) !important; }
.bg-primary  { background: var(--bg-primary) !important; }

.border-bottom { border-bottom: 1px solid var(--border) !important; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end  { justify-content: flex-end; }
.flex-1 { flex: 1; }

.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.mt-auto { margin-top: auto; }

.p-0   { padding: 0; }
.p-12  { padding: 12px; }
.p-16  { padding: 16px; }
.p-20  { padding: 20px; }

.rounded { border-radius: var(--radius-sm); }
.rounded-full { border-radius: 50%; }

.w-100 { width: 100%; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.cursor-pointer { cursor: pointer; }
.user-select-none { user-select: none; }

.overflow-hidden { overflow: hidden; }
.text-nowrap     { white-space: nowrap; }
.text-truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .page-header  { flex-direction: column; align-items: flex-start; }
    .auth-card    { padding: 28px 20px; }
    .stat-value   { font-size: 22px; }
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glassmorphism */
.glass {
    background: rgba(26, 34, 53, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
}

/* Animated counting */
.count-up { transition: opacity 0.3s ease; }

/* Spinner */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Admin sidebar indicator */
.admin-badge { background: var(--warning); color: #000; }

/* Notification dot */
.notif-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

/* Credit indicator strip */
.credit-strip {
    background: linear-gradient(90deg, var(--accent-light) 0%, transparent 100%);
    border: 1px solid rgba(79,70,229,0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Search box */
.search-box {
    position: relative;
}
.search-box .search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px; height: 16px;
}
.search-box .form-control {
    padding-left: 38px;
}

/* Quick actions */
.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-secondary);
}
.quick-action:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--accent-light);
}
.quick-action-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
    flex-shrink: 0;
}
