@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-hover: #1e1e2a;
    --accent: #ff007b;
    --accent-hover: #e0006c;
    --accent-glow: rgba(255, 0, 123, 0.3);
    --text-primary: #f0f0ff;
    --text-secondary: #8b8ba7;
    --text-muted: #555570;
    --border: #2a2a3a;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── SIDEBAR ── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 72px;
}

.sidebar-logo img {
    flex: 1;
    min-width: 0;
    height: auto;
    display: block;
    padding: 0 20px;
    transition: opacity 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section { margin-bottom: 24px; }

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0 12px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease, height 0.3s ease;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(255, 0, 123, 0.12); color: var(--accent); }
.nav-item.active::before { transform: scaleY(1); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-hover);
    margin-bottom: 8px;
    overflow: hidden;
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff007b, #ff6bb5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.user-details h4 { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-details span { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--danger);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
}

.logout-btn:hover { background: rgba(239, 68, 68, 0.1); }

/* ── COLLAPSE BUTTON ── */
.collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.collapse-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── SIDEBAR COLLAPSED (desktop) ── */
.sidebar.desktop-collapsed { width: 64px; }

.sidebar.desktop-collapsed .sidebar-logo {
    justify-content: center;
    padding: 20px 8px;
}

.sidebar.desktop-collapsed .sidebar-logo img { display: none; }

.sidebar.desktop-collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    margin: 0;
}

.sidebar.desktop-collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.sidebar.desktop-collapsed .nav-item span { display: none; }

.sidebar.desktop-collapsed .user-info { justify-content: center; padding: 10px; }
.sidebar.desktop-collapsed .user-details { display: none; }

.sidebar.desktop-collapsed .logout-btn {
    justify-content: center;
    padding: 10px;
}

.sidebar.desktop-collapsed .logout-btn span { display: none; }

/* ── SIDEBAR OVERLAY ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* ── MAIN CONTENT ── */
.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.main.desktop-expanded { margin-left: 64px; }

.topbar {
    padding: 20px 32px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    flex: 1;
}

.topbar-title h2 { font-size: 20px; font-weight: 600; color: var(--text-primary); }
.topbar-title p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.content { padding: 32px; flex: 1; }

/* ── CARDS ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s ease;
}

.card:hover { border-color: var(--accent); }

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.purple { background: rgba(255, 0, 123, 0.15); color: #ff007b; }
.stat-icon.green { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.stat-icon.yellow { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.stat-info h3 { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-info p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── TABLE ── */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.table-header h3 { font-size: 16px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }

thead th {
    padding: 12px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    animation: fadeIn 0.3s ease forwards;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 14px 20px; font-size: 14px; color: var(--text-secondary); }

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.badge-purple { background: rgba(255, 0, 123, 0.15); color: #ff007b; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 15px var(--accent-glow); transform: translateY(-1px); }

.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── FORMS ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

input, select, textarea {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    padding: 10px 14px;
    transition: all 0.2s ease;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

select {
    appearance: none;
    -webkit-appearance: none;
    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='%238b8ba7' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

select option { background: var(--bg-secondary); }
textarea { resize: vertical; min-height: 100px; }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.2); color: #22c55e; }
.alert-danger { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: #ef4444; }

/* ── HAMBURGER ── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    background: none;
    border: none;
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── SIDEBAR OVERLAY ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── MOBILE ── */
@media (max-width: 768px) {
    .hamburger { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }

    .sidebar.mobile-open { transform: translateX(0); }

    .main { margin-left: 0 !important; }

    .collapse-btn { display: none; }
}