/**
 * MadlySane Minimal Sticky Header Styles
 * Add this to your theme's style.css or enqueue as a separate stylesheet
 */

/* ============================================
   MINIMAL STICKY HEADER - BASE STYLES
   ============================================ */

.minimal-sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998; /* Below WordPress admin bar (99999) */
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    
    /* Hidden by default - JavaScript will show on scroll */
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
    
    /* Smooth transitions */
    transition: opacity 250ms ease-in-out,
                transform 250ms ease-in-out;
}

/* Account for WordPress admin bar when logged in */
.admin-bar .minimal-sticky-header {
    top: 32px; /* WordPress admin bar height on desktop */
}

/* Admin bar on mobile */
@media screen and (max-width: 782px) {
    .admin-bar .minimal-sticky-header {
        top: 46px; /* WordPress admin bar height on mobile */
    }
}

/* Active state (shown by JavaScript) */
.minimal-sticky-header.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Hidden state (scroll up) */
.minimal-sticky-header.is-hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}


/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.minimal-sticky-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    height: 56px; /* Mobile height */
}

/* Desktop height */
@media (min-width: 768px) {
    .minimal-sticky-container {
        height: 64px;
        padding: 0 24px;
    }
}


/* ============================================
   LOGO
   ============================================ */

.minimal-sticky-logo {
    flex-shrink: 0;
}

.minimal-sticky-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    outline-offset: 4px;
}

.minimal-sticky-logo img {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    transition: transform 150ms ease;
}

@media (min-width: 768px) {
    .minimal-sticky-logo img {
        width: 40px;
        height: 40px;
    }
}

.minimal-sticky-logo a:hover img,
.minimal-sticky-logo a:focus img {
    transform: scale(1.05);
}


/* ============================================
   SUPPORT HUB (CENTER)
   ============================================ */

.minimal-sticky-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 16px;
}

.minimal-sticky-support-hub {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: #4a5568;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 200ms ease,
                transform 150ms ease;
    outline-offset: 4px;
}

@media (min-width: 768px) {
    .minimal-sticky-support-hub {
        padding: 12px 24px;
        font-size: 15px;
    }
}

.minimal-sticky-support-hub:hover,
.minimal-sticky-support-hub:focus {
    background: #2d3748;
    transform: translateY(-1px);
}

.minimal-sticky-support-hub:active {
    transform: translateY(0);
}


/* ============================================
   USER ACTIONS (RIGHT SIDE)
   ============================================ */

.minimal-sticky-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .minimal-sticky-actions {
        gap: 16px;
    }
}


/* ============================================
   ACCOUNT / LOGIN LINK
   ============================================ */

.minimal-sticky-account,
.minimal-sticky-login {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    color: #2d3748;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 150ms ease,
                color 150ms ease;
    outline-offset: 4px;
}

@media (min-width: 768px) {
    .minimal-sticky-account,
    .minimal-sticky-login {
        padding: 10px 16px;
        font-size: 15px;
    }
}

.minimal-sticky-account:hover,
.minimal-sticky-account:focus,
.minimal-sticky-login:hover,
.minimal-sticky-login:focus {
    background: #edf2f7;
    color: #1a202c;
}

/* Hide text on mobile, show icon */
.account-text,
.login-text {
    display: none;
}

@media (min-width: 640px) {
    .account-text,
    .login-text {
        display: inline;
    }
}

.account-icon,
.login-icon {
    display: flex;
    align-items: center;
}

@media (min-width: 640px) {
    .account-icon,
    .login-icon {
        display: none;
    }
}


/* ============================================
   SEARCH TOGGLE BUTTON
   ============================================ */

.minimal-sticky-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #2d3748;
    cursor: pointer;
    transition: background-color 150ms ease,
                border-color 150ms ease,
                color 150ms ease;
    outline-offset: 4px;
}

@media (min-width: 768px) {
    .minimal-sticky-search-toggle {
        width: 44px;
        height: 44px;
    }
}

.minimal-sticky-search-toggle:hover,
.minimal-sticky-search-toggle:focus {
    background: #edf2f7;
    border-color: #cbd5e0;
    color: #1a202c;
}

.minimal-sticky-search-toggle[aria-expanded="true"] {
    background: #4a5568;
    border-color: #4a5568;
    color: #ffffff;
}


/* ============================================
   SEARCH FORM (EXPANDABLE)
   ============================================ */

.minimal-sticky-search-form {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    transition: max-height 250ms ease,
                opacity 250ms ease,
                padding 250ms ease;
}

.minimal-sticky-search-form.is-open {
    max-height: 80px;
    opacity: 1;
    padding: 16px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

.search-field {
    flex: 1;
    padding: 10px 16px;
    font-size: 15px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background: #ffffff;
    transition: border-color 150ms ease,
                box-shadow 150ms ease;
}

.search-field:focus {
    outline: none;
    border-color: #4a5568;
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

.search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: #4a5568;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 150ms ease,
                transform 150ms ease;
}

.search-submit:hover,
.search-submit:focus {
    background: #2d3748;
    transform: scale(1.05);
}


/* ============================================
   ACCESSIBILITY - SKIP TO CONTENT
   ============================================ */

.skip-to-content {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 10000;
    padding: 12px 20px;
    background: #4a5568;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: top 200ms ease;
}

.skip-to-content:focus {
    top: 16px;
    outline: 3px solid #4299e1;
    outline-offset: 2px;
}


/* ============================================
   SCREEN READER TEXT
   ============================================ */

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ============================================
   HIGH CONTRAST MODE SUPPORT
   ============================================ */

@media (prefers-contrast: high) {
    .minimal-sticky-header {
        border-bottom: 2px solid #000000;
    }
    
    .minimal-sticky-support-hub {
        border: 2px solid #000000;
    }
    
    .minimal-sticky-search-toggle,
    .search-field {
        border-width: 2px;
    }
}


/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .minimal-sticky-header,
    .minimal-sticky-logo img,
    .minimal-sticky-support-hub,
    .minimal-sticky-account,
    .minimal-sticky-login,
    .minimal-sticky-search-toggle,
    .minimal-sticky-search-form,
    .search-submit {
        transition: none;
    }
}


/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .minimal-sticky-header {
        display: none;
    }
}