/* =========================
MODALS / AUTH
========================= */
.auth-overlay{
    position:fixed;
    inset:0;
    display:none !important;
    background:rgba(0,0,0,0.55);
    opacity:0;
    visibility:hidden;
    transition:0.2s;
    z-index:9998;
}
.auth-overlay.active{
    display:block !important;
    opacity:1;
    visibility:visible;
}
.auth-modal{
    position:fixed;
    inset:0;
    display:none !important;
    align-items:center;
    justify-content:center;
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    z-index:9999;
    transition:0.2s;
}
.auth-modal.active{
    display:flex !important;
    opacity:1;
    visibility:visible;
    pointer-events:auto;
}
.auth-modal-content{
    width:100%;
    max-width:420px;
    background:#fff;
    border-radius:18px;
    box-shadow:0 24px 70px rgba(0,0,0,0.18);
    overflow:hidden;
}
.auth-modal-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:20px 24px;
    border-bottom:1px solid #f1f1f1;
}
.auth-modal-header h3{
    margin:0;
    font-size:20px;
    color:#111;
}
.auth-close{
    border:none;
    background:none;
    font-size:28px;
    line-height:1;
    cursor:pointer;
    color:#555;
}
.auth-form{
    padding:22px 24px 26px;
}
.auth-form-row{
    margin-bottom:16px;
}
.auth-form-row label{
    display:block;
    margin-bottom:8px;
    font-size:14px;
    color:#333;
}
.auth-form-row input{
    width:100%;
    height:44px;
    border:1px solid #d1d5db;
    border-radius:10px;
    padding:0 14px;
    font-size:14px;
    background:#fafafa;
}
.auth-error{
    min-height:24px;
    margin-bottom:12px;
    color:#dc2626;
    font-size:14px;
}
.btn-auth{
    width:100%;
    height:46px;
    border:none;
    border-radius:12px;
    background:#d70018;
    color:#fff;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
}
.auth-action{
    margin-top:12px;
    text-align:center;
}
.auth-action a{
    color:#d70018;
    text-decoration:none;
    font-size:14px;
}
.auth-action a:hover{
    text-decoration:underline;
}
.header-item.logged-in strong{
    color:#fff;
}

.modal-overlay{
    position:fixed;
    inset:0;
    display:none !important;
    background:rgba(0,0,0,0.55);
    opacity:0;
    visibility:hidden;
    transition:0.2s;
    z-index:9998;
}
.modal-overlay.active{
    display:block !important;
    opacity:1;
    visibility:visible;
}
.modal{
    position:fixed;
    inset:0;
    display:none !important;
    align-items:center;
    justify-content:center;
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    z-index:9999;
    transition:0.2s;
}
.modal.active{
    display:flex !important;
    opacity:1;
    visibility:visible;
    pointer-events:auto;
}
.modal-content{
    width:100%;
    max-width:440px;
    background:#fff;
    border-radius:18px;
    box-shadow:0 24px 70px rgba(0,0,0,0.18);
    overflow:hidden;
}

.cart-modal-body{
    max-height:70vh;
    overflow-y:auto;
    padding-right:4px;
}
.modal-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:20px 24px;
    border-bottom:1px solid #f1f1f1;
}
.modal-header h3{
    margin:0;
    font-size:20px;
    color:#111;
}
.modal-close{
    border:none;
    background:none;
    font-size:28px;
    line-height:1;
    cursor:pointer;
    color:#555;
}
.modal-body{
    padding:22px 24px 26px;
}
.modal-body p{
    margin:0 0 16px;
    color:#333;
    line-height:1.6;
}

.cart-empty{
    margin:0 0 14px;
    color:#666;
    font-size:14px;
}

.cart-item{
    display:flex;
    align-items:flex-start;
    gap:8px;
    padding:8px 0;
    border-bottom:1px solid #f1f5f9;
    width:100%;
    min-width:0;
}

.cart-item:last-child{
    border-bottom:none;
}

.cart-item img{
    width:48px;
    height:48px;
    object-fit:cover;
    border-radius:8px;
    flex-shrink:0;
}

.cart-item-info{
    flex:1 1 auto;
    min-width:0;
}

.cart-item-info strong{
    display:block;
    font-size:13px;
    color:#111;
    margin-bottom:4px;
    line-height:1.35;
    overflow-wrap:anywhere;
    word-break:break-word;
}

.cart-item-info p{
    margin:0 0 6px;
    font-size:12px;
    color:#666;
    overflow-wrap:anywhere;
    word-break:break-word;
}

.cart-item-qty{
    display:flex;
    align-items:center;
    gap:6px;
    margin-top:4px;
    flex-wrap:wrap;
}

.cart-qty-btn{
    width:28px;
    height:28px;
    border:1px solid #d1d5db;
    background:#fff;
    border-radius:8px;
    cursor:pointer;
    font-size:16px;
    line-height:1;
}

.cart-qty-input{
    width:36px;
    height:28px;
    border:1px solid #d1d5db;
    border-radius:8px;
    text-align:center;
    font-size:12px;
}

.cart-remove-btn{
    border:none;
    background:#fff5f6;
    color:#d70018;
    width:28px;
    height:28px;
    border-radius:8px;
    cursor:pointer;
    font-size:16px;
    line-height:1;
    margin-left:auto;
    flex-shrink:0;
}

.cart-remove-btn:hover{
    background:#ffe4e8;
}

.cart-summary{
    margin:12px 0 8px;
    font-size:14px;
    color:#333;
}
.modal-body .auth-form-row{
    margin-bottom:16px;
}
.modal-body .auth-form-row label{
    display:block;
    margin-bottom:8px;
    font-size:14px;
    color:#333;
}
.modal-body .auth-form-row input{
    width:100%;
    height:44px;
    border:1px solid #d1d5db;
    border-radius:10px;
    padding:0 14px;
    font-size:14px;
    background:#fafafa;
}
.modal-body .btn-auth{
    margin-top:8px;
}
.order-result{
    border-top:1px solid #eef2f7;
    padding-top:18px;
}
.order-summary p{
    margin:0 0 8px;
    color:#222;
    font-size:14px;
}
.order-summary strong{
    color:#111;
}
.order-items{
    margin-top:14px;
}
.order-items h4{
    margin-bottom:12px;
    font-size:16px;
    color:#111;
}
.order-item{
    display:flex;
    gap:12px;
    margin-bottom:14px;
    padding-bottom:14px;
    border-bottom:1px solid #f1f5f9;
}
.order-item img{
    width:70px;
    height:70px;
    object-fit:cover;
    border-radius:12px;
}
.order-item-info h5{
    margin:0 0 6px;
    font-size:15px;
    color:#111;
}
.order-item-info p{
    margin:2px 0;
    font-size:13px;
    color:#444;
}
.order-error{
    font-size:14px;
}

/* Ensure order result/error stay hidden unless the modal is active and JS toggles the .show class */
.modal:not(.active) #orderResult,
.modal:not(.active) #orderError {
    display: none !important;
}
.modal.active #orderResult.show,
.modal.active #orderError.show {
    display: block !important;
}
