/* Main header styles */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(15px, 3vw, 30px);
    background: linear-gradient(135deg, #f4722a 0%, #e8651f 100%);
    height: clamp(60px, 10vh, 80px);
    width: 100%;
    border-bottom: 4px solid #4e3f36;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 999;
    backdrop-filter: blur(20px);
    /* Reserve space for side controls so centered logo never touches */
    --side-gutter: 180px;
}

/* Navbar sections */
.navbar-left,
.navbar-right {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 12px);
    min-width: 0;
    flex: 0 0 auto;
}

.navbar-right {
    justify-content: flex-end;
}

/* Logo container */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: min(clamp(200px, 40vw, 400px), calc(100% - var(--side-gutter)));
    margin: 0;
    pointer-events: none;
}

#logo {
    max-width: 100%;
    height: auto;
    max-height: clamp(35px, 5vh, 45px);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    pointer-events: auto;
}

#logo:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* Navigation icons */
.nav-icon-a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(36px, 7vw, 42px);
    height: clamp(36px, 7vw, 42px);
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(16px, 3vw, 18px);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-icon-a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: #ffffff;
    text-decoration: none;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Navbar togglers */
.navbar-toggler {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(36px, 7vw, 42px);
    height: clamp(36px, 7vw, 42px);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(16px, 3vw, 18px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.navbar-toggler:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Cart wrapper and container */
.carrinho-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.carrinho-container,
.feedback-container,
.notifications-container,
.user-btn {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1vw, 8px);
    padding: clamp(8px, 1.2vw, 10px) clamp(12px, 1.8vw, 14px);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: clamp(11px, 1.8vw, 13px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    backdrop-filter: blur(15px);
    position: relative;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: -0.02em;
}

.carrinho-container:hover,
.feedback-container:hover,
.notifications-container:hover,
.user-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    color: #ffffff;
    text-decoration: none;
    border-color: rgba(255, 255, 255, 0.2);
}

.carrinho-container .nav-icon,
.feedback-container .nav-icon,
.notifications-container .nav-icon,
.user-btn .nav-icon {
    font-size: clamp(16px, 3vw, 18px);
    flex-shrink: 0;
    opacity: 0.9;
}

/* Notifications popover */
.notifications-wrapper {
    position: relative;
}

.notifications-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(90vw, 340px);
    background: rgba(255, 255, 255, 0.98);
    color: #2b2b2b;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    backdrop-filter: saturate(180%) blur(12px);
    z-index: 1000;
    overflow: hidden;
}

.notifications-header {
    padding: 10px 12px;
    font-weight: 600;
    background: rgba(244, 114, 42, 0.07);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.notifications-list {
    max-height: 300px;
    overflow: auto;
}

.notification-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    align-items: flex-start;
}

.notification-item i {
    color: #f4722a;
    font-size: 18px;
    margin-top: 2px;
}

.notification-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-title {
    font-weight: 600;
}

.notification-time {
    font-size: 12px;
    color: #6b7280;
}

.notifications-footer {
    padding: 8px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: right;
}

.notifications-footer .view-all {
    color: #f4722a;
    text-decoration: none;
}

.notifications-footer .view-all:hover {
    text-decoration: underline;
}

.feedback-text {
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: -0.01em;
    opacity: 0.95;
}

/* Cart badge - positioned relative to wrapper, not container */
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #4e3f36 0%, #3a2f26 100%);
    color: #ffffff;
    border-radius: 50%;
    min-width: clamp(20px, 3.5vw, 24px);
    height: clamp(20px, 3.5vw, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(10px, 1.8vw, 12px);
    font-weight: 600;
    border: 2px solid #f4722a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: pulse 2s infinite;
    padding: 0 clamp(4px, 0.8vw, 6px);
    z-index: 10;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

textarea#feedback:focus {
    outline: none !important;
    border-color: #f4722a !important;
    background: rgba(244, 114, 42, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(244, 114, 42, 0.1) !important;
}

/* User dropdown */
.user-dropdown {
    position: relative;
}

.user-btn {
    border-radius: 12px;
}

.app-header .user-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 180px;
    background: rgba(255, 255, 255, 0.98);
    color: #2b2b2b;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    backdrop-filter: saturate(180%) blur(12px);
    z-index: 1000;
    overflow: hidden;
}

.app-header .user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: inherit;
    text-decoration: none;
    width: 100%;
    background: transparent;
    border: 0;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    line-height: 1.4;
    cursor: pointer;
}

.app-header .user-menu-item:hover,
.app-header .user-menu-item:focus {
    background: rgba(244, 114, 42, 0.08);
    outline: none;
}

.app-header .user-menu-item i {
    color: #f4722a;
    font-size: 18px;
}

.app-header .user-menu-item span {
    flex: 1;
    text-align: left;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .app-header {
        padding: 0 12px;
        height: 65px;
        --side-gutter: 160px;
    }

    .navbar-left,
    .navbar-right {
        gap: 6px;
    }

    .logo-container {
        margin: 0 8px;
    }

    .feedback-text {
        display: none;
    }

    .feedback-container,
    .carrinho-container,
    .notifications-container,
    .user-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
        border-radius: 12px;
    }

    .cart-badge {
        top: -6px;
        right: -6px;
        min-width: 18px;
        height: 18px;
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0 8px;
        height: 60px;
        --side-gutter: 140px;
    }

    .navbar-left,
    .navbar-right {
        gap: 4px;
    }

    .logo-container {
        margin: 0 4px;
    }
    #logo {
        max-height: 30px;
    }

    .nav-icon-a,
    .navbar-toggler,
    .carrinho-container,
    .feedback-container,
    .notifications-container,
    .user-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .nav-icon {
        font-size: 16px !important;
    }

    .cart-badge {
        top: -5px;
        right: -5px;
        min-width: 16px;
        height: 16px;
        font-size: 8px;
    }
}

/* Landscape mobile optimization */
@media (max-height: 600px) and (orientation: landscape) {
    .app-header {
        height: 55px;
        padding: 0 12px;
    }

    #logo {
        max-height: 32px;
    }

    .nav-icon-a,
    .navbar-toggler,
    .carrinho-container,
    .feedback-container {
        width: 34px;
        height: 34px;
    }

    .cart-badge {
        top: -4px;
        right: -4px;
        min-width: 16px;
        height: 16px;
        font-size: 8px;
    }
}

/* High DPI displays */
@media (min-resolution: 2dppx) {
    #logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .nav-icon-a:hover,
    .navbar-toggler:hover,
    .carrinho-container:hover,
    .feedback-container:hover,
    #logo:hover {
        transform: none !important;
    }

    .cart-badge {
        animation: none !important;
    }
}

/* Focus indicators for accessibility */
.nav-icon-a:focus,
.carrinho-container:focus,
.feedback-container:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

/* Loading animation for logo */
@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#logo {
    animation: logoFadeIn 0.4s ease-out;
}

/* Smooth performance optimizations */
.nav-icon-a,
.navbar-toggler,
.carrinho-container,
.feedback-container,
#logo {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Subtle glow effect on hover */
.carrinho-container:hover,
.feedback-container:hover,
.nav-icon-a:hover,
.navbar-toggler:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1), 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Improved feedback container styling */
.feedback-container {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.feedback-container:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.25);
}

/* SweetAlert textarea customization */
textarea#feedback {
    min-height: 120px !important;
    width: 100% !important;
    resize: vertical !important;
    border-radius: 12px !important;
    border: 2px solid rgba(244, 114, 42, 0.2) !important;
    padding: 16px !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    background: rgba(244, 114, 42, 0.02) !important;
    transition: all 0.2s ease !important;
}
