/* ============================================
   MOBILE HEADER - iFruut Style
   Premium search bar + saved address display
   ============================================ */

/* Mobile Header Container - Only visible on mobile */
.amazon-mobile-header {
    display: none;
    background: linear-gradient(90deg, #6ab04c 0%, #8bc34a 25%, #6ab04c 50%, #8bc34a 75%, #6ab04c 100%);
    padding: 12px 16px 10px;
    /* Safe area for iOS notch/status bar - 54px default for Dynamic Island iPhones */
    padding-top: calc(env(safe-area-inset-top, 54px) + 12px);
    padding-top: calc(constant(safe-area-inset-top) + 12px);
    /* iOS 11.0-11.2 */
    padding-top: calc(env(safe-area-inset-top) + 12px);
    /* iOS 11.2+ */
    width: 100%;
    border-bottom: none;
    box-shadow: 0 4px 20px rgba(106, 176, 76, 0.4);
}

@media (max-width: 991.98px) {
    .amazon-mobile-header {
        display: block;
    }

    /* Hide the regular logo on mobile */
    .navbar-brand.desktop-logo {
        display: none !important;
    }
}

/* Search Bar Container */
.amazon-search-container {
    position: relative;
    width: 100%;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.amazon-back-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    color: #ffffff;
    font-size: 20px;
    text-decoration: none;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.amazon-back-arrow:hover {
    opacity: 0.7;
}

.amazon-search-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.amazon-search-wrapper:focus-within {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.amazon-search-icon {
    padding: 12px 12px 12px 16px;
    color: #7d9d43;
    font-size: 16px;
}

.amazon-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 16px 14px 8px;
    font-size: 15px;
    background: transparent;
    color: #333;
}

.amazon-search-input::placeholder {
    color: #9e9e9e;
    font-weight: 400;
}

/* Address/Location Bar */
.amazon-location-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.amazon-location-bar:hover {
    opacity: 0.9;
}

.amazon-location-icon {
    color: #ffffff;
    font-size: 14px;
}

.amazon-location-text {
    font-size: 13px;
    color: #ffffff;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.amazon-location-text .address-label {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amazon-location-chevron {
    font-size: 10px;
    color: #ffffff;
    margin-left: 2px;
}

/* Search Suggestions Dropdown */
.amazon-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.amazon-search-suggestions.active {
    display: block;
}

.amazon-suggestion-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
}

.amazon-suggestion-item:last-child {
    border-bottom: none;
}

.amazon-suggestion-item:hover {
    background: #f8faf6;
}

.amazon-suggestion-item i {
    color: #7d9d43;
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.amazon-suggestion-item span {
    color: #333;
    font-size: 14px;
}

.amazon-suggestion-item .highlight {
    font-weight: 600;
    color: #7d9d43;
}

/* Address Selection Modal */
.address-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10040;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.address-selection-overlay.active {
    display: flex;
}

/* On mobile, shift the overlay bottom to sit above the bottom nav bar */
@media (max-width: 768px) {
    .address-selection-overlay {
        bottom: calc(65px + env(safe-area-inset-bottom));
    }
}

.address-selection-modal {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    padding-bottom: 40px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

#addressListContainer {
    max-height: 52vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.address-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.address-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.address-modal-subtitle {
    font-size: 13px;
    color: #777;
    margin: 4px 0 0 0;
    line-height: 1.4;
}

.address-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.address-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.address-list-item:hover {
    border-color: #7d9d43;
    background: #f8faf6;
}

.address-list-item.selected {
    border-color: #7d9d43;
    background: #f8faf6;
}

.address-list-item .address-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #d0d0d0;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.address-list-item.selected .address-radio {
    border-color: #7d9d43;
}

.address-list-item.selected .address-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #7d9d43;
    border-radius: 50%;
}

.address-list-item .address-details {
    flex: 1;
}

.address-list-item .address-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.address-list-item .address-text {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.add-address-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: #f0f0f0;
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.add-address-btn:hover {
    border-color: #7d9d43;
    color: #7d9d43;
    background: #f8faf6;
}

.address-delete-btn {
    background: none;
    border: none;
    color: #d1d5db;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
}

.address-delete-btn:hover,
.address-delete-btn:active {
    color: #ef4444;
    background: #fef2f2;
}

/* No addresses state */
.no-addresses-state {
    text-align: center;
    padding: 30px 20px;
}

.no-addresses-state i {
    font-size: 48px;
    color: #7d9d43;
    margin-bottom: 16px;
}

.no-addresses-state p {
    color: #666;
    margin-bottom: 20px;
}

/* Desktop: Keep regular navbar visible */
@media (min-width: 992px) {
    .amazon-mobile-header {
        display: none !important;
    }

    .navbar-brand.desktop-logo {
        display: flex !important;
    }
}

/* Adjust body padding for mobile header */
@media (max-width: 991.98px) {

    /* Reset body padding — spacer div handles the offset */
    body {
        padding-top: 0 !important;
    }

    /* Make header sticky/fixed at top */
    .amazon-mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1040;
    }

    /* Hide the regular fixed-top navbar on mobile */
    .container-fluid.fixed-top {
        display: none !important;
    }

    /* Move promo banner after the amazon header */
    .promo-banner-container {
        margin-top: 0 !important;
    }
}

/* ── Add Address Panel form styles ── */
.aa-form-group {
    margin-bottom: 14px;
}

.aa-form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #3a8a20;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aa-form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    background: white;
    color: #1f2937;
    -webkit-appearance: none;
    appearance: none;
}

.aa-form-control:focus {
    border-color: #6ab04c;
    box-shadow: 0 0 0 3px rgba(106, 176, 76, 0.18);
}

.aa-form-control[readonly] {
    background: #f9fafb;
    color: #6b7280;
}

.aa-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.aa-card {
    background: white;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    margin-bottom: 12px;
}

.aa-card-title {
    font-size: 11px;
    font-weight: 700;
    color: #6ab04c;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.aa-save-btn {
    width: 100%;
    margin-top: 8px;
    padding: 17px;
    background: linear-gradient(135deg, #6ab04c 0%, #8bc34a 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.2px;
    box-shadow: 0 4px 14px rgba(106, 176, 76, 0.45);
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}

.aa-save-btn:active {
    opacity: 0.85;
}

/* Override panel header for Nueva Dirección to use vibrant green */
#addAddressPanel .mobile-panel-header {
    background: linear-gradient(135deg, #6ab04c 0%, #8bc34a 100%);
}

/* Custom map marker (Mapbox draggable pin) */
.custom-marker {
    width: 40px;
    height: 40px;
    background-color: #10b981;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
}

.custom-marker::after {
    content: '';
    width: 12px;
    height: 12px;
    background-color: white;
    border-radius: 50%;
}