:root {
    --primary-color: #4B0082;
    --secondary-color: #FFD700;
    --text-color: #f0f0f0;
    --background-color: #1a1a1a;
    --accent-dark: #3a0066;
    --border-color: #663399;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

a {
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header Styles */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

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

.logo {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    transition: color 0.3s ease;
}

.logo:hover {
    color: #fff;
    text-decoration: none;
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li {
    margin-left: 1.5rem;
}

.main-nav ul li a {
    color: var(--text-color);
    font-weight: 600;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.main-nav ul li a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0%;
    height: 2px;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.main-nav ul li a:hover::after,
.main-nav ul li a.active::after {
    width: 100%;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
    color: var(--secondary-color);
}

.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-menu .bar {
    width: 100%;
    height: 3px;
    background-color: var(--secondary-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* New Button Styles */
.auth-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
}

.btn-login {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: 2px solid var(--secondary-color);
}

.btn-login:hover {
    background-color: #fff;
    color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-2px);
}

.btn-register {
    background-color: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn-register:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-2px);
}

/* Footer Styles */
.site-footer {
    background-color: var(--accent-dark);
    color: var(--text-color);
    padding: 2.5rem 1.5rem 1rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.footer-section h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-section p,
.footer-section a {
    font-size: 0.9rem;
    color: #bbb;
}

.footer-section a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.footer-nav ul {
    list-style: none;
}

.footer-nav ul li {
    margin-bottom: 0.5rem;
}

.footer-nav ul li a {
    color: #bbb;
    transition: color 0.3s ease;
}

.footer-nav ul li a:hover {
    color: var(--secondary-color);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 1rem;
}

.copyright {
    font-size: 0.85rem;
    color: #999;
    margin-right: 1rem;
}

.back-to-top {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease, transform 0.3s ease;
    margin-left: 1rem;
}

.back-to-top:hover {
    background-color: var(--accent-dark);
    transform: translateY(-3px);
}

.back-to-top svg {
    fill: var(--secondary-color);
}

/* Responsive Styles */
@media (max-width: 992px) {
    .main-nav ul li {
        margin-left: 1rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        /* Override desktop flex for mobile grid */
        display: grid;
        grid-template-columns: auto 1fr auto; /* Hamburger | Logo | Spacer */
        grid-template-rows: auto auto; /* Row 1: hamburger/logo, Row 2: buttons */
        gap: 0 1rem; /* Vertical gap 0, horizontal gap 1rem */
        padding: 0 1rem;
    }

    .hamburger-menu {
        display: flex; /* Make visible */
        grid-column: 1 / 2; /* First column */
        grid-row: 1 / 2; /* First row */
        margin-right: 0; /* Remove any default margin */
    }

    .logo {
        grid-column: 2 / 3; /* Second column */
        grid-row: 1 / 2; /* First row */
        text-align: center; /* Center the logo text */
        margin: 0; /* Remove any desktop margins */
    }

    .auth-buttons {
        grid-column: 1 / -1; /* Span all columns */
        grid-row: 2 / 3; /* Second row */
        display: flex; /* Make visible and flex */
        justify-content: center; /* Center the buttons */
        width: 100%; /* Take full width */
        order: initial; /* Reset order if any was set */
    }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--primary-color);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        z-index: 999;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, padding 0.3s ease-out;
        display: flex;
        flex-direction: column;
        padding: 0;
    }

    .main-nav.active {
        max-height: 500px;
        padding: 1rem 0;
    }

    .main-nav ul {
        flex-direction: column;
        width: 100%;
    }

    .main-nav ul li {
        margin: 0;
        text-align: center;
        border-bottom: 1px solid var(--accent-dark);
    }

    .main-nav ul li:last-child {
        border-bottom: none;
    }

    .main-nav ul li a {
        display: block;
        padding: 1rem;
        color: var(--text-color);
    }

    .main-nav ul li a:hover,
    .main-nav ul li a.active {
        background-color: var(--accent-dark);
        color: var(--secondary-color);
        text-decoration: none;
    }
    
    .main-nav ul li a::after {
        display: none;
    }

    .hamburger-menu {
        display: flex;
    }

    .hamburger-menu.active .bar:nth-child(1) {
        transform: translateY(11px) rotate(45deg);
    }

    .hamburger-menu.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger-menu.active .bar:nth-child(3) {
        transform: translateY(-11px) rotate(-45deg);
    }

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-section {
        margin-bottom: 1.5rem;
    }

    .footer-nav ul {
        padding-left: 0;
    }

    .footer-bottom {
        flex-direction: column;
    }

    .copyright {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .back-to-top {
        margin-left: 0;
    }
}

/* Desktop overrides for main-nav */
@media (min-width: 769px) {
    .header-container {
        display: flex; /* Revert to flex for desktop */
        justify-content: space-between;
        flex-wrap: nowrap; /* Ensure no wrapping */
    }
    .hamburger-menu {
        display: none; /* Hide on desktop */
    }
    .logo {
        margin-right: auto; /* Push nav and buttons to the right */
        text-align: left; /* Revert logo text alignment */
    }
    .main-nav {
        position: static;
        max-height: none;
        overflow: visible;
        padding: 0;
        box-shadow: none;
        flex-direction: row;
        margin-right: 1.5rem; /* Space between nav and auth buttons */
    }
    .auth-buttons {
        display: flex; /* Ensure visible on desktop */
        margin-left: 0; /* Remove any mobile-specific margin */
        padding-top: 0; /* Remove mobile padding */
    }
}
