﻿/* ============================================================
   Cart & Orders Styles - Mobile First
   ============================================================ */

/* ============================================================
   Cart Layout
   ============================================================ */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    background: white;
    border-radius: 16px;
    padding: 16px;
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 14px;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    border: 2px solid transparent;
    transition: all 0.2s;
}

    .cart-item:hover {
        border-color: #10b981;
    }

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

    .cart-item-image img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        padding: 8px;
    }

    .cart-item-image i {
        font-size: 2rem;
        color: #d1d5db;
    }

.cart-item-info {
    min-width: 0;
}

.cart-item-brand {
    font-size: 0.7rem;
    font-weight: 800;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-item-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f2937;
    margin: 4px 0 8px;
    line-height: 1.4;
}

.cart-item-specs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

    .cart-item-specs .spec {
        background: #f0fdf4;
        color: #059669;
        padding: 3px 8px;
        border-radius: 6px;
        font-size: 0.7rem;
        font-weight: 700;
    }

.alert-stock {
    background: #fef3c7;
    color: #92400e;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f9fafb;
    border-radius: 10px;
    padding: 4px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: all 0.2s;
    font-size: 0.75rem;
}

    .qty-btn:hover:not(:disabled) {
        background: #10b981;
        color: white;
    }

    .qty-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.qty-display {
    min-width: 32px;
    text-align: center;
    font-weight: 800;
    color: #1f2937;
    font-size: 0.95rem;
}

.cart-item-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: #6b7280;
    text-align: center;
    grid-column: 2 / 3;
}

.cart-item-total {
    font-size: 1rem;
    font-weight: 800;
    color: #059669;
    grid-column: 2 / 3;
}

    .cart-item-total small {
        font-size: 0.7rem;
        color: #6b7280;
        font-weight: 600;
    }

.btn-remove {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
}

    .btn-remove:hover {
        background: #dc2626;
        color: white;
    }

/* ============================================================
   Cart Summary
   ============================================================ */
.cart-summary {
    position: sticky;
    top: 100px;
    align-self: start;
}

.summary-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

    .summary-card h3 {
        font-size: 1.1rem;
        font-weight: 800;
        color: #1f2937;
        margin-bottom: 20px;
        padding-bottom: 12px;
        border-bottom: 2px solid #f0fdf4;
    }

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 0.9rem;
    color: #6b7280;
}

    .summary-row strong {
        color: #1f2937;
        font-weight: 800;
    }

    .summary-row.total {
        padding: 16px 0;
        font-size: 1rem;
    }

        .summary-row.total strong {
            color: #059669;
            font-size: 1.2rem;
        }

.summary-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 8px 0;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 12px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

    .alert-warning i {
        color: #d97706;
        margin-top: 2px;
        flex-shrink: 0;
    }

/* ============================================================
   Checkout Layout
   ============================================================ */
.checkout-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.checkout-section {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    padding-right: 60px;
}

.section-number {
    position: absolute;
    top: 24px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.checkout-section h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 6px;
}

.section-description {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 16px;
    line-height: 1.6;
}

/* ============================================================
   Delivery Options
   ============================================================ */
.delivery-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.delivery-option {
    cursor: pointer;
    position: relative;
}

    .delivery-option input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

.delivery-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s;
}

.delivery-option input:checked + .delivery-card {
    border-color: #10b981;
    background: #f0fdf4;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.delivery-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.delivery-option input:checked + .delivery-card .delivery-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.delivery-info {
    flex: 1;
}

.delivery-title {
    font-weight: 800;
    color: #1f2937;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.delivery-desc {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.5;
}

/* ============================================================
   Checkout Summary
   ============================================================ */
.checkout-summary {
    align-self: start;
}

.summary-card.sticky {
    position: sticky;
    top: 100px;
}

.summary-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.summary-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    font-size: 0.85rem;
}

.summary-item-name {
    color: #374151;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-item-qty {
    color: #6b7280;
    font-weight: 700;
    font-size: 0.8rem;
}

.summary-item-price {
    color: #059669;
    font-weight: 800;
    font-size: 0.85rem;
}

.payment-notice {
    background: #fef3c7;
    color: #92400e;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .payment-notice i {
        font-size: 1rem;
    }

/* ============================================================
   Orders List
   ============================================================ */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: all 0.2s;
    border: 2px solid transparent;
}

    .order-card:hover {
        border-color: #10b981;
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    }

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
    flex-wrap: wrap;
}

.order-number {
    font-weight: 800;
    color: #1f2937;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .order-number i {
        color: #10b981;
    }

.order-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.order-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 600;
}

    .order-info-item i {
        color: #10b981;
        font-size: 0.9rem;
    }

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
    flex-wrap: wrap;
}

.order-amount {
    font-size: 1.2rem;
    font-weight: 800;
    color: #059669;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

    .order-amount small {
        font-size: 0.75rem;
        color: #6b7280;
        font-weight: 600;
    }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bg-warning {
    background: #fef3c7;
    color: #92400e;
}

.bg-info {
    background: #cffafe;
    color: #0891b2;
}

.bg-primary {
    background: #dbeafe;
    color: #1d4ed8;
}

.bg-success {
    background: #d1fae5;
    color: #059669;
}

.bg-danger {
    background: #fee2e2;
    color: #dc2626;
}

.bg-secondary {
    background: #e5e7eb;
    color: #4b5563;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    background: white;
    border-radius: 20px;
    padding: 60px 30px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

    .empty-state i {
        font-size: 4rem;
        color: #d1d5db;
        margin-bottom: 20px;
        display: block;
    }

    .empty-state h5 {
        font-size: 1.2rem;
        font-weight: 800;
        color: #1f2937;
        margin-bottom: 10px;
    }

    .empty-state p {
        color: #6b7280;
        margin-bottom: 24px;
        line-height: 1.7;
    }

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 768px) {
    .cart-layout {
        grid-template-columns: 1fr 340px;
    }

    .checkout-layout {
        grid-template-columns: 1fr 380px;
    }

    .cart-item {
        grid-template-columns: 100px 1fr 120px 120px 100px auto;
        gap: 16px;
        padding: 20px;
    }

    .cart-item-image {
        width: 100px;
        height: 100px;
        grid-row: span 2;
    }

    .cart-item-info {
        grid-column: 2 / 3;
        grid-row: span 2;
    }

    .cart-item-price,
    .cart-item-total {
        grid-column: auto;
        text-align: center;
    }

    .cart-item-total {
        font-size: 1.1rem;
    }

    .btn-remove {
        position: static;
        width: 40px;
        height: 40px;
    }

    .delivery-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .checkout-layout {
        grid-template-columns: 1fr 420px;
    }
}

@media (max-width: 767px) {
    .cart-item {
        grid-template-columns: 80px 1fr auto;
        grid-template-areas:
            "image info remove"
            "image price quantity"
            "image total total";
        gap: 8px;
    }

    .cart-item-image {
        grid-area: image;
    }

    .cart-item-info {
        grid-area: info;
    }

    .cart-item-price {
        grid-area: price;
    }

    .cart-item-total {
        grid-area: total;
        text-align: left;
    }

    .cart-item-quantity {
        grid-area: quantity;
        justify-self: end;
    }

    .btn-remove {
        grid-area: remove;
        position: static;
        align-self: start;
    }

    .cart-summary,
    .checkout-summary {
        position: static;
    }

    .summary-card.sticky {
        position: static;
    }

    .checkout-section {
        padding: 20px;
        padding-right: 56px;
    }

    .section-number {
        top: 20px;
        right: 16px;
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}
/* ============================================================
   Checkout Login Required
   ============================================================ */

.checkout-login-required {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.login-required-card {
    background: white;
    border-radius: 24px;
    padding: 40px 28px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 2px dashed #d1fae5;
}

.login-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    animation: loginIconPulse 2s ease-in-out infinite;
}

@keyframes loginIconPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.login-required-card h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 12px;
}

.login-required-card p {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.8;
    margin: 0 0 24px;
}

.login-required-card strong {
    color: #10b981;
}

.login-benefits {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #4b5563;
    font-weight: 600;
}

    .benefit-item i {
        color: #10b981;
    }

/* Summary Card for Non-Authenticated */
.login-summary-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

    .login-summary-card h3 {
        font-size: 1.05rem;
        font-weight: 800;
        color: #1f2937;
        margin: 0 0 16px;
        padding-bottom: 12px;
        border-bottom: 2px solid #f0fdf4;
    }

/* Customer Info Box (Authenticated) */
.customer-info-box {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    border: 1px solid #d1fae5;
}

    .customer-info-box i {
        color: #10b981;
        font-size: 1.3rem;
    }

    .customer-info-box strong {
        display: block;
        font-size: 0.95rem;
        color: #1f2937;
        margin-bottom: 2px;
    }

    .customer-info-box small {
        font-size: 0.8rem;
        color: #6b7280;
        direction: ltr;
        display: inline-block;
    }

/* Responsive */
@media (min-width: 768px) {
    .checkout-login-required {
        grid-template-columns: 1.5fr 1fr;
        align-items: start;
    }
}