/**
 * Custom Shop Styles
 * Virtual Tour - Cart & Checkout
 */

/* ===== Variables ===== */
:root {
    --shop-primary: #3BADF9;
    --shop-primary-dark: #2ba0e6;
    --shop-success: #2EF1A8;
    --shop-danger: #f56565;
    --shop-warning: #ed8936;
    --shop-bg-dark: rgba(0, 8, 54, 0.95);
    --shop-bg-card: rgba(255, 255, 255, 0.05);
    --shop-border: rgba(255, 255, 255, 0.1);
    --shop-text: #ffffff;
    --shop-text-muted: rgba(255, 255, 255, 0.6);
    --shop-radius: 16px;
    --shop-radius-sm: 10px;
}

/* ===== Cart Button (Header) ===== */
.custom-cart-btn {
    position: relative;
    background: linear-gradient(135deg, var(--shop-primary), var(--shop-primary-dark));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.custom-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.custom-cart-btn i {
    font-size: 16px;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--shop-danger);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* ===== Cart Modal ===== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-modal {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 100%;
    height: 100%;
    background: var(--shop-bg-dark);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
}

.cart-modal.active {
    right: 0;
}

/* RTL Support */
[dir="rtl"] .cart-modal {
    right: auto;
    left: -400px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
}

[dir="rtl"] .cart-modal.active {
    left: 0;
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--shop-border);
}

.cart-header h3 {
    color: var(--shop-text);
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-header h3 i {
    color: var(--shop-primary);
}

.cart-close {
    background: var(--shop-bg-card);
    border: 1px solid var(--shop-border);
    color: var(--shop-text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cart-close:hover {
    background: var(--shop-danger);
    border-color: var(--shop-danger);
}

/* Cart Items */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--shop-bg-card);
    border-radius: var(--shop-radius-sm);
    margin-bottom: 15px;
    border: 1px solid var(--shop-border);
    transition: all 0.3s ease;
}

.cart-item:hover {
    border-color: var(--shop-primary);
}

.cart-item-image {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--shop-bg-card);
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    color: var(--shop-text);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.cart-item-price {
    color: var(--shop-primary);
    font-weight: 700;
    font-size: 1rem;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--shop-border);
    background: var(--shop-bg-card);
    color: var(--shop-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: var(--shop-primary);
    border-color: var(--shop-primary);
}

.qty-value {
    color: var(--shop-text);
    font-weight: 600;
    min-width: 25px;
    text-align: center;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--shop-text-muted);
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s ease;
}

.cart-item-remove:hover {
    color: var(--shop-danger);
}

/* Empty Cart */
.cart-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--shop-text-muted);
}

.cart-empty i {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.cart-empty p {
    font-size: 1.1rem;
}

/* Cart Footer */
.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--shop-border);
    background: rgba(0, 0, 0, 0.2);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cart-total-label {
    color: var(--shop-text-muted);
    font-size: 1rem;
}

.cart-total-value {
    color: var(--shop-text);
    font-size: 1.5rem;
    font-weight: 700;
    width: -webkit-fill-available;
}

.cart-total-currency {
    font-size: 0.9rem;
    margin-right: 5px;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-checkout {
    background: linear-gradient(135deg, var(--shop-primary), var(--shop-primary-dark));
    color: white;
    border: none;
    padding: 15px;
    border-radius: var(--shop-radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-continue {
    background: var(--shop-bg-card);
    color: var(--shop-text);
    border: 1px solid var(--shop-border);
    padding: 12px;
    border-radius: var(--shop-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.btn-continue:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== Checkout Modal ===== */
.checkout-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--shop-bg-dark);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.checkout-modal.active {
    opacity: 1;
    visibility: visible;
}

.checkout-container {
    background: var(--shop-bg-card);
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.checkout-modal.active .checkout-container {
    transform: scale(1);
}

.checkout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid var(--shop-border);
}

.checkout-header h3 {
    color: var(--shop-text);
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkout-header h3 i {
    color: var(--shop-primary);
}

.checkout-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--shop-text);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-sm);
    background: var(--shop-bg-card);
    color: var(--shop-text);
    font-size: 1rem;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--shop-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.form-group input::placeholder {
    color: var(--shop-text-muted);
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* Order Summary in Checkout */
.order-summary {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--shop-radius-sm);
    padding: 20px;
    margin-top: 20px;
}

.order-summary h4 {
    color: var(--shop-text);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--shop-border);
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: var(--shop-text-muted);
    font-size: 0.9rem;
}

.order-summary-item.total {
    padding-top: 15px;
    margin-top: 10px;
    border-top: 1px solid var(--shop-border);
    color: var(--shop-text);
    font-weight: 700;
    font-size: 1.1rem;
}

.checkout-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--shop-border);
}

.btn-pay {
    width: 100%;
    background: linear-gradient(135deg, var(--shop-success), #38a169);
    color: white;
    border: none;
    padding: 16px;
    border-radius: var(--shop-radius-sm);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.btn-pay:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

.btn-pay:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-pay .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Toast Notifications ===== */
.shop-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--shop-bg-dark);
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-sm);
    padding: 15px 25px;
    color: var(--shop-text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10003;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.shop-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.shop-toast.success {
    border-color: var(--shop-success);
}

.shop-toast.success i {
    color: var(--shop-success);
}

.shop-toast.error {
    border-color: var(--shop-danger);
}

.shop-toast.error i {
    color: var(--shop-danger);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .cart-modal {
        width: 100%;
    }

    .checkout-container {
        max-height: 100vh;
        border-radius: 0;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .cart-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-item-image {
        width: 100%;
        height: 120px;
    }
}

/* ===== Add to Cart Animation ===== */
.add-to-cart-anim {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--shop-primary);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
}

.add-to-cart-anim.animate {
    animation: flyToCart 0.6s ease-in-out forwards;
}

@keyframes flyToCart {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}