/* --- Theme Variables --- */
:root {
    --primary-color: #a86e7b;
    --primary-hover: #8a5a65;
    --secondary-color: #b19cd9;
    --bg-color: #fcfbf9;
    --surface-color: #ffffff;
    --text-main: #3d3335;
    --text-muted: #756a6d;
    --border-color: #e8e2e4;
    --error-color: #d32f2f;
    --success-color: #388e3c;
    
    --shadow-sm: 0 2px 8px rgba(168, 110, 123, 0.08);
    --shadow-md: 0 8px 24px rgba(168, 110, 123, 0.12);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    
    --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 600px; /* Mobile focused max width for specific sections if needed */
    margin: 0 auto;
    padding: 0 16px;
}

.container-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.text-center { text-align: center; }

/* Navbar */
.navbar {
    padding: 16px 0;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-content { display: flex; align-items: center; }
.store-logo {
    max-height: 50px;
    width: auto;
    object-fit: contain;
}

/* Slider Section */
.slider-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    aspect-ratio: 3/4;
    background: #f0ecee;
}

.slider-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    scrollbar-width: none; /* Firefox */
}

.slider-wrapper::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.slide-image {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    scroll-snap-align: start;
}

.slider-thumbnails {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.slider-thumbnails::-webkit-scrollbar { display: none; }

.thumbnail-img {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: var(--transition);
}

.thumbnail-img.active {
    opacity: 1;
    border-color: var(--primary-color);
}

/* Product Header */
.product-header {
    padding: 24px 16px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.product-title {
    font-size: 1.5rem;
    font-weight: 800;
}

.badge-new {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.current-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
}

.old-price {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.trust-icons {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
.trust-icons span { display: flex; align-items: center; gap: 4px; }
.trust-icons i { color: var(--secondary-color); font-size: 1.1rem; }

/* Order Form Section */
.order-section {
    padding: 24px 0 60px;
    background: var(--bg-color);
}

.order-form-wrapper {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.form-title-banner {
    background: var(--primary-color);
    color: white;
    padding: 16px;
    text-align: center;
}
.form-title-banner h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.3rem;
    margin-bottom: 4px;
    color: white;
}
.form-title-banner p { font-size: 0.9rem; opacity: 0.9; }

.checkout-form { padding: 24px; }

/* Form Elements */
.form-group { margin-bottom: 20px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}
@media(min-width: 480px) {
    .form-row { grid-template-columns: 1fr 1fr; gap: 16px; }
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}
.required { color: var(--error-color); }

input[type="text"], input[type="tel"], select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-color);
    transition: var(--transition);
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23756a6d' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
}

/* Delivery Options */
.delivery-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.delivery-option { position: relative; cursor: pointer; }
.delivery-option input { position: absolute; opacity: 0; }
.option-content {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}
.option-content i { font-size: 1.5rem; color: var(--text-muted); }
.option-title { font-weight: 700; display: block; font-size: 0.95rem; }
.option-desc { font-size: 0.85rem; color: var(--text-muted); }

.delivery-option input:checked + .option-content {
    border-color: var(--primary-color);
    background-color: rgba(168, 110, 123, 0.05);
}
.delivery-option input:checked + .option-content i { color: var(--primary-color); }
.delivery-option input:disabled + .option-content {
    opacity: 0.5;
    background: #f5f5f5;
    cursor: not-allowed;
}

.error-msg {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 8px;
    display: none;
}

/* Summary Card */
.order-summary-card {
    background: var(--bg-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin: 24px 0;
}
.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.summary-item.total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
    color: var(--text-main);
    font-weight: 700;
}
.summary-item.total span:last-child {
    color: var(--primary-color);
    font-size: 1.3rem;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.btn-submit:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Success Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--surface-color);
    padding: 40px 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 1px solid var(--border-color);
}

.modal-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 16px;
}

.modal-card h2 {
    color: var(--primary-color);
    margin-bottom: 12px;
}

.modal-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.footer { padding: 24px; color: var(--text-muted); font-size: 0.9rem; }

/* Desktop Grid Layout for Direct Funnel */
@media(min-width: 992px) {
    .direct-funnel {
        display: flex;
        flex-direction: row-reverse; /* Puts first element on the left in RTL */
        gap: 40px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .funnel-left {
        display: flex;
        flex-direction: column;
        flex: 1;
        width: 50%;
        position: sticky;
        top: 100px;
        align-self: flex-start;
        height: calc(100vh - 120px);
    }

    .funnel-right {
        flex: 1;
        width: 50%;
    }

    .slider-container {
        flex: 1;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        height: 100%;
        max-height: none;
        aspect-ratio: auto;
        min-height: 0; /* CRITICAL for flex shrink */
    }
    
    .slider-thumbnails {
        flex-shrink: 0;
        padding: 16px 0 0 0;
    }

    .product-header {
        background: transparent;
        border-bottom: none;
        padding: 0 0 24px 0;
    }

    .order-section {
        padding: 0 0 60px 0;
        background: transparent;
    }
}
