/* Navbar Styles */
:root {
    --navbar-height: 100px;
    --content-gap: 15px;
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #95a5a6;
    --background-primary: #ffffff;
    --background-secondary: #f8f9fa;
    --background-accent: #ecf0f1;
    --border-color: #e9ecef;
    --shadow-light: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-medium: 0 4px 16px rgba(0,0,0,0.12);
    --border-radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100vw;
}

/* Prevent page content from being hidden under the fixed navbar */
body {
    padding-top: var(--navbar-height);
}

/* Add extra spacing between the fixed navbar and header content to avoid overlap */
.header-content {
    margin-top: 24px;
}
@media (max-width: 768px) {
    /* smaller gap on mobile so content remains visible */
    .header-content { margin-top: 12px; }
}

.navbar {
    background: var(--background-primary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    z-index: 1000;
    box-shadow: var(--shadow-light);
    width: 100%;
    overflow-x: hidden !important;
    max-width: 100vw;
    backdrop-filter: blur(10px);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

.navbar-container.simple {
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-link:hover {
    opacity: 0.8;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.brand-quote {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 400;
    line-height: 1;
}

.navbar-brand:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.navbar-brand img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.search-section {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    max-width: 400px;
    min-width: 0;
    margin: 0 20px;
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--background-primary);
    color: var(--text-primary);
}

.search-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-btn {
    background: var(--secondary-color);
    color: white;
    border: 1px solid var(--secondary-color);
    padding: 14px 20px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.search-btn:hover {
    background: #2980b9;
    border-color: #2980b9;
    transform: translateY(-1px);
}

.nav-links {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

.nav-link {
    background: var(--background-accent);
    color: var(--text-primary);
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9375rem;
}

.nav-link:hover {
    background: var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.nav-link.home {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.nav-link.home:hover {
    background: #2980b9;
    border-color: #2980b9;
    color: white;
}

.nav-link.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.nav-link.active:hover {
    background: #2980b9;
    border-color: #2980b9;
    color: white;
}

.nav-link.admin {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.nav-link.admin:hover {
    background: #219a52;
    border-color: #219a52;
    color: white;
}

.nav-link.login {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.nav-link.login:hover {
    background: #219a52;
    border-color: #219a52;
    color: white;
}

.nav-link.story {
    background: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
}

.nav-link.story:hover {
    background: #e67e22;
    border-color: #e67e22;
    color: white;
}

.nav-link.server {
    background: #17a2b8;
    color: white;
    border-color: #17a2b8;
}

.nav-link.server:hover {
    background: #138496;
    border-color: #138496;
    color: white;
}

/* User Menu Styles */
.user-menu {
    position: relative;
}

.user-link {
    display: flex !important;
    align-items: center;
    gap: 8px;
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease;
}

.user-link:hover {
    background: #34495e !important;
    border-color: #34495e !important;
    color: white !important;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
        padding: 20px 20px;
        overflow-x: hidden !important;
    }
    
    .search-section {
        max-width: none;
        margin: 0;
        min-width: 0;
    }
    
    .nav-links {
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
        overflow: visible;
    }
    
    .nav-link {
        font-size: 0.875rem;
        padding: 10px 14px;
        white-space: nowrap;
    }
    
    .brand-title {
        font-size: 1.25rem;
    }
    
    .brand-quote {
        font-size: 0.8rem;
    }
}

/* Global override: ensure block search sections sit well below the fixed navbar */
body .container > .search-section-main {
    margin: calc(var(--navbar-height) + 160px) 0 32px 0 !important;
}
