/**
 * JA Header Styles v2.0.1
 * Author: Md. Joynal Abedin
 * URI: https://facebook.com/joynalar69
 */

:root {
    --ja-header-height: 60px;
    --ja-header-speed: 300ms;
    --ja-header-z-index: 99999;
}

/* Main header bar */
.ja-header-bar {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    z-index: var(--ja-header-z-index);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
    will-change: transform, opacity;
}

/* Sticky version */
.ja-header-bar.ja-sticky {
    position: fixed;
}

/* Static version */
.ja-header-bar.ja-static {
    position: relative;
}

/* Container - FIXED: Better flexbox */
.ja-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    height: var(--ja-header-height);
    box-sizing: border-box;
}

/* Left section */
.ja-header-left {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
}

.ja-address {
    font-size: 15px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Right section */
.ja-header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
}

/* ======== ANIMATION TYPES ======== */

/* SLIDE Animation */
.ja-animation-slide.ja-sticky {
    transition-property: transform, opacity;
    transition-timing-function: ease-in-out;
}

.ja-animation-slide.header-hidden {
    transform: translateY(-100%);
}

/* FADE Animation */
.ja-animation-fade.ja-sticky {
    transition-property: opacity, transform;
    transition-timing-function: ease-in-out;
}

.ja-animation-fade.header-hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* NO Animation */
.ja-animation-none.header-hidden {
    display: none !important;
}

/* ======== BEHAVIOR TYPES ======== */

/* Always visible - no hiding */
.ja-behavior-always .ja-header-bar,
.ja-behavior-always.ja-header-bar {
    transform: none !important;
    opacity: 1 !important;
    display: block !important;
}

/* Always hidden */
.ja-behavior-hide .ja-header-bar,
.ja-behavior-hide.ja-header-bar {
    display: none !important;
}

/* ======== SEARCH FORM STYLING - FIXED ======== */
.ja-header-search {
    display: flex;
    align-items: center;
}

.ja-header-search .search-form {
    display: flex !important;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

.ja-header-search .search-field {
    width: 200px;
    max-width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
    background: #fff;
    margin: 0 !important;
    box-shadow: none !important;
}

.ja-header-search .search-submit {
    height: 36px;
    padding: 0 15px;
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
    border-left: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    margin: 0 !important;
    line-height: 36px;
    color: inherit;
}

.ja-header-search .search-submit:hover {
    background: rgba(0,0,0,0.1);
}

/* Placeholder - FIXED: Dynamic height */
#ja-header-placeholder {
    width: 100%;
    height: var(--ja-header-height, 60px);
    display: none;
}

.ja-sticky + #ja-header-placeholder {
    display: block !important;
}

/* Admin bar adjustment - FIXED */
.admin-bar .ja-header-bar.ja-sticky {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .ja-header-bar.ja-sticky {
        top: 46px;
    }
}

/* RTL Support - NEW */
.rtl .ja-header-container {
    flex-direction: row-reverse;
}

.rtl .ja-header-left {
    order: 2;
}

.rtl .ja-header-right {
    order: 1;
}

.rtl .ja-header-search .search-field {
    border-radius: 0 4px 4px 0;
    border-left: 1px solid rgba(0,0,0,0.1);
    border-right: none;
}

.rtl .ja-header-search .search-submit {
    border-radius: 4px 0 0 4px;
    border-right: 1px solid rgba(0,0,0,0.1);
    border-left: none;
}

/* Responsive - FIXED */
@media screen and (max-width: 768px) {
    :root {
        --ja-header-height: auto;
    }
    
    .ja-header-container {
        flex-direction: column;
        height: auto;
        padding: 12px 15px;
        gap: 10px;
    }
    
    .ja-header-left,
    .ja-header-right {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .ja-header-left {
        margin-bottom: 5px;
    }
    
    .ja-address {
        white-space: normal;
        text-align: center;
    }
    
    .ja-header-right {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .ja-header-search {
        width: 100%;
        justify-content: center;
    }
    
    .ja-header-search .search-form {
        width: 100%;
        max-width: 300px;
    }
    
    .ja-header-search .search-field {
        width: 100%;
    }
    
    #ja-header-placeholder {
        height: auto;
    }
}

@media screen and (max-width: 480px) {
    .ja-header-right {
        flex-direction: column;
    }
    
    .ja-header-search .search-form {
        max-width: 100%;
    }
}

/* Print styles */
@media print {
    .ja-header-bar,
    #ja-header-placeholder {
        display: none !important;
    }
}