/* Master CSS file for the website */
/* This file contains the main styles for the website */

/* In CSS, px (pixels) is an absolute unit of measurement, representing a fixed size on the screen,
while rem (root em) is a relative unit based on the root font size of the document (usually 16px).

vh (Viewport Height) represents a percentage of the viewport's height,
which is the visible area of the browser window.
1vh is equal to 1% of the viewport height.
100vh equals the full height of the browser window.

% (Percent) is a relative unit that represents a percentage of the parent element's size,
but vh is relative to the viewport size.
*/

/* --- Base Styles & Variables --- */
:root {
    /* Color Palette */
    --primary-bg: #09090b; /* Very dark slate/black */
    --secondary-bg: #18181b; /* Slightly lighter deep gray */
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Accents */
    --primary-accent: #3b82f6; /* Modern Blue */
    --primary-accent-hover: #2563eb; 
    --secondary-accent: #8b5cf6; /* Modern Purple */
    
    /* Text */
    --primary-text: #ffffff;
    --secondary-text: #a1a1aa; /* Muted gray text */
    
    /* Status Colors */
    --success-color: #10b981; 
    --error-color: #ef4444; 
    --warning-color: #f59e0b;
    
    /* Glassmorphism Variables */
    --glass-bg: rgba(24, 24, 27, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(12px);

    /* Typography */
    --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    
    /* Transitions */
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- Basic Body Styling --- */
body {
    background-color: var(--primary-bg);
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.08), transparent 40%);
    font-family: var(--font-primary);
    color: var(--primary-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 1rem; /* Base font size */
    line-height: 1.6;
    min-height: 100vh;
}

/* --- Global Link Styles --- */
a {
    color: var(--primary-accent);
    text-decoration: none;
    transition: color var(--transition-speed) ease-in-out;
}

a:hover {
    color: var(--primary-accent-hover);
}

/* Base Glassmorphism Component */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

/* Button Component */
.primary-btn {
    background: var(--primary-accent);
    color: var(--primary-text);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-speed), transform 0.1s;
    width: 100%;
}

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

.primary-btn:active {
    transform: scale(0.98);
}

/* Input Component */
.input-group {
    margin-bottom: 20px;
    width: 100%;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--secondary-text);
    font-weight: 500;
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--primary-text);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
    font-family: var(--font-primary);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.input-group input::placeholder {
    color: rgba(161, 161, 170, 0.5);
}

/* --- Notification Popup --- */
/* This is the main container for the notification popup.
It's positioned fixed to stay in the top-right corner of the screen.
'z-index' is set very high to ensure it appears above all other content.
It starts hidden ('transform' and 'opacity') and will fade in with a transition.
*/
.notification-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background-color: var(--secondary-bg);
    color: var(--primary-text);
    border-radius: 8px;
    padding: 16px;
    min-width: 300px;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-left: 5px solid var(--primary-accent); /* Default border color */
    
    /* Animation properties */
    transform: translateX(120%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s ease-in-out, opacity 0.4s ease, visibility 0.4s ease;
}

/*
The '.show' class is added by JavaScript to make the popup visible.
It slides in from the right and fades in.
*/
.notification-popup.show {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

/* Modifier class for a SUCCESS notification */
.notification-popup.success {
    border-left-color: var(--success-color);
}

/* Modifier class for an ERROR notification */
.notification-popup.error {
    border-left-color: var(--error-color);
}

/* --- Internal Layout --- */
.notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-icon i {
    display: none;
    font-size: 1.8rem;
}

/* Set icon color based on type */
.notification-popup.success .notification-icon { color: var(--success-color); }
.notification-popup.error .notification-icon { color: var(--error-color); }

.notification-message {
    flex-grow: 1; /* Allows message to take up available space */
    font-size: 0.95rem;
    line-height: 1.4;
}

/* --- Close Button --- */
.notification-close {
    background: none;
    border: none;
    color: var(--secondary-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
    transition: color 0.2s;
}
.notification-close:hover {
    color: var(--primary-text);
}

/* --- Progress Bar --- */
.notification-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* The inner bar that animates */
.notification-progress-bar div {
    height: 100%;
    background-color: var(--primary-accent); /* Default color */
    border-bottom-left-radius: 8px;
    width: 0%; /* Start at 0, animation will fill it */
}

/* Progress bar color based on type */
.notification-popup.success .notification-progress-bar div { background-color: var(--success-color); }
.notification-popup.error .notification-progress-bar div { background-color: var(--error-color); }

/* * When the 'show' class is added, we trigger the animation on the progress bar.
    * It animates the width from 100% to 0% over 6 seconds.
*/
.notification-popup.show .notification-progress-bar div {
    animation: progressBar 6s linear forwards;
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}
/* --- End of Notification Popup --- */


/* --- App Layout & Sidebar --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Base Glass Panel Component */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
}

.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    z-index: 100;
}

.sidebar-header {
    padding: 0 24px 30px;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary-text), #a1a1aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.nav-links {
    list-style: none;
    padding: 0 12px;
}

.nav-links li {
    margin-bottom: 4px;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    color: var(--secondary-text);
    transition: all 0.2s ease;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-text);
}

.nav-links a.active {
    background: rgba(59, 130, 246, 0.15); /* Primary Accent Tint */
    color: var(--primary-accent);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.nav-icon {
    font-size: 1.2rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-footer {
    padding: 20px 12px 0;
    border-top: 1px solid var(--glass-border);
}

.logout-btn {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    color: var(--secondary-text);
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 260px; /* Offset for fixed sidebar */
    min-height: 100vh;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* --- Responsive Design for Global Elements --- */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static; /* Let it flow in document on mobile */
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 16px 0;
        z-index: 10;
    }
    
    .sidebar-header {
        padding: 0 16px 16px;
        text-align: center;
    }

    .nav-links {
        display: flex;
        overflow-x: auto;
        padding: 0 16px 16px;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .nav-links li {
        margin-bottom: 0;
        margin-right: 8px;
        white-space: nowrap;
    }
    
    .nav-text {
        font-size: 0.85rem;
    }

    .sidebar-footer {
        display: none; /* Hide logout from main bar row */
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        min-height: calc(100vh - 120px); /* Fill remaining space minus header height */
    }
}
