/* ===== PREMIUM DESIGN SYSTEM ===== */
:root {
    --pink: #FF4D8F;
    --pink-light: #FFE0EE;
    --pink-soft: #FFF0F6;
    --blue: #2563EB;
    --blue-light: #DBEAFE;
    --blue-soft: #EFF6FF;
    --red: #EF233C;
    --red-light: #FFE4E8;
    --white: #FFFFFF;
    --black: #0F0F0F;
    --gray-50: #FAFAFA;
    --gray-100: #F4F4F5;
    --gray-200: #E4E4E7;
    --gray-400: #A1A1AA;
    --gray-600: #52525B;
    --gray-800: #27272A;
    --primary: var(--black);
    --accent: var(--pink);
    --bg: #F5F5F6;
    --text-main: var(--black);
    --text-muted: var(--gray-600);
    --border-light: var(--gray-200);
    --shadow-premium: 0 4px 16px rgba(0,0,0,0.08);
}

/* Global Reset & Interaction Fixes */
* { box-sizing: border-box; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; outline: none; }
input, textarea { -webkit-tap-highlight-color: rgba(0,0,0,0.1); user-select: text; -webkit-user-select: text; }
#wpadminbar, header, .site-header { display:none !important; }
html { margin-top:0 !important; }

body { 
    margin:0; background:var(--bg); font-family: 'Plus Jakarta Sans', sans-serif; 
    color:var(--text-main); -webkit-font-smoothing: antialiased; overflow-x: hidden; 
}

/* UI Components */
.pill-btn {
    padding: 12px 20px; border-radius: 14px; border: 1px solid var(--border-light);
    background: #F8F9FA; font-size: 13px; font-weight: 700; 
    cursor: pointer; color: var(--text-muted) !important; transition: 0.3s;
}
.pill-btn.active { background: var(--primary); color: var(--white) !important; border-color: var(--primary); }

.primary-btn {
    padding: 16px 28px; border-radius: 16px; background: linear-gradient(135deg,#1A1C1E,#2c2f33);
    color: #fff; border: none; font-size: 16px; font-weight: 800; cursor: pointer; transition: 0.2s;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); width: 100%;
}
.primary-btn:active { transform: scale(0.97); opacity: 0.9; }

#globalSearch {
    background: #f1f3f5; border: none; border-radius: 15px; padding: 12px 20px; font-size: 14px; font-weight: 500; width: 100%;
}
#globalSearch:focus { background: #fff; box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2); }

/* Modal Styling Migrated from Checkout */
.df-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 20px; z-index: 10000; animation: fadeIn 0.25s ease; }






/* ============================================================
   ADDRESS MODULE STYLES
   Scope: everything prefixed with #addressModal or .addr-*
   ============================================================ */

/* --- SPA Full Page Overlay --- */
#addressModal, .addr-list-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: #fff;
    z-index: 10000;
    animation: addr-fadeIn 0.2s ease-out;
}
@keyframes addr-fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Fix Google Places Live Search hidden behind modal */
.pac-container {
    z-index: 999999 !important;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    border: 1px solid #f0f0f0;
    margin-top: 4px;
}

/* --- Map Full Page Container --- */
#addressModal .addr-card-wrap {
    width: 100vw;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    position: relative;
}

/* --- List Modal Card --- */
.addr-list-card-wrap {
    width: 100%;
    max-width: 540px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
    animation: addr-popIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes addr-popIn {
    from { opacity: 0; transform: scale(0.96) translateY(30px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 600px) {
    #addressModal, .addr-list-modal {
        align-items: flex-end;
        padding: 0;
    }
    #addressModal .addr-card-wrap {
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        animation: none;
    }
    .addr-list-card-wrap {
        max-width: 100%;
        height: 85dvh;
        max-height: 85dvh;
        border-radius: 32px 32px 0 0;
        animation: addr-slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes addr-slideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
}

/* ---- MAP SECTION ---- */
.addr-map-section {
    position: relative;
    height: 46%;
    flex-shrink: 0;
    background: #dde1e7;
}
@media (max-width: 600px) {
    .addr-map-section { height: 42%; }
}

/* The actual Google Map div */
.addr-map-section #map {
    width: 100%;
    height: 100%;
    display: block;
}

/* Gradient overlay — floats back/title/search above map */
.addr-map-overlay {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 14px 16px 48px;
    background: linear-gradient(180deg, rgba(0,0,0,0.58) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
    pointer-events: none; /* pass-through so map stays draggable */
}
.addr-map-overlay > * { pointer-events: auto; }

.addr-top-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.addr-back-btn {
    width: 38px; height: 38px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: #111;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    transition: transform 0.15s;
}
.addr-back-btn:hover { transform: scale(1.07); }

.addr-modal-title {
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

/* Search bar floating above map */
.addr-search-wrap { position: relative; }
.addr-search-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    pointer-events: none;
}
.addr-search-wrap input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #111;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}
.addr-search-wrap input:focus {
    border-color: #E23744 !important;
    background: #fff !important;
    box-shadow: 0 4px 16px rgba(226, 55, 68, 0.15) !important;
}

/* Center pin */
.addr-pin-wrap {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -100%);
    pointer-events: none;
    z-index: 8;
    text-align: center;
}
.addr-pin-label {
    display: inline-block;
    background: #111;
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
    margin-bottom: 6px;
    white-space: nowrap;
}
.addr-pin-img {
    width: 38px;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
.addr-pin-dot {
    width: 8px; height: 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 50%;
    margin: 2px auto 0;
}

/* GPS button */
.addr-gps-btn {
    position: absolute;
    bottom: 40px; right: 16px;
    background: #fff;
    border: none;
    width: 50px; height: 50px;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    font-size: 22px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
}
.addr-gps-btn:hover { 
    transform: scale(1.1); 
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

/* ---- BOTTOM SHEET PANEL ---- */
.addr-bottom-panel {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    padding: 20px 24px 32px;
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 5;
}
/* Drag handle */
.addr-drag-handle {
    width: 40px; height: 5px;
    background: #e4e4e4;
    border-radius: 10px;
    margin: 0 auto 24px;
    flex-shrink: 0;
}

/* Detected location row */
.addr-loc-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding: 14px;
    background: #fafafa;
    border-radius: 16px;
    border: 1px solid #f0f0f0;
}
.addr-loc-icon {
    width: 42px; height: 42px;
    background: #fff0f1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.addr-loc-area-name {
    font-size: 16px;
    font-weight: 800;
    color: #111;
    display: block;
    margin-bottom: 3px;
}
.addr-loc-full-addr {
    font-size: 12px;
    color: #888;
    line-height: 1.5;
    display: block;
}

/* Flat/building input */
.addr-flat-input {
    width: 100%;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1.5px solid #ebebeb;
    background: #fbfbfb;
    font-size: 15px;
    font-weight: 700;
    color: #111;
    outline: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 24px;
    font-family: inherit;
    box-sizing: border-box;
}
.addr-flat-input:focus {
    border-color: #111;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.addr-flat-input::placeholder { color: #aaa; font-weight: 500; }

/* Save-as type selector */
.addr-type-label {
    font-size: 12px;
    font-weight: 800;
    color: #999;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 12px;
}
.addr-type-group {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}
.addr-type-btn {
    flex: 1;
    padding: 14px 10px;
    border-radius: 16px;
    border: 1.5px solid #e8e8e8;
    background: #f8f9fa;
    font-size: 14px;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}
.addr-type-btn.active {
    background: #111;
    color: #fff;
    border-color: #111;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}
.addr-type-btn:not(.active):hover {
    border-color: #ccc;
    background: #fff;
    transform: translateY(-1px);
}

/* Confirm button */
.addr-confirm-btn {
    width: 100%;
    padding: 18px;
    border-radius: 18px;
    border: none;
    background: #E23744;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(226, 55, 68, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: auto;
    font-family: inherit;
}
.addr-confirm-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(226, 55, 68, 0.4);
}
.addr-confirm-btn:active { transform: scale(0.96); }

/* --- Address Page Specific --- */
.df-address-page {
    background: #f8f9fa;
    min-height: 100vh;
    padding-bottom: 100px; /* space for FAB */
}

.df-address-page .addr-page-header {
    background: #fff;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 16px;
}

.df-address-page .addr-page-back {
    font-size: 24px;
    color: #111;
    text-decoration: none;
}

.df-address-page .addr-page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.df-address-page .addr-list-container {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* FAB for adding address on page */
.addr-fab {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #E23744;
    color: #fff;
    border: none;
    padding: 16px 32px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(226, 55, 68, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 40;
    white-space: nowrap;
    transition: transform 0.2s;
}
.addr-fab:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 12px 28px rgba(226, 55, 68, 0.4);
}

/* ===== GLOBAL PRODUCT & ACCOUNT MODALS STYLING ===== */
.modal-sheet {
    background: var(--white);
    border-radius: 28px;
    padding: 24px;
    width: 90%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    animation: modalSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255,255,255,0.1);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-head h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.selector-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    margin-top: 20px;
}

.option-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.price-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.final-total {
    font-size: 24px;
    font-weight: 900;
    color: var(--primary);
    margin-top: 4px;
}

.popup-qty {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #F8F9FA;
    padding: 8px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
}

.popup-qty button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.popup-qty button:active {
    transform: scale(0.9);
}

.popup-qty span {
    font-size: 15px;
    font-weight: 800;
    min-width: 20px;
    text-align: center;
    color: var(--primary);
}

/* ============================================================
   GLOBAL DYNAMIC LOADERS
   ============================================================ */

/* Top Progress Loading Bar (YouTube/GitHub Style) */
.global-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, #3b82f6 50%, var(--accent) 100%);
    background-size: 200% 100%;
    z-index: 200000;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.2s;
    opacity: 0;
    pointer-events: none;
    animation: loading-bar-shift 2s infinite linear;
}
.global-progress-bar.active {
    opacity: 1;
    transform: scaleX(0.85);
}
.global-progress-bar.done {
    opacity: 0;
    transform: scaleX(1);
    transition: transform 0.2s ease-out, opacity 0.2s 0.2s;
}
@keyframes loading-bar-shift {
    0% { background-position: 0% 0%; }
    100% { background-position: -200% 0%; }
}

/* Minimalist Glassmorphic Loading Overlay */
.global-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 199999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.global-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.global-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3.5px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: global-spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.global-loading-text {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.2px;
}
@keyframes global-spin {
    to { transform: rotate(360deg); }
}

/* Mobile navigation styles have been moved to core/components/mobile_nav.php */

