/**
 * DrummerTube Custom Header Styles
 * Mobile-first responsive styles with dark theme.
 * @package HelloElementorChild
 */

:root {
    /* Header Colors - Reference theme variables from variables.css */
    --dt-header-bg: var(--dt-bg-elevated, #1c1d1f);
    --dt-header-border: var(--dt-border-lighter, #2d2e32);
    --dt-header-text: var(--dt-text-primary, #ffffff);
    --dt-header-text-muted: var(--dt-text-hint, #9ca3af);
    --dt-header-accent: var(--dt-accent, #00f0ff);
    --dt-header-accent-hover: var(--dt-accent-hover, #00c4d4);
    --dt-header-overlay: rgba(0, 0, 0, 0.6);

    /* Spacing */
    --dt-header-height: 70px;
    --dt-header-padding-x: 5%;
    --dt-header-gap: 2rem;

    /* Typography */
    --dt-header-font: "Montserrat", sans-serif;
    --dt-header-font-size: 0.95rem;
    --dt-header-font-weight: 500;

    /* Effects */
    --dt-header-radius: 8px;
    --dt-header-radius-pill: 9999px;
    --dt-header-transition: 200ms ease;

    /* Z-index */
    --dt-header-z: 1000;
    --dt-mobile-menu-z: 10000;
}

/* Elementor Overrides */
.elementor-section .dt-header,
.elementor-container .dt-header,
.elementor-widget-shortcode .dt-header {
    width: 100% !important;
    max-width: none !important;
}

.elementor-section:has(.dt-header),
.elementor-section-wrap:has(.dt-header) {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Reset Overrides */
.dt-header button:focus,
.dt-header button:hover,
.dt-header [type="button"]:focus,
.dt-header [type="button"]:hover,
.dt-header [type="submit"]:focus,
.dt-header [type="submit"]:hover {
    background-color: transparent;
}

/* Skip Link */
.dt-skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: calc(var(--dt-header-z) + 1);
    padding: 0 1.5rem;
    background: var(--dt-header-accent);
    color: #000;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--dt-header-radius);
    transition: top var(--dt-header-transition);
}

.dt-skip-link:focus {
    top: 10px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Screen Reader Only */
.dt-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Header Base */
.dt-header {
    position: relative;
    width: 100% !important;
    max-width: none !important;
    height: var(--dt-header-height);
    background: var(--dt-header-bg) !important;
    background-color: #1c1d1f !important;
    border-bottom: 1px solid var(--dt-header-border);
    font-family: var(--dt-header-font);
    z-index: var(--dt-header-z);
    box-sizing: border-box;
}

/* Sticky Header */
.dt-header--sticky {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
}

/* Add padding to body when sticky header is present */
body:has(.dt-header--sticky) {
    padding-top: var(--dt-header-height);
}

/* WordPress Admin Bar adjustments */
body.admin-bar .dt-header--sticky {
    top: 32px;
}

body.admin-bar:has(.dt-header--sticky) {
    padding-top: calc(var(--dt-header-height));
}

@media screen and (max-width: 782px) {
    body.admin-bar .dt-header--sticky {
        top: 46px;
    }

    body.admin-bar:has(.dt-header--sticky) {
        padding-top: calc(var(--dt-header-height) + 46px);
    }
}

/* Transparent Header on Homepage (starts transparent, becomes solid on scroll) */
body.home .dt-header {
    background: transparent !important;
    background-color: transparent !important;
    border-bottom-color: transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.home .dt-header.dt-header--scrolled {
    background: var(--dt-header-bg) !important;
    background-color: #1c1d1f !important;
    border-bottom-color: var(--dt-header-border);
}

.dt-header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 var(--dt-header-padding-x);
}

/* Logo */
.dt-header__logo {
    flex-shrink: 0;
}

/* On mobile/tablet, push logo to stay with hamburger on the left */
@media (max-width: 1023px) {
    .dt-header__logo {
        margin-right: auto;
    }
}

.dt-header__logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity var(--dt-header-transition);
}

.dt-header__logo-link:hover {
    opacity: 0.85;
}

.dt-header__logo-link:focus {
    outline: 2px solid var(--dt-header-accent);
    outline-offset: 4px;
    border-radius: 4px;
}

.dt-header__logo-img {
    height: 30px !important;
    width: auto !important;
    object-fit: contain;
}

.dt-header__logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dt-header-text);
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* Desktop Navigation */
.dt-nav--desktop {
    display: none;
}

.dt-nav__list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dt-nav__item {
    margin: 0;
}

.dt-nav__link {
    font-family: var(--dt-header-font);
    display: block;
    padding: 0.625rem 1rem;
    font-size: var(--dt-header-font-size);
    font-weight: var(--dt-header-font-weight);
    color: var(--dt-header-text);
    text-decoration: none;
    transition: color var(--dt-header-transition), background var(--dt-header-transition);
}

.dt-nav__link:hover,
.dt-nav__link:focus {
    color: var(--dt-header-accent);
}

.dt-nav__link:focus {
    outline: 2px solid var(--dt-header-accent);
    outline-offset: 2px;
}

/* Current page indicator */
.dt-nav__item--current .dt-nav__link {
    color: var(--dt-header-accent);
}

.dt-nav__item--current .dt-nav__link::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    margin-top: 2px;
    background: var(--dt-header-accent);
    border-radius: 1px;
}

/* CTA Button */
.dt-header__cta--desktop {
    display: none;
}

/* Show CTA button on tablets (alongside hamburger menu) */
@media (min-width: 768px) {
    .dt-header__cta--desktop {
        display: block;
    }
}

/* Hide CTA on pricing page */
body.page-id-495 .dt-header__cta--desktop {
    display: none;
}

.dt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--dt-header-font);
    font-size: var(--dt-header-font-size);
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--dt-header-radius-pill);
    cursor: pointer;
    transition: all var(--dt-header-transition);
}

.dt-btn:focus {
    outline: 2px solid var(--dt-header-accent);
    outline-offset: 2px;
}

.dt-btn--primary {
    background: var(--dt-header-accent);
    color: #000 !important;
}

.dt-btn--primary:hover {
    background: var(--dt-header-accent-hover);
    transform: translateY(-1px);
}

.dt-btn--block {
    width: 100%;
}

/* Mobile Menu Toggle */
.dt-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin-right: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--dt-header-radius);
    transition: background var(--dt-header-transition);
    -webkit-tap-highlight-color: transparent;
}

.dt-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dt-menu-toggle:focus {
    outline: 2px solid var(--dt-header-accent);
    outline-offset: 2px;
}

.dt-menu-toggle__icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 22px;
    height: 22px;
}

.dt-menu-toggle__bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--dt-header-text);
    border-radius: 1px;
    transition: transform var(--dt-header-transition), opacity var(--dt-header-transition);
}

/* Hamburger to X animation */
.dt-menu-toggle[aria-expanded="true"] .dt-menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.dt-menu-toggle[aria-expanded="true"] .dt-menu-toggle__bar:nth-child(2) {
    opacity: 0;
}

.dt-menu-toggle[aria-expanded="true"] .dt-menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Menu Dialog */
.dt-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: var(--dt-mobile-menu-z);
    visibility: hidden;
    pointer-events: none;
}

.dt-mobile-menu[aria-hidden="false"] {
    visibility: visible;
    pointer-events: auto;
}

/* Backdrop */
.dt-mobile-menu__backdrop {
    position: absolute;
    inset: 0;
    background: var(--dt-header-overlay);
    opacity: 0;
    transition: opacity 250ms ease;
}

.dt-mobile-menu[aria-hidden="false"] .dt-mobile-menu__backdrop {
    opacity: 1;
}

/* Panel */
.dt-mobile-menu__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 320px;
    height: 100%;
    background: var(--dt-header-bg);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dt-mobile-menu[aria-hidden="false"] .dt-mobile-menu__panel {
    transform: translateX(0);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .dt-mobile-menu__backdrop,
    .dt-mobile-menu__panel,
    .dt-menu-toggle__bar {
        transition: none;
    }
}

/* Mobile Menu Header */
.dt-mobile-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--dt-header-height);
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--dt-header-border);
    flex-shrink: 0;
}

.dt-mobile-menu__logo img {
    height: 28px;
    width: auto;
}

.dt-mobile-menu__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--dt-header-text);
    cursor: pointer;
    border-radius: var(--dt-header-radius);
    transition: background var(--dt-header-transition), color var(--dt-header-transition);
}

.dt-mobile-menu__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--dt-header-accent);
}

.dt-mobile-menu__close:focus {
    outline: 2px solid var(--dt-header-accent);
    outline-offset: 2px;
}

/* Mobile Navigation */
.dt-nav--mobile {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.dt-nav--mobile .dt-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.dt-nav--mobile .dt-nav__link {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 0;
}

.dt-nav--mobile .dt-nav__link:hover,
.dt-nav--mobile .dt-nav__link:focus {
    background: rgba(255, 255, 255, 0.05);
}

.dt-nav--mobile .dt-nav__item--current .dt-nav__link::after {
    display: none;
}

.dt-nav--mobile .dt-nav__item--current .dt-nav__link {
    background: rgba(0, 240, 255, 0.1);
    border-left: 3px solid var(--dt-header-accent);
}

/* User Account Section */
.dt-header__user {
    display: none; /* Hidden on mobile - shown in off-canvas menu */
    align-items: center;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .dt-header__user {
        display: flex;
    }
}

/* Avatar */
.dt-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 2px solid var(--dt-header-accent);
    border-radius: 50%;
    color: var(--dt-header-accent);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background var(--dt-header-transition), color var(--dt-header-transition);
}

.dt-avatar--large {
    width: 56px;
    height: 56px;
    font-size: 1rem;
}

/* User Menu (Desktop Dropdown) */
.dt-user-menu {
    position: relative;
}

.dt-user-menu__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: transform var(--dt-header-transition);
}

.dt-user-menu__trigger:hover .dt-avatar,
.dt-user-menu__trigger:focus .dt-avatar {
    background: rgba(0, 240, 255, 0.1);
}

.dt-user-menu__trigger:focus {
    outline: 2px solid var(--dt-header-accent);
    outline-offset: 4px;
}

.dt-user-menu__trigger[aria-expanded="true"] {
    transform: scale(0.95);
}

/* Dropdown Panel */
.dt-user-menu__dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 200px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 200ms ease, transform 200ms ease, visibility 200ms ease;
    z-index: 100;
    overflow: hidden;
}

.dt-user-menu__dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    transform: rotate(45deg);
    border-radius: 2px;
}

.dt-user-menu[data-open="true"] .dt-user-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Items */
.dt-user-menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #1c1d1f !important;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background var(--dt-header-transition);
    border-bottom: 1px solid #f0f0f0;
}

.dt-user-menu__item span {
    color: #1c1d1f;
}

.dt-user-menu__item:last-child {
    border-bottom: none;
}

.dt-user-menu__item:hover,
.dt-user-menu__item:focus {
    background: #f5f5f5;
    outline: none;
}

.dt-user-menu__item svg {
    color: #666;
    flex-shrink: 0;
}

.dt-user-menu__item:hover svg {
    color: var(--dt-header-accent);
}

.dt-user-menu__item--logout:hover {
    background: #fff5f5;
}

.dt-user-menu__item--logout:hover svg {
    color: #e53e3e;
}

/* Login Button (Secondary Style) */
.dt-btn--secondary {
    background: transparent;
    color: var(--dt-header-text);
    border: 1px solid var(--dt-header-border);
}

.dt-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--dt-header-accent);
    color: var(--dt-header-accent);
}

.dt-btn--login {
    padding: 0.625rem 1.25rem;
}

/* Mobile User Section */
.dt-mobile-menu__user {
    padding: 1.5rem 1.25rem;
    border-top: 1px solid var(--dt-header-border);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dt-mobile-menu__user-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--dt-header-border);
}

.dt-mobile-menu__user-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dt-header-text);
}

.dt-mobile-menu__user-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dt-mobile-menu__user-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.875rem 0.5rem;
    color: var(--dt-header-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--dt-header-radius);
    transition: background var(--dt-header-transition), color var(--dt-header-transition);
}

.dt-mobile-menu__user-link:hover,
.dt-mobile-menu__user-link:focus {
    background: rgba(255, 255, 255, 0.05);
    color: var(--dt-header-accent);
    outline: none;
}

.dt-mobile-menu__user-link svg {
    color: var(--dt-header-text-muted);
    flex-shrink: 0;
}

.dt-mobile-menu__user-link:hover svg {
    color: var(--dt-header-accent);
}

.dt-mobile-menu__user-link--logout:hover {
    color: #fc8181;
}

.dt-mobile-menu__user-link--logout:hover svg {
    color: #fc8181;
}

/* Responsive: Tablet (768px+) */
@media (min-width: 768px) {
    :root {
        --dt-header-height: 80px;
        --dt-header-padding-x: 4%;
    }

    .dt-header__logo-img {
        height: 40px;
    }

    .dt-mobile-menu__panel {
        max-width: 380px;
    }
}

/* Responsive: Desktop (1024px+) */
@media (min-width: 1024px) {
    :root {
        --dt-header-padding-x: 3%;
    }

    /* Show desktop nav, hide mobile toggle */
    .dt-nav--desktop {
        display: flex;
        margin-right: auto;
    }

    .dt-menu-toggle {
        display: none;
    }

    /* Adjust header layout */
    .dt-header__container {
        gap: var(--dt-header-gap);
    }
}

/* Responsive: Large Desktop (1440px+) */
@media (min-width: 1440px) {
    :root {
        --dt-header-padding-x: 2%;
    }

    .dt-nav__link {
        padding: 0.625rem 1.25rem;
    }
}

/* Body scroll lock */
body.dt-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Songs menu link visibility by device */
/* Mobile/Tablet: Show /all-songs/, hide /songs/ */
.dt-nav__item:has(> a[href="/songs/"]) {
    display: none;
}

.dt-nav__item:has(> a[href="/all-songs/"]) {
    display: list-item;
}

/* Desktop: Show /songs/, hide /all-songs/ */
@media (min-width: 1024px) {
    .dt-nav__item:has(> a[href="/songs/"]) {
        display: list-item;
    }

    .dt-nav__item:has(> a[href="/all-songs/"]) {
        display: none;
    }
}

/* Focus visible support */
.dt-header :focus:not(:focus-visible) {
    outline: none;
}

.dt-header :focus-visible {
    outline: 2px solid var(--dt-header-accent);
    outline-offset: 2px;
}
