:root {
    --primary: #059669;
    /* Digital Emerald */
    --primary-glow: rgba(5, 150, 105, 0.4);
    --secondary: #10b981;
    --accent: #34d399;
    --bg-dark: #020617;
    /* Deep Obsidian */
    --bg-card: rgba(15, 23, 42, 0.8);
    --glass: rgba(5, 150, 105, 0.03);
    --glass-border: rgba(5, 150, 105, 0.1);
    --text-main: #f8fafc;
    --text-muted: #64748b;
    --gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-chamfer: 16px 2px 16px 2px;
    /* Unique geometry */
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.9);
    --glass: rgba(5, 150, 105, 0.02);
    --glass-border: rgba(5, 150, 105, 0.08);
    --text-main: #0f172a;
    --text-muted: #475569;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background 0.4s ease, color 0.4s ease;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 90px;
    /* Space for bottom nav */
}

#main-header {
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: none;
    /* Hidden by default, shown via body classes */
}

.is-logged-in #main-header {
    display: block;
}

/* Hide on specific routes even if logged in */
.route-login #main-header,
.route-register #main-header {
    display: none !important;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.header-actions button {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.header-actions button:hover {
    background: rgba(255, 255, 255, 0.08);
}

#app-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
}

.section-title i {
    color: var(--primary);
    font-size: 1rem;
    filter: drop-shadow(0 0 5px var(--primary));
}

/* Bottom Nav */
#bottom-nav {
    background: rgba(21, 23, 28, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: none;
    /* Hidden by default */
    justify-content: space-around;
    padding: 12px 0;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 100;
}

.is-logged-in #bottom-nav {
    display: flex;
}

.route-login #bottom-nav,
.route-register #bottom-nav {
    display: none !important;
}

.nav-item {
    text-decoration: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    gap: 5px;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item.active {
    color: var(--primary);
    position: relative;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary);
}

/* Cards & Components */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-chamfer);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-chamfer);
    padding: 20px;
}

.btn {
    background: var(--gradient);
    border: none;
    border-radius: var(--radius-chamfer);
    color: white;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-align: center;
    text-decoration: none;
    width: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--primary-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-control,
.form-select {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-chamfer);
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(5, 150, 105, 0.05);
}

/* Animations */
/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: var(--radius-chamfer);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: slideIn 0.3s ease-out forwards;
}

.toast.success {
    border-left: 4px solid var(--accent);
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast i {
    font-size: 1.2rem;
}

.toast.success i {
    color: var(--accent);
}

.toast.error i {
    color: #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#app-content>* {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Live Counter Style */
.live-counter {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    color: var(--accent);
}

/* Admin Styles */
.admin-theme {
    display: flex;
}

#admin-app {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

#sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 30px 20px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0 10px;
}

.nav-link {
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: var(--glass);
    color: var(--text-main);
}

.nav-link i {
    margin-right: 10px;
}

#admin-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#admin-header {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }
}