/* 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 {
    --primary-bg: #141414; /* Black */
    --secondary-bg: #181818; /* Black Light */
    --lighter-bg: #333333; /* Dark Gray */
    --darker-bg: #1f1f1f; /* Darker Gray */
    --primary-accent: #e50914; /* Red */
    --secondary-accent: #bd0f18; /* Dark Red */
    --primary-text: #ffffff; /* Pure White */
    --secondary-text: #999999; /* Light Gray */
    --success-color: #28a745; /* Green */
    --error-color: #dc3545; /* Red */
    --white: #ffffff; /* Pure White */
    --black: #000000; /* Pure Black */
    --font-primary: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

/* Universal selector to apply styles to all elements */
* {
    box-sizing: border-box; /* Ensure padding and border are included in element's total width and height */
    margin: 0;
    padding: 0;
}

/* --- Basic Body Styling --- */
body {
    background-color: var(--primary-bg);
    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;
}

/* --- Global Link Styles --- */
a {
    color: var(--primary-text);
    text-decoration: none;
    transition: color 0.2s ease-in-out, text-decoration 0.2s ease-in-out;
}
a:hover {
    text-decoration: none;
}

/* --- 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(--darker-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: var(--lighter-bg);
    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 --- */


/* --- Responsive Design for Global Elements --- */
@media (max-width: 768px) {
    .site-header {
        padding: 0 1rem;
    }
    
    .header-nav {
        display: none; /* Hide desktop nav */
    }

    .mobile-menu-toggle {
        display: flex; /* Show mobile toggle */
    }
}

/* --- Header Styles --- */
.site-header {
    background-color: var(--secondary-bg);
    border-bottom: 1px solid var(--lighter-bg);
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-link {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-text);
    text-decoration: none;
}

.header-nav {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--secondary-text);
}

.user-info strong {
    color: var(--primary-text);
}

.logout-link {
    color: var(--error-color);
    font-weight: 600;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s;
}

.logout-link:hover {
    border-color: var(--error-color);
    background-color: rgba(220, 53, 69, 0.1);
}

/* Mobile Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.menu-bar {
    width: 25px;
    height: 3px;
    background-color: var(--primary-text);
    transition: 0.3s;
}

/* Mobile Nav Drawer */
.mobile-nav {
    display: none; /* Hidden by default on desktop too, logic handled below */
    position: fixed;
    top: 60px; /* Header height */
    left: 0;
    width: 100%;
    background-color: var(--secondary-bg);
    border-bottom: 1px solid var(--lighter-bg);
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 99;
}

.mobile-nav.open {
    display: block;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--lighter-bg);
}

.mobile-nav-item:last-child {
    border-bottom: none;
}

.mobile-nav-link, .mobile-info-text {
    color: var(--primary-text);
    text-decoration: none;
    font-size: 1rem;
    display: block;
}

.mobile-nav-link:hover {
    color: var(--primary-accent);
}

/* --- Footer Styles --- */
.site-footer {
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--lighter-bg);
    padding: 1.5rem 0;
    margin-top: auto; /* Push to bottom if content is short */
    text-align: center;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.copyright {
    color: var(--secondary-text);
    font-size: 0.9rem;
}
