/**
 * PENDU MART – HEADER & NAVIGATION STYLES
 */

/* ==========================================================================
   Top Utility Bar (Row 1)
   ========================================================================== */
.pm-topbar {
    background-color: var(--pm-primary-dark);
    color: #ffffff;
    font-size: 12px;
    padding: 6px 0;
    line-height: 1.4;
}

.pm-topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pm-topbar-features {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.pm-topbar-feature-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #E2E8F0;
    font-weight: 500;
}

.pm-topbar-feature-item svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
    color: #4ADE80;
}

.pm-topbar-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.pm-topbar-links a {
    color: #E2E8F0;
    text-decoration: none;
    transition: color var(--pm-transition-fast);
}

.pm-topbar-links a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* ==========================================================================
   Main Header (Row 2)
   ========================================================================== */
.pm-main-header {
    background: #ffffff;
    padding: 8px 0;
    border-bottom: 1px solid var(--pm-border);
    position: relative;
    z-index: 100;
}

.pm-main-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Brand Logo */
.pm-header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-right: 4px;
}

.pm-header-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.pm-header-logo img {
    height: 70px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
    transition: transform var(--pm-transition-fast);
}

.pm-header-logo a:hover img {
    transform: scale(1.03);
}

/* Delivery Location Picker */
.pm-delivery-location {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--pm-radius-default);
    background-color: var(--pm-light);
    border: 1px solid var(--pm-border);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--pm-transition-fast);
}

.pm-delivery-location:hover {
    border-color: var(--pm-primary);
    background-color: #ffffff;
}

.pm-delivery-icon svg {
    width: 18px;
    height: 18px;
    color: var(--pm-primary);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.pm-delivery-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.pm-delivery-label {
    font-size: 11px;
    color: var(--pm-muted);
    line-height: 1.1;
}

.pm-delivery-pincode {
    font-size: 13px;
    font-weight: 700;
    color: var(--pm-heading);
    line-height: 1.2;
}

/* Large Omnisearch Bar */
.pm-search-container {
    flex: 1;
    max-width: 680px;
    position: relative;
}

.pm-search-form {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--pm-border);
    border-radius: var(--pm-radius-default);
    background-color: #ffffff;
    overflow: hidden;
    transition: border-color var(--pm-transition-fast), box-shadow var(--pm-transition-fast);
}

.pm-search-form:focus-within {
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px rgba(30, 107, 58, 0.15);
}

.pm-search-category {
    background-color: #F3F4F6;
    border: none;
    border-right: 1px solid var(--pm-border);
    padding: 0 10px;
    font-family: var(--pm-font-primary);
    font-size: 13px;
    font-weight: 500;
    color: var(--pm-text);
    outline: none;
    cursor: pointer;
    border-radius: 0;
    max-width: 140px;
    flex: 0 0 135px;
}

.pm-search-input {
    flex: 1;
    border: none;
    padding: 10px 14px;
    font-family: var(--pm-font-primary);
    font-size: 14px;
    color: var(--pm-text);
    outline: none;
    width: auto;
    min-width: 180px;
}

.pm-search-input::placeholder {
    color: var(--pm-muted);
}

.pm-search-submit {
    background-color: var(--pm-primary);
    border: none;
    color: #ffffff;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--pm-transition-fast);
}

.pm-search-submit:hover {
    background-color: var(--pm-primary-dark);
}

.pm-search-submit svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
}

/* Live AJAX Search Results Dropdown */
.pm-live-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--pm-border);
    border-radius: 0 0 var(--pm-radius-default) var(--pm-radius-default);
    box-shadow: var(--pm-shadow-hover);
    margin-top: 4px;
    max-height: 420px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.pm-live-search-results.active {
    display: block;
}

.pm-search-res-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--pm-border-light);
    text-decoration: none;
    color: var(--pm-text);
    transition: background var(--pm-transition-fast);
}

.pm-search-res-item:hover {
    background: var(--pm-light);
}

.pm-search-res-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: var(--pm-radius-sm);
}

.pm-search-res-details {
    flex: 1;
}

.pm-search-res-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--pm-heading);
    margin-bottom: 2px;
}

.pm-search-res-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--pm-primary);
}

/* Right Navigation Actions */
.pm-header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.pm-header-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--pm-heading);
    position: relative;
    cursor: pointer;
}

.pm-action-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.pm-action-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    color: var(--pm-heading);
}

.pm-badge-count {
    position: absolute;
    top: -6px;
    right: -8px;
    background-color: #EF4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    height: 18px;
    min-width: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-sizing: border-box;
}

.pm-action-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.pm-action-label {
    font-size: 11px;
    color: var(--pm-muted);
    line-height: 1.1;
}

.pm-action-sublabel {
    font-size: 13px;
    font-weight: 700;
    color: var(--pm-heading);
    line-height: 1.2;
}

/* Account Header Item & Dropdown */
.pm-header-account-wrap {
    position: relative;
}

.pm-account-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--pm-heading);
}

.pm-account-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 250px;
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
    padding: 12px;
    margin-top: 10px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.pm-header-account-wrap:hover .pm-account-dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.pm-dropdown-user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 12px 8px;
    border-bottom: 1px solid #F1F5F9;
    margin-bottom: 8px;
}

.pm-dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E6B3A 0%, #15803D 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pm-dropdown-user-info strong {
    display: block;
    font-size: 13px;
    color: #0F172A;
    font-weight: 700;
    line-height: 1.2;
}

.pm-dropdown-user-info span {
    display: block;
    font-size: 11px;
    color: #64748B;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.pm-dropdown-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pm-dropdown-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.pm-dropdown-links a:hover {
    background: #F8FAFC;
    color: #1E6B3A;
    transform: translateX(2px);
}

.pm-dropdown-divider {
    height: 1px;
    background: #F1F5F9;
    margin: 6px 0;
}

.pm-dropdown-links a.pm-logout-link:hover {
    background: #FEF2F2;
    color: #DC2626;
}

/* ==========================================================================
   Navigation Bar (Row 3)
   ========================================================================== */
.pm-nav-bar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--pm-border);
    box-shadow: var(--pm-shadow-light);
}

.pm-nav-inner {
    display: flex;
    align-items: center;
    height: 44px;
}

.pm-categories-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--pm-heading);
    padding: 10px 16px;
    background-color: #F8FAFC;
    border-right: 1px solid var(--pm-border);
    cursor: pointer;
    height: 100%;
    box-sizing: border-box;
}

.pm-categories-btn:hover {
    background-color: var(--pm-primary-light);
    color: var(--pm-primary);
}

.pm-nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0 16px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.pm-nav-links::-webkit-scrollbar {
    display: none;
}

.pm-nav-links li a {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--pm-text);
    text-decoration: none;
    padding: 12px 2px;
    border-bottom: 2px solid transparent;
    transition: all var(--pm-transition-fast);
}

.pm-nav-links li a:hover,
.pm-nav-links li.active a {
    color: var(--pm-primary);
    border-bottom-color: var(--pm-primary);
}

.pm-nav-highlight a {
    color: var(--pm-accent) !important;
    font-weight: 700 !important;
}

/* ==========================================================================
   Mobile Sticky Bottom Navigation
   ========================================================================== */
.pm-mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #E2E8F0;
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.05);
    z-index: 99999;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(56px + env(safe-area-inset-bottom, 0px));
}

.pm-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    position: relative;
    padding: 4px 10px;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex: 1;
}

.pm-nav-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
}

.pm-nav-icon-wrap svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: transform 0.15s ease;
}

.pm-mobile-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: #E11D48;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    min-width: 17px;
    height: 17px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(225, 29, 72, 0.4);
    border: 1.5px solid #ffffff;
}

.pm-mobile-nav-item:active {
    transform: scale(0.92);
}

.pm-mobile-nav-item.active {
    color: #E11D48;
    font-weight: 700;
}

.pm-mobile-nav-item.active .pm-nav-icon-wrap svg {
    stroke: #E11D48;
    stroke-width: 2.2;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
    .pm-topbar {
        display: none;
    }

    .pm-delivery-location {
        display: none;
    }

    .pm-header-action-item .pm-action-text {
        display: none;
    }

    .pm-nav-bar {
        display: none;
    }

    .pm-mobile-bottom-nav {
        display: flex;
    }

    body {
        padding-bottom: 68px;
    }
}

@media (max-width: 640px) {
    .pm-main-header {
        padding: 10px 0;
    }

    .pm-main-header-inner {
        flex-wrap: wrap;
        gap: 10px;
    }

    .pm-header-logo img {
        height: 38px;
        max-width: 140px;
    }

    .pm-header-actions {
        gap: 10px;
    }

    /* Hide language dropdown on mobile to save space */
    .pm-header-actions > .pm-header-action-item:first-child {
        display: none;
    }

    .pm-search-container {
        order: 3;
        max-width: 100%;
        width: 100%;
        margin-top: 4px;
    }

    .pm-search-category {
        display: none;
    }

    .pm-search-input {
        font-size: 13px !important;
        padding-left: 14px !important;
    }
}
