:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --text: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.auth-container,
.dashboard-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.dashboard-container {
    max-width: 1200px;
    align-items: flex-start;
}

.card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: white;
    font-size: 1rem;
}

input:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

.btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--primary-hover);
}

.link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.link:hover {
    text-decoration: underline;
}

.alert {
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

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

.stat-card {
    background: var(--glass);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tree-view ul {
    list-style-type: none;
    margin-left: 1.5rem;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
}

.tree-view li {
    margin: 0.5rem 0;
    position: relative;
}

.tree-view li::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    width: 0.8rem;
    height: 1px;
    background: var(--border);
}

.referral-link-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.referral-code {
    font-family: monospace;
    color: var(--primary);
}

/* Sidebar / Offcanvas */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: #1e293b;
    z-index: 2000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

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

.sidebar-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.25rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: white;
}

.sidebar-nav {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-link {
    display: block;
    padding: 1rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
    font-weight: 500;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.menu-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 1rem;
    padding: 0.5rem;
    position: relative;
    z-index: 1001;
}
/* Tree View Toggles */
.toggle-btn {
    cursor: pointer;
    margin-right: 0.5rem;
    color: var(--primary);
    font-weight: bold;
    display: inline-block;
    width: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.nested-list {
    display: none;
}

.nested-list.active {
    display: block;
}

/* Dashboard Background with Blur and Darkening */
.dashboard-bg {
    /* Ensure content stays on top */
    position: relative;
    /* Remove previous direct background if any remained, though we are replacing the block */
}

.dashboard-bg::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: url('images/bg_dashboard.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Effects: Darker (brightness) and Blurred (blur) */
    filter: blur(8px) brightness(0.4);
    
    /* scale to prevent blurred edges */
    transform: scale(1.1);
}


/* Video Background */
.video-bg {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    z-index: -2;
    object-fit: cover;
}

.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}
