/* ============================================
   ENAS' BAKERY - Talabat-Style Order Page
   ============================================ */

/* ---- Page Body ---- */
.order-page-body {
    background: #FAF6F1;
    padding-bottom: 140px;
    /* space for bottom nav + cart bar */
    -webkit-tap-highlight-color: transparent;
}

/* ---- Top Header ---- */
.order-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 248, 240, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(200, 169, 110, 0.15);
}

.order-back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 2px 8px rgba(60, 31, 14, 0.08);
    color: var(--chocolate);
    transition: var(--transition);
}

.order-back-btn:hover {
    background: var(--cream);
    transform: scale(1.05);
}

.order-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.order-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: 0 2px 10px rgba(200, 169, 110, 0.2);
}

.order-header-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--chocolate);
    margin: 0;
}

.order-header-sub {
    font-size: 0.75rem;
    color: var(--gray);
    margin: 2px 0 0;
}

.order-header-spacer {
    width: 40px;
}

/* ---- Main Content ---- */
.order-main {
    padding: 0 12px 20px;
    max-width: 700px;
    margin: 0 auto;
}

.order-loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray);
}

.order-loading p {
    margin-top: 12px;
    font-size: 0.9rem;
}

/* ---- Category Section Headers ---- */
.order-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 4px 12px;
    position: sticky;
    top: 77px;
    background: #FAF6F1;
    z-index: 50;
}

.order-category-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--chocolate);
    margin: 0;
}

.order-category-header .cat-count {
    font-size: 0.75rem;
    background: var(--gold);
    color: var(--white);
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* ---- Product Item Card (Compact / Talabat-style) ---- */
.order-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--white);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(60, 31, 14, 0.06);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.order-item:active {
    transform: scale(0.985);
}

.order-item-img {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.order-item-info {
    flex: 1;
    min-width: 0;
}

.order-item-name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--chocolate);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-item-desc {
    font-size: 0.78rem;
    color: var(--gray);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 8px;
}

.order-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.order-item-price {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--gold-dark);
    font-size: 1rem;
}

.order-item-price small {
    font-size: 0.7rem;
    color: var(--gray);
    font-family: var(--font-body);
    font-weight: 400;
}

/* Add / Quantity Buttons */
.order-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--gold);
    color: var(--white);
    font-size: 1.3rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(200, 169, 110, 0.3);
}

.order-add-btn:hover {
    background: var(--gold-dark);
    transform: scale(1.1);
}

.order-qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--gold);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(200, 169, 110, 0.3);
}

.order-qty-btn {
    width: 30px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.order-qty-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.order-qty-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--white);
    min-width: 24px;
    text-align: center;
}

/* ---- Add-ons row ---- */
.order-item-addons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.order-addon-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--gray-light);
    color: var(--gray);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    background: var(--cream-light);
}

.order-addon-tag.selected {
    background: var(--gold);
    color: var(--white);
    border-color: var(--gold);
}

/* ============================================
   INLINE CART SECTION
   ============================================ */
.order-cart-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 4px 16px;
}

.order-cart-divider span {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--chocolate);
    white-space: nowrap;
}

.order-cart-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--gold), transparent);
}

/* Cart item row */
.order-cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(200, 169, 110, 0.12);
    animation: fadeIn 0.25s ease;
}

.order-cart-item-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.order-cart-item-info {
    flex: 1;
    min-width: 0;
}

.order-cart-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--chocolate);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-cart-item-addons-text {
    font-size: 0.7rem;
    color: var(--gray);
}

.order-cart-item-qty {
    font-size: 0.78rem;
    color: var(--gray);
    white-space: nowrap;
}

.order-cart-item-price {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--gold-dark);
    font-size: 0.95rem;
    white-space: nowrap;
}

.order-cart-item-remove {
    background: none;
    border: none;
    color: var(--gray-light);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
}

.order-cart-item-remove:hover {
    color: #e74c3c;
}

/* Total row */
.order-cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 8px 8px;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--chocolate);
}

.order-cart-total {
    color: var(--gold-dark);
    font-size: 1.3rem;
}

/* ============================================
   INLINE CHECKOUT
   ============================================ */
.order-checkout {
    padding: 16px 4px 8px;
}

.order-checkout-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--chocolate);
    margin-bottom: 12px;
}

.order-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.order-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(200, 169, 110, 0.2);
    border-radius: 12px;
    background: var(--white);
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--chocolate);
    transition: border-color 0.2s;
    outline: none;
}

.order-input:focus {
    border-color: var(--gold);
}

.order-input::placeholder {
    color: var(--gray-light);
}

.order-input-full {
    width: 100%;
    margin-bottom: 10px;
}

.order-input.error {
    border-color: #e74c3c;
    animation: shake 0.3s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* ============================================
   STICKY BOTTOM BAR (Cart Summary)
   ============================================ */
.order-bottom-bar {
    position: fixed;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 680px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--chocolate);
    color: var(--white);
    padding: 14px 20px;
    border-radius: 16px;
    z-index: 200;
    box-shadow: 0 6px 30px rgba(26, 14, 6, 0.35);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.order-bottom-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-bottom-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

.order-bottom-total {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

.order-bottom-btn {
    padding: 10px 28px;
    background: var(--gold);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: var(--font-body);
}

.order-bottom-btn:hover {
    background: var(--gold-dark);
    transform: scale(1.03);
}

.order-bottom-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.order-bottom-btn.placing {
    pointer-events: none;
    opacity: 0.7;
}

/* ============================================
   BOTTOM CATEGORY NAVIGATION
   ============================================ */
.order-category-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: var(--white);
    border-top: 1px solid rgba(200, 169, 110, 0.12);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 300;
    box-shadow: 0 -2px 15px rgba(60, 31, 14, 0.06);
}

.order-cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-width: 52px;
}

.order-cat-btn:hover {
    background: var(--cream);
}

.order-cat-btn.active {
    background: rgba(200, 169, 110, 0.15);
}

.order-cat-icon {
    font-size: 1.3rem;
    line-height: 1;
    transition: transform 0.2s;
}

.order-cat-btn.active .order-cat-icon {
    transform: scale(1.15);
}

.order-cat-label {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: color 0.2s;
}

.order-cat-btn.active .order-cat-label {
    color: var(--gold-dark);
}

/* ============================================
   ORDER SUCCESS
   ============================================ */
.order-success-msg {
    text-align: center;
    padding: 60px 20px;
    animation: scaleIn 0.4s ease;
}

.order-success-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: var(--white);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 20px rgba(39, 174, 96, 0.3);
}

.order-success-msg h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--chocolate);
    margin-bottom: 8px;
}

.order-success-msg p {
    color: var(--gray);
    margin-bottom: 28px;
}

.order-success-btn {
    padding: 12px 32px;
    background: var(--gold);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.order-success-btn:hover {
    background: var(--gold-dark);
}

/* ============================================
   RESPONSIVE REFINEMENTS
   ============================================ */
@media (max-width: 480px) {
    .order-header {
        padding: 10px 12px;
    }

    .order-logo {
        width: 46px;
        height: 46px;
    }

    .order-header-title {
        font-size: 1.05rem;
    }

    .order-item {
        padding: 10px;
        gap: 10px;
    }

    .order-item-img {
        width: 60px;
        height: 60px;
    }

    .order-item-name {
        font-size: 0.88rem;
    }

    .order-form-row {
        flex-direction: column;
        gap: 8px;
    }

    .order-bottom-bar {
        border-radius: 14px;
        padding: 12px 16px;
    }
}

@media (min-width: 768px) {
    .order-page-body {
        padding-bottom: 100px;
    }

    .order-main {
        padding: 0 20px 20px;
    }

    .order-category-nav {
        max-width: 700px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
        border-left: 1px solid rgba(200, 169, 110, 0.12);
        border-right: 1px solid rgba(200, 169, 110, 0.12);
    }

    .order-bottom-bar {
        bottom: 80px;
    }
}