/* ========================================
   SwiftPlan — Admin Panel Styles
   Font: Sora | Dark Theme
   ======================================== */

:root {
    --bg-primary: #0a0b0f;
    --bg-secondary: #12131a;
    --bg-tertiary: #1a1b25;
    --bg-card: #16171f;
    --bg-hover: #1e1f2a;
    --bg-input: #0e0f15;
    
    --border-primary: #1e2030;
    --border-secondary: #2a2b3d;
    --border-accent: #6366f1;
    
    --text-primary: #e8e9f0;
    --text-secondary: #8b8d9f;
    --text-muted: #5a5c6f;
    --text-accent: #a5b4fc;
    
    --accent-primary: #6366f1;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #6366f1, #06b6d4);
    --accent-glow: rgba(99, 102, 241, 0.15);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.2);
    
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Sora', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden {
    display: none !important;
}

/* ========= Scrollbar ========= */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 3px;
}

/* ========= Header ========= */
.admin-header {
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-link {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

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

.back-link svg, .back-link i {
    width: 16px;
    height: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-badge {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.12);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 1px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-icon svg, .btn-icon i {
    width: 18px;
    height: 18px;
}

/* ========= Main ========= */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
    animation: fadeIn 0.4s ease;
}

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

/* ========= Stats Cards ========= */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--border-secondary);
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.stat-card-icon svg, .stat-card-icon i {
    width: 20px;
    height: 20px;
}

.stat-card-icon.total {
    background: var(--accent-glow);
    color: var(--accent-primary);
}

.stat-card-icon.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-card-icon.approved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-card-icon.rejected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-card-info {
    display: flex;
    flex-direction: column;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ========= Filter Bar ========= */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 4px;
}

.filter-tab {
    padding: 7px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: 'Sora', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.filter-tab.active {
    background: var(--accent-glow);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    font-weight: 600;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 0 12px;
    transition: border-color var(--transition-fast);
    width: 280px;
}

.search-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-wrapper input {
    flex: 1;
    padding: 9px 10px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: 'Sora', sans-serif;
    font-size: 0.82rem;
}

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

/* ========= Users Table ========= */
.users-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: var(--bg-secondary);
}

.users-table th {
    padding: 12px 16px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.users-table td {
    padding: 14px 16px;
    font-size: 0.82rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-primary);
    vertical-align: middle;
}

.users-table tbody tr {
    transition: background var(--transition-fast);
}

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

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

/* User cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.user-cell-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-cell-name {
    font-weight: 600;
    font-size: 0.82rem;
}

/* Email */
.email-cell {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.approved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.rejected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.role-badge.admin {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.role-badge.user {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

/* Date cell */
.date-cell {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: 'Sora', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn svg, .action-btn i {
    width: 13px;
    height: 13px;
}

.action-btn.approve {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.action-btn.approve:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

.action-btn.reject {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.action-btn.reject:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.action-btn.revoke {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.action-btn.revoke:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--warning);
}

/* Loading & Empty */
.table-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-secondary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state i, .empty-state svg {
    width: 36px;
    height: 36px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ========= Toast ========= */
.toast {
    position: fixed;
    top: 76px;
    right: 20px;
    z-index: 10000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    max-width: 340px;
    font-size: 0.8rem;
    font-weight: 500;
}

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

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

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

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

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

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

    .search-wrapper {
        width: 100%;
    }

    .users-table-wrap {
        overflow-x: auto;
    }

    .users-table {
        min-width: 700px;
    }
}

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

    .admin-main {
        padding: 16px 12px;
    }
}
