:root {
    /* Light theme colors */
    --bg-primary: #f5f5f5;
    --bg-secondary: #fff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --border-color: #ddd;
    --border-light: #eee;
    --shadow: rgba(0,0,0,0.1);
    --shadow-strong: rgba(0,0,0,0.2);
    --accent: #007bff;
    --accent-hover: #0056b3;
    --success: #28a745;
    --success-hover: #218838;
    --danger: #dc3545;
    --secondary: #6c757d;
    --secondary-hover: #545b62;
    --overlay: rgba(0,0,0,0.95);
    --overlay-light: rgba(255,255,255,0.1);
    --overlay-light-hover: rgba(255,255,255,0.2);
}

[data-theme="dark"] {
    /* Dark theme colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888;
    --border-color: #444;
    --border-light: #555;
    --shadow: rgba(0,0,0,0.3);
    --shadow-strong: rgba(0,0,0,0.5);
    --accent: #4a9eff;
    --accent-hover: #357abd;
    --success: #40c057;
    --success-hover: #37b24d;
    --danger: #fa5252;
    --secondary: #868e96;
    --secondary-hover: #adb5bd;
    --overlay: rgba(0,0,0,0.95);
    --overlay-light: rgba(255,255,255,0.1);
    --overlay-light-hover: rgba(255,255,255,0.2);
}

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

/* Prevent horizontal overflow at the root level */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* Prevent horizontal overflow on all devices */
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.navbar {
    background: var(--bg-secondary);
    box-shadow: 0 2px 4px var(--shadow);
    padding: 15px 0;
    margin-bottom: 30px;
    position: relative;
    z-index: 10005;
}

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

.nav-container h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

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

.btn-secondary {
    background: var(--secondary);
    color: white;
}

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

.btn-copy {
    background: var(--success);
    color: white;
}

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

.auth-box {
    max-width: 400px;
    margin: 100px auto;
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 6px var(--shadow);
    position: relative;
    z-index: 10;
}

.auth-box h1 {
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-primary);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
}

.error-message {
    color: var(--danger);
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
}

/* Taco Quote Footer */
.taco-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
    text-align: center;
    z-index: 10;
    /* Prevent footer from interfering with scroll calculations */
    pointer-events: auto;
    /* Ensure footer stays in place */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.taco-quote {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto;
}

/* Adjust main content to account for footer */
body.has-footer {
    padding-bottom: 70px;
}

body.has-footer .container {
    min-height: calc(100vh - 140px);
}

/* Mobile-specific footer adjustments for taco themes */
@media (max-width: 768px) {
    body.theme-tacos.has-footer,
    body.theme-dark-tacos.has-footer {
        /* Add extra padding for sentinel element */
        padding-bottom: 90px;
    }

    /* Ensure footer stays fixed properly on mobile */
    body.theme-tacos .taco-footer,
    body.theme-dark-tacos .taco-footer {
        position: fixed !important;
        bottom: 0 !important;
        /* Prevent layout shifts */
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Container adjustments */
    .container {
        padding: 15px;
    }
    
    /* Navbar mobile styles */
    .navbar {
        padding: 10px 0;
    }
    
    .nav-container {
        padding: 0 15px;
        position: relative;
    }
    
    .nav-container h1 {
        font-size: 1.2rem;
    }
    
    .nav-container h1 img {
        height: 40px !important;
    }
    
    /* Mobile menu toggle visible on mobile */
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Nav links mobile dropdown */
    .nav-links {
        position: absolute;
        top: 100%;
        right: 0;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 5px;
        box-shadow: 0 4px 6px var(--shadow);
        flex-direction: column;
        padding: 10px;
        min-width: 200px;
        margin-top: 10px;
        display: none;
        z-index: 10003;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links .btn {
        width: 100%;
        text-align: left;
        margin: 5px 0;
    }
    
    /* Username in mobile menu */
    .nav-links #username {
        padding: 10px;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 10px;
    }
    
    /* Auth box mobile */
    .auth-box {
        margin: 50px auto;
        padding: 30px 20px;
        width: calc(100% - 30px);
        max-width: none;
    }
    
    /* Form adjustments */
    .form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Footer mobile */
    .taco-footer {
        padding: 10px 15px;
    }
    
    .taco-quote {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    /* Even smaller screens */
    .nav-container h1 span {
        display: none; /* Hide "ImageTaco" text, keep logo only */
    }
    
    .nav-container h1 img {
        height: 35px !important;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .auth-box h1 {
        font-size: 1.5rem;
    }
}

.invite-notice {
    background: var(--success);
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    opacity: 0.9;
}

/* LOGIN PAGE STYLING */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
}

body.login-page .container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

body.login-page .auth-box {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

