/* customer/assets/css/customer.css */

/* ============================================================
   ROOT / RESET
   ============================================================ */
:root{
    --primary:#8B0000;
    --primary-dark:#6B0000;
    --accent:#FFD700;
    --text:#333;
    --text-light:#666;
    --muted:#999;
    --bg:#f5f5f5;
    --white:#fff;
    --green:#4CAF50;
    --red:#e74c3c;
    --orange:#f39c12;
    --border:#f0f0f0;
}

*{
    box-sizing:border-box;
    margin:0;
    padding:0;
    -webkit-tap-highlight-color:transparent;
}

html,body{
    font-family:'Poppins',-apple-system,BlinkMacSystemFont,sans-serif;
    background:var(--bg);
    color:var(--text);
    min-height:100vh;
    overscroll-behavior-y:contain;
    -webkit-font-smoothing:antialiased;
}

img{max-width:100%;display:block}
a{text-decoration:none;color:inherit}
button,input,select,textarea{font-family:inherit;font-size:15px}

body.menu-open{overflow:hidden}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell{
    max-width:640px;
    margin:0 auto;
    min-height:100vh;
    display:flex;
    flex-direction:column;
    background:var(--bg);
    padding-bottom:108px;
}

.app-main{
    flex:1;
    padding-bottom:108px;
}

/* ============================================================
   TALLER HEADER
   ============================================================ */
.app-header{
    background:var(--primary);
    color:#fff;

    /* Taller header + more breathing room */
    padding: calc(env(safe-area-inset-top, 0px) + 13px) 13px 13px;

    border-bottom-left-radius:15px;
    border-bottom-right-radius:20px;
    position:sticky;
    top:0;
    z-index:100;
    box-shadow:0 3px 14px rgba(0,0,0,.14);
}

.app-header-inner{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;

    /* Taller inner area */
    min-height:40px;
}

.hdr-title{
    font-size:18px;
    font-weight:700;
    text-align:center;
    flex:1;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    line-height:1.3;
}

.hdr-btn{
    width:40px;
    height:40px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:11px;
    color:#fff;
    background:rgba(255,255,255,.14);
    transition:background .2s;
    border:none;
    cursor:pointer;
    flex-shrink:0;
    position:relative;
}

.hdr-btn:hover,
.hdr-btn:active{background:rgba(255,255,255,.28)}

.hdr-btn i{font-size:18px}

.hdr-btn-placeholder{
    width:40px;
    flex-shrink:0;
}

.profile-avatar-btn img{
    width:34px;
    height:34px;
    border-radius:50%;
    border:2px solid var(--accent);
    object-fit:cover;
}

.cart-btn{position:relative}

.hdr-cart-badge{
    position:absolute;
    top:-4px;
    right:-4px;
    background:var(--accent);
    color:var(--primary);
    min-width:18px;
    height:18px;
    padding:0 4px;
    font-size:10px;
    font-weight:800;
    border-radius:10px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1.5px solid var(--primary);
}

/* ============================================================
   SIDE MENU DRAWER
   ============================================================ */
.side-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.5);
    opacity:0;
    visibility:hidden;
    transition:.25s;
    z-index:400;
}

.side-overlay.open{
    opacity:1;
    visibility:visible;
}

.side-menu{
    position:fixed;
    top:0;
    left:0;
    width:280px;
    max-width:85vw;
    height:100vh;
    background:#fff;
    transform:translateX(-100%);
    transition:transform .28s cubic-bezier(.4,0,.2,1);
    z-index:500;
    display:flex;
    flex-direction:column;
    padding-top:calc(env(safe-area-inset-top, 0px) + 8px);
    padding-bottom:calc(env(safe-area-inset-bottom, 0px) + 8px);
    box-shadow:4px 0 24px rgba(0,0,0,.15);
    overflow-y:auto;
}

.side-menu.open{transform:translateX(0)}

.side-menu-head{
    display:flex;
    align-items:center;
    gap:12px;
    padding:16px 18px 18px;
    background:var(--primary);
    color:#fff;
    border-bottom-right-radius:24px;
    margin-bottom:8px;
}

.side-avatar{
    width:52px;
    height:52px;
    border-radius:50%;
    background:rgba(255,255,255,.2);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    overflow:hidden;
    flex-shrink:0;
    border:2px solid rgba(255,255,255,.35);
}

.side-avatar img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.side-user{min-width:0;flex:1}

.side-user-name{
    font-size:15px;
    font-weight:700;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.side-user-email{
    font-size:12px;
    opacity:.85;
    margin-top:2px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.side-nav{
    display:flex;
    flex-direction:column;
    padding:6px 10px;
    flex:1;
}

.side-link{
    display:flex;
    align-items:center;
    gap:14px;
    padding:12px 14px;
    border-radius:10px;
    color:#333;
    font-size:14px;
    font-weight:500;
    transition:background .15s,color .15s;
    text-decoration:none;
    position:relative;
}

.side-link i{
    width:20px;
    text-align:center;
    font-size:16px;
    color:var(--primary);
    flex-shrink:0;
}

.side-link:hover,
.side-link:active{background:#f5f5f5}

.side-link.active{
    background:#fff0f0;
    color:var(--primary);
    font-weight:700;
}

.side-link.active i{color:var(--primary)}

.side-badge{
    margin-left:auto;
    background:var(--primary);
    color:#fff;
    min-width:20px;
    height:20px;
    padding:0 6px;
    border-radius:10px;
    font-size:10px;
    font-weight:700;
    display:flex;
    align-items:center;
    justify-content:center;
}

.side-divider{
    height:1px;
    background:#f0f0f0;
    margin:6px 10px;
}

.side-logout,
.side-logout i{color:var(--red)}

.side-login i,
.side-register i{color:var(--primary)}

.side-menu-foot{
    padding:14px 20px 6px;
    text-align:center;
    font-size:11px;
    color:var(--muted);
    border-top:1px solid #f5f5f5;
}

.side-menu-foot div{
    font-weight:700;
    color:var(--primary);
    font-size:12px;
}

/* ============================================================
   PULL-TO-REFRESH
   ============================================================ */
.pull-refresh{
    position:fixed;
    top:0;
    left:0;
    right:0;
    height:0;
    background:var(--primary);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
    z-index:99;
    transition:height .25s ease;
    pointer-events:none;
    box-shadow:0 2px 8px rgba(0,0,0,.15);
}

.pull-refresh.visible{height:60px;}

.pull-refresh-inner{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    font-size:13px;
    font-weight:600;
    color:#fff;
    opacity:1;
    line-height:1;
}

.pull-refresh-spinner{
    width:20px;
    height:20px;
    border:2.5px solid rgba(255,255,255,.3);
    border-top-color:#fff;
    border-radius:50%;
    display:block;
    flex-shrink:0;
    animation: pullSpin .8s linear infinite;
    animation-play-state: paused;
}

.pull-refresh.visible .pull-refresh-spinner{animation-play-state: running;}
.pull-refresh.ready .pull-refresh-spinner{animation-duration: .5s;}
.pull-refresh.refreshing .pull-refresh-spinner{
    animation-duration: .6s;
    border-top-color:#fff;
    opacity:1;
}

@keyframes pullSpin{
    to{ transform:rotate(360deg); }
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash{
    margin:12px 16px 0;
    padding:12px 16px;
    border-radius:10px;
    font-size:14px;
    display:flex;
    align-items:center;
    gap:10px;
}

.flash-success{
    background:#e8f5e9;
    color:#2e7d32;
    border-left:4px solid var(--green);
}

.flash-error{
    background:#ffebee;
    color:#c62828;
    border-left:4px solid var(--red);
}

.flash-info{
    background:#e3f2fd;
    color:#1565c0;
    border-left:4px solid #2196F3;
}

/* ============================================================
   FLOATING BOTTOM TAB BAR
   ============================================================ */

.tab-bar {
    position: fixed;

    left: 16px;
    right: 16px;
    bottom: 16px;

    height: 76px;

    display: flex;
    align-items: center;
    justify-content: space-around;

    background: #ffffff;

    border-radius: 30px;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.12),
        0 3px 10px rgba(139, 0, 0, 0.08);

    border: 1px solid rgba(139, 0, 0, 0.06);

    z-index: 9999;

    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));

    max-width: 600px;
    margin-left: auto;
    margin-right: auto;

    overflow: visible;
}

.tab-item {
    position: relative;

    flex: 1;
    height: 62px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 3px;

    color: #999999;

    text-decoration: none;

    border-radius: 22px;

    transition:
        color 0.2s ease,
        transform 0.2s ease,
        background 0.2s ease;

    touch-action: manipulation;
}

.tab-item i {
    font-size: 21px;
    line-height: 1;
    color: inherit;

    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.tab-item span {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    color: inherit;
}

.tab-item.active {
    color: #8B0000;
    font-weight: 600;
    background: #fff4f4;
}

.tab-item.active i {
    color: #8B0000;
    transform: translateY(-1px);
}

.tab-item.active span {
    color: #8B0000;
}

.tab-item.active::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 26px;
    height: 3px;
    background: #8B0000;
    border-radius: 10px;
    transform: translateX(-50%);
}

.tab-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 24px);

    min-width: 18px;
    height: 18px;

    padding: 0 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #D71920;
    color: #ffffff;

    font-size: 9px;
    font-weight: 700;
    line-height: 1;

    border-radius: 50px;
    border: 2px solid #ffffff;

    box-shadow: 0 2px 6px rgba(215, 25, 32, 0.35);

    z-index: 2;
}

.tab-item:active {
    transform: scale(0.94);
}

main {
    padding-bottom: 108px;
}

/* ============================================================
   MOBILE — Android phones (≤ 480px)
   ============================================================ */

@media (max-width: 480px) {

    .tab-bar {
        left: 14px;
        right: 14px;
        bottom: 14px;

        height: 72px;

        border-radius: 28px;

        padding: 5px 6px;
        padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px));
    }

    .tab-item {
        height: 60px;
        border-radius: 20px;
    }

    .tab-item i {
        font-size: 20px;
    }

    .tab-item span {
        font-size: 10px;
    }

    .tab-badge {
        top: 4px;
        right: calc(50% - 22px);
    }
}

@media (max-width: 360px) {

    .tab-bar {
        left: 10px;
        right: 10px;
        bottom: 10px;

        height: 70px;

        border-radius: 26px;
    }

    .tab-item {
        height: 58px;
    }

    .tab-item span {
        font-size: 9px;
    }

    .tab-item i {
        font-size: 18px;
    }
}

/* ============================================================
   CARDS / SECTIONS
   ============================================================ */
.card{
    background:#fff;
    border-radius:14px;
    margin:12px 16px;
    padding:16px;
    box-shadow:0 3px 10px rgba(0,0,0,.06);
}

.section-title{
    font-size:16px;
    font-weight:700;
    color:var(--text);
    margin-bottom:10px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:12px 20px;
    border-radius:10px;
    border:none;
    font-size:15px;
    font-weight:600;
    cursor:pointer;
    transition:transform .15s,box-shadow .15s;
    text-decoration:none;
}

.btn-primary{background:var(--primary);color:#fff}
.btn-primary:hover{background:var(--primary-dark);transform:translateY(-1px)}
.btn-primary:disabled{background:#ccc;cursor:not-allowed;transform:none}
.btn-block{width:100%}
.btn-outline{background:#fff;color:var(--primary);border:1.5px solid var(--primary)}
.btn-danger{background:var(--red);color:#fff}

/* ============================================================
   INPUTS
   ============================================================ */
.input,
select.input,
textarea.input{
    width:100%;
    padding:13px 14px;
    border:1.5px solid #e0e0e0;
    border-radius:10px;
    background:#f9f9f9;
    font-size:15px;
    outline:none;
    transition:border-color .2s;
}

.input:focus{
    border-color:var(--primary);
    background:#fff;
}

.label{
    display:block;
    font-size:13px;
    font-weight:600;
    color:#555;
    margin:8px 0 6px;
}

.form-group{margin-bottom:14px}

/* ============================================================
   PRODUCT GRID
   ============================================================ */
.product-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:12px;
    padding:4px 16px 16px;
}

.product-card{
    background:#fff;
    border-radius:12px;
    overflow:hidden;
    box-shadow:0 3px 10px rgba(0,0,0,.06);
    border:1px solid var(--border);
    transition:transform .15s;
    display:flex;
    flex-direction:column;
}

.product-card:active{transform:scale(.98)}

.product-card img{
    width:100%;
    height:120px;
    object-fit:cover;
    background:#f0f0f0;
}

.product-card-body{
    padding:10px 12px 12px;
    flex:1;
    display:flex;
    flex-direction:column;
}

.product-card-name{
    font-size:13px;
    font-weight:600;
    color:var(--text);
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    min-height:36px;
    line-height:18px;
}

.product-card-price{
    font-size:15px;
    font-weight:700;
    color:var(--primary);
    margin-top:auto;
    padding-top:6px;
}

.product-card-stock{
    font-size:11px;
    color:var(--muted);
    margin-top:2px;
}

/* ============================================================
   CATEGORY SCROLL
   ============================================================ */
.cat-scroll{
    display:flex;
    gap:14px;
    overflow-x:auto;
    padding:4px 16px 16px;
    scrollbar-width:none;
}

.cat-scroll::-webkit-scrollbar{display:none}

.cat-item{
    flex:0 0 auto;
    width:70px;
    text-align:center;
}

.cat-circle{
    width:60px;
    height:60px;
    border-radius:50%;
    margin:0 auto 6px;
    background:#fff;
    overflow:hidden;
    box-shadow:0 2px 8px rgba(0,0,0,.08);
    display:flex;
    align-items:center;
    justify-content:center;
}

.cat-circle img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.cat-item span{
    font-size:11px;
    color:#666;
    display:block;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* ============================================================
   HERO BANNER
   ============================================================ */
.hero{
    margin:12px 16px 4px;
    height:180px;
    border-radius:16px;
    overflow:hidden;
    position:relative;
    background:#333;
}

.hero img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.hero-overlay{
    position:absolute;
    inset:0;
    background:linear-gradient(to top,rgba(0,0,0,.6),rgba(0,0,0,.1));
    display:flex;
    flex-direction:column;
    justify-content:flex-end;
    padding:18px;
    color:#fff;
}

.hero-title{font-size:22px;font-weight:700}
.hero-sub{font-size:13px;opacity:.9;margin-top:4px}

/* ============================================================
   LIST ROWS
   ============================================================ */
.row-item{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 16px;
    background:#fff;
    border-bottom:1px solid var(--border);
}

.row-item img{
    width:60px;
    height:60px;
    border-radius:10px;
    object-fit:cover;
    background:#f0f0f0;
}

.row-item .info{flex:1;min-width:0}

.row-item .info h4{
    font-size:14px;
    font-weight:600;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.row-item .info p{
    font-size:12px;
    color:var(--muted);
    margin-top:2px;
}

.row-item .price{
    font-weight:700;
    color:var(--primary);
    font-size:14px;
}

/* ============================================================
   QUANTITY CONTROLS
   ============================================================ */
.qty{
    display:inline-flex;
    align-items:center;
    border:1px solid #ddd;
    border-radius:22px;
    overflow:hidden;
    background:#fff;
}

.qty button{
    width:32px;
    height:32px;
    background:none;
    border:none;
    cursor:pointer;
    color:var(--primary);
    font-size:14px;
    display:flex;
    align-items:center;
    justify-content:center;
}

.qty button:disabled{color:#ccc}

.qty input{
    width:42px;
    height:32px;
    text-align:center;
    border:none;
    outline:none;
    font-weight:700;
    font-size:14px;
    background:transparent;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge{
    display:inline-block;
    padding:4px 10px;
    border-radius:12px;
    font-size:10px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.4px;
}

.status-pending{background:#fff9c4;color:#8a6d00}
.status-processing{background:#e3f2fd;color:#1565c0}
.status-ready_for_pickup{background:#e8eaf6;color:#3949ab}
.status-out_for_delivery{background:#fff3e0;color:#e65100}
.status-completed{background:#e8f5e9;color:#2e7d32}
.status-cancelled{background:#ffebee;color:#c62828}
.status-pending_payment{background:#f3e5f5;color:#6a1b9a}

/* ============================================================
   TOAST
   ============================================================ */
.toast{
    position:fixed;
    bottom:110px;
    left:50%;
    transform:translateX(-50%) translateY(30px);
    background:#2e7d32;
    color:#fff;
    padding:12px 20px;
    border-radius:30px;
    font-size:14px;
    font-weight:500;
    opacity:0;
    pointer-events:none;
    transition:all .3s;
    z-index:9999;
    max-width:90%;
    box-shadow:0 8px 24px rgba(0,0,0,.2);
    display:flex;
    align-items:center;
    gap:10px;
}

.toast.show{
    opacity:1;
    transform:translateX(-50%) translateY(0);
}

.toast.error{background:var(--red)}

/* ============================================================
   LOADER
   ============================================================ */
.spinner{
    width:30px;
    height:30px;
    border:3px solid #eee;
    border-top-color:var(--primary);
    border-radius:50%;
    animation:spin .8s linear infinite;
}

@keyframes spin{to{transform:rotate(360deg)}}

.loader{
    display:flex;
    justify-content:center;
    padding:40px 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty{
    text-align:center;
    padding:60px 20px;
}

.empty i{
    font-size:60px;
    color:#ddd;
    margin-bottom:16px;
}

.empty h4{
    font-size:18px;
    font-weight:700;
    color:#333;
    margin-bottom:6px;
}

.empty p{
    font-size:14px;
    color:var(--muted);
    margin-bottom:20px;
}

/* ============================================================
   LOGIN PROMPT (guest)
   ============================================================ */
.login-prompt{
    background:#fff;
    margin:12px 16px;
    padding:22px;
    border-radius:14px;
    text-align:center;
    box-shadow:0 3px 10px rgba(0,0,0,.06);
}

.login-prompt i.fa-lock{
    color:var(--primary);
    font-size:24px;
}

.login-prompt p{
    margin:10px 0 16px;
    color:#333;
    font-size:14px;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrap{
    max-width:520px;
    margin:0 auto;
    padding:24px 20px;
    min-height:100vh;
    display:flex;
    flex-direction:column;
    justify-content:center;
    background:#fff;
}

.auth-logo{
    width:100px;
    height:100px;
    border-radius:50%;
    margin:0 auto 16px;
    object-fit:cover;
}

.auth-title{
    font-size:26px;
    font-weight:700;
    color:var(--primary);
    text-align:center;
    margin-bottom:6px;
}

.auth-sub{
    font-size:14px;
    color:var(--text-light);
    text-align:center;
    margin-bottom:26px;
}

.auth-link{
    color:var(--primary);
    font-weight:600;
}

.auth-error{
    color:var(--red);
    font-size:12px;
    margin-top:4px;
    display:flex;
    align-items:center;
    gap:5px;
}

.auth-hint{
    color:var(--muted);
    font-size:11px;
    margin-top:4px;
    margin-left:2px;
}

.pw-wrap{position:relative}

.pw-wrap .input{padding-right:44px}

.pw-toggle{
    position:absolute;
    right:8px;
    top:50%;
    transform:translateY(-50%);
    background:none;
    border:none;
    color:#999;
    font-size:16px;
    padding:8px;
    cursor:pointer;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:380px){
    .hdr-title{font-size:16px}
    .hdr-btn{width:38px;height:38px}
    .hdr-btn i{font-size:17px}
    .hdr-btn-placeholder{width:38px}
    .side-menu{width:260px}
}

@media (min-width:641px){
    body{background:#e8e8e8}
    .app-shell{
        box-shadow:0 0 40px rgba(0,0,0,.08);
        min-height:100vh;
    }
}