:root {
    --bg-deep: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.6);
    --primary: #1e88e5;
    --primary-dark: #0d47a1;
    --primary-light: #e3f2fd;
    --primary-glow: rgba(30, 136, 229, 0.4);
    --secondary: #90caf9;
    --accent: #ffa000;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --glass: blur(12px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    overflow: hidden;
}

body.is-unauthorized .admin-wrapper {
    filter: blur(8px);
    pointer-events: none;
}

body:not(.is-unauthorized) .login-overlay {
    opacity: 0;
    pointer-events: none;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header .logo-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.login-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 0.9rem 1rem;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.login-error {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    text-align: center;
}

.hidden { display: none; }
.w-full { width: 100%; }

.login-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

h1, h2, h3, .logo-text {
    font-family: 'Outfit', sans-serif;
}

/* Wrapper */
.admin-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background: rgba(15, 23, 42, 0.8);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo-text span {
    color: var(--primary);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-align: left;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), transparent);
    color: var(--primary);
    border-left: 2px solid var(--primary);
}

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

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name { font-size: 0.9rem; font-weight: 600; }
.user-info .role { font-size: 0.75rem; color: var(--text-muted); }

/* Main Content */
.main-content {
    background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.05) 0%, transparent 50%), var(--bg-deep);
    padding: 2.5rem;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header h1 { font-size: 1.75rem; font-weight: 700; }

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-refresh {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: rgba(255,255,255,0.1);
}

.btn-refresh.loading {
    opacity: 0.7;
    cursor: not-allowed;
    background: rgba(30, 136, 229, 0.1);
    color: var(--primary);
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    padding: 1.75rem;
    border-radius: 20px;
}

.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 2.25rem; font-weight: 700; margin-bottom: 0.5rem; }
.stat-trend { font-size: 0.8rem; color: var(--text-muted); }
.stat-trend.positive { color: var(--accent); }
.stat-trend.negative { color: #f43f5e; }

/* Dashboard Layout */
.content-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.chart-container {
    padding: 1.5rem;
    height: 350px;
    position: relative;
}

/* Activity Feed */
.activity-list {
    list-style: none;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.activity-list li {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    padding-left: 1rem;
    border-left: 1px solid var(--primary);
}

.activity-list li .time { font-size: 0.75rem; color: var(--text-muted); }
.activity-list li .message { font-size: 0.9rem; line-height: 1.4; }

.small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
}

.small.active { background: var(--primary); color: white; border-color: var(--primary); }

.text-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 0.85rem; }
.view-container {
    animation: fadeIn 0.4s ease;
}

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

/* Tables */
.table-responsive {
    overflow-x: auto;
    padding: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

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

.table-search, .filter-select {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.text-center { text-align: center; }
.muted { color: var(--text-muted); }

/* Glassmorphism Polish */
.glass {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* User View specific styles */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar-small {
    width: 32px;
    height: 32px;
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    background: var(--text-muted);
}

.status-dot.accent {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.tag {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.tag.primary { background: rgba(30, 136, 229, 0.2); color: var(--primary); border: 1px solid rgba(30, 136, 229, 0.3); }
.tag.accent { background: rgba(255, 160, 0, 0.2); color: var(--accent); border: 1px solid rgba(255, 160, 0, 0.3); }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
