/* Navigation & Header Styles */

/* Navbar */
.fixed-top.transparent-navbar {
    /* Aero-Glass look - ALWAYS dark */
    --nav-bg: linear-gradient(180deg, rgba(10, 10, 10, 0.75), rgba(20, 20, 20, 0.9));
    --nav-text: #ffffff;
    --nav-border: rgba(255, 255, 255, 0.06);

    background: var(--nav-bg);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

/* Ensure links use theme variable */
.transparent-navbar .nav-link {
    color: var(--nav-text) !important;
    transition: color 0.18s ease;
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

/* Hover state: orange */
.transparent-navbar .nav-link:hover {
    color: #f97316 !important;
    transform: translateY(-1px);
}

.transparent-navbar .nav-link.active {
    color: #f97316 !important;
    font-weight: bold;
}

/* Better spacing for nav items */
.transparent-navbar .navbar-nav {
    gap: 0.5rem;
}

/* Toggler icon - Always light for dark background */
.transparent-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Logo */
.transparent-navbar .logo-img {
    height: 56px !important;
    max-height: 56px !important;
    width: auto !important;
    display: inline-block;
    vertical-align: middle;
    filter: none !important;
    opacity: 1 !important;
    transition: opacity 200ms ease;
}

.fixed-top.transparent-navbar.navbar-dark-bg {
    background: var(--nav-bg);
}

/* Toggler focus and hover for contrast */
.navbar-toggler:hover {
    border-color: rgba(249,115,22,0.12);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 6px rgba(249,115,22,0.08);
}

/* FIX: Horizontale Zentrierung für Desktop-Navbar */
@media (min-width: 768px) {
    .navbar-expand-md .navbar-collapse {
        flex-grow: 1;
    }
    
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar .navbar-nav {
        padding: 0 1rem;
        display: flex;
        align-items: center;
    }
}

/* FIX: Mobile Navigation Centering & Layout */
@media (max-width: 767.98px) {
    .navbar-collapse .navbar-nav {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 1rem 0;
        gap: 0.25rem;
    }

    .navbar-collapse .nav-item {
        width: 100%;
        text-align: center;
    }

    .navbar-collapse .nav-item:last-of-type {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }

    .navbar-collapse .profile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Profile inline SVG styling */
.profile-icon-svg {
    color: var(--nav-text);
    opacity: 0.8;
    width: 32px;
    height: 32px;
}

/* Profile button visual upgrade - enlarged */
.profile-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-bg-glow-soft);
    border: 1px solid var(--accent-border);
    box-shadow: none;
    transition: background 160ms ease, transform 120ms ease;
}

.profile-btn:hover {
    background: var(--accent-bg-glow);
}

.profile-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(66,117,170,0.08);
}

.profile-btn .profile-icon-svg {
    color: var(--accent-primary);
    width: 22px;
    height: 22px;
}

/* Profile initial badge */
.profile-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(180deg, #f97316, #e65a00);
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.transparent-navbar.navbar-dark-bg .profile-initial {
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

/* Navbar brand logo sizing and appearance */
.transparent-navbar .navbar-brand img,
.transparent-navbar .logo-img {
    height: 56px !important;
    max-height: 56px !important;
    width: auto !important;
    display: inline-block;
    vertical-align: middle;
    filter: none !important;
    opacity: 1 !important;
    transition: opacity 200ms ease;
}

.transparent-navbar.navbar-dark-bg {
    filter: none !important;
    opacity: 1 !important;
}

/* --- Profile Sidebar Redesign (Aero Glass) --- */
.profile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
    z-index: 1999;
}

.profile-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.profile-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 360px;
    max-width: 90vw;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--sidebar-border);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 2000;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    will-change: transform;
    /* Mobile/touch scrolling enhancements */
    height: 100dvh; /* avoid iOS 100vh issues */
    max-height: 100dvh;
    -webkit-overflow-scrolling: touch; /* momentum scrolling on iOS */
    touch-action: pan-y; /* allow vertical touch scroll */
    overscroll-behavior: contain; /* prevent body scroll chaining */
}

.profile-sidebar.show {
    transform: translateX(0);
}

/* Sidebar Content Wrapper for Padding */
.sidebar-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Grow and scroll inside the sidebar on small screens */
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* Close Button */
.profile-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--accent-bg-glow-soft);
    border: none;
    color: var(--accent-primary);
    font-size: 29px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.12s ease;
    z-index: 10;
}

.profile-close-btn:hover {
    background: var(--accent-bg-glow);
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    text-align: center;
}

.sidebar-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #f97316, #d95309);
    color: white;
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.sidebar-avatar .profile-icon-svg {
    width: 40px;
    height: 40px;
    color: #fff;
}

.sidebar-username {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.sidebar-user-email {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Sidebar Sections */
.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-section h5 {
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 0.5rem;
    margin-bottom: 0.25rem;
}

/* Sidebar Links/Buttons */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    background-color: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.sidebar-link:hover {
    background-color: var(--accent-bg-glow-soft);
    color: var(--accent-primary);
}

.sidebar-link i {
    width: 20px;
    margin-right: 1rem;
    font-size: 1rem;
    text-align: center;
    color: var(--accent-primary);
}

.sidebar-link.logout:hover {
    background-color: rgba(220, 53, 69, 0.2);
    color: #f8d7da;
}

.sidebar-link.logout:hover i {
    color: #dc3545;
}

/* QR Code Section */
.qr-code-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--table-header-bg);
    border-radius: 12px;
}

.profile-qr {
    width: 180px;
    height: 180px;
    border-radius: 10px;
    background-color: #fff;
    padding: 8px;
    box-shadow: var(--qr-container-shadow);
    object-fit: contain;
}

.qr-code-section p {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}

/* Staff Tools */
#staffTools .form-control-custom {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
}

#staffTools .form-control-custom:focus {
    background-color: rgba(0, 0, 0, 0.4);
    border-color: #f97316;
}

#staffTools .form-label {
    color: rgba(255, 255, 255, 0.8);
}

#staffMessage {
    min-height: 1.2rem;
}

@media (max-width: 480px) {
    .profile-sidebar {
        width: 100%;
    }
}

/* --- Staff Theme Overrides (Cyan/Turquoise) --- */
.profile-initial.staff-theme {
    background: linear-gradient(145deg, #0ea5a9, #06b6d4);
}

button.profile-toggle.staff-theme:focus .profile-btn,
.profile-btn.staff-theme:focus {
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.25);
}

.profile-sidebar.staff-theme .sidebar-avatar {
    background: linear-gradient(145deg, #0ea5a9, #06b6d4);
}

.profile-sidebar.staff-theme .sidebar-link:hover {
    background-color: rgba(6, 182, 212, 0.15);
}
