/* MoulCOD Premium Arabic-First Mobile Styles */
:root {
    --moulcod-primary: #000;
    --moulcod-primary-hover: #333;
    --moulcod-border: #e5e7eb;
}

/* Form Container - Compact Premium Card */
.moulcod-order-form-container {
    background: #ffffff;
    max-width: 460px;         /* Compact center logic */
    margin: 20px auto 35px;
    padding: 35px 25px;       /* Refined horizontal padding desktop */
    border-radius: 20px;
    border: 1px solid var(--moulcod-border);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05), 0 5px 15px rgba(0,0,0,0.02);
    font-family: inherit;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Failsafe to hide any straggling Woodmart titles outside our container globally */
.single-product .product_title:not(.moulcod-product-title),
.single-product .price:not(.amount) {
    display: none !important;
}

/* Dynamic Internal Title & Price */
.moulcod-product-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: #111827;
    margin: 0 0 12px 0;
    text-align: center;
    line-height: 1.25;
}

.moulcod-product-price-container {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--moulcod-border);
}

.moulcod-product-price {
    display: flex;
    flex-direction: column;   /* Vertical Stack UI */
    align-items: center;      /* Centers regular price naturally */
    width: 100%;
    gap: 8px;
}

/* Align to reading edge when sale logic dictates a block, Flex-start natively honors RTL */
.moulcod-product-price.moulcod-has-sale {
    align-items: flex-start; 
}

/* 1) Discount Badge */
.moulcod-discount-badge {
    background: var(--moulcod-primary, #ef4444);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 20px;       /* Modern pill shape */
    letter-spacing: 0.5px;
    line-height: 1;
    margin-bottom: 6px;
    display: inline-block;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* 2) Old Price */
.moulcod-old-price {
    color: #9ca3af !important;
    text-decoration: line-through;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1;
}

.moulcod-old-price .amount {
    color: inherit;
    text-decoration: inherit;
}

/* 3) New Price */
.moulcod-new-price {
    color: #111827 !important;
    font-size: 2.1rem;         /* Massive conversion driver */
    font-weight: 800;
    text-decoration: none;
    line-height: 1.1;
    margin-top: 4px;           /* Breathing space below old price */
    animation: moulcodPriceFocus 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.moulcod-new-price .amount {
    color: inherit;
}

@keyframes moulcodPriceFocus {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Perfect RTL Alignment */
.moulcod-order-form-container[dir="rtl"] {
    text-align: right;
}
.moulcod-order-form-container[dir="ltr"] {
    text-align: left;
}

/* Hierarchy Typography */
.moulcod-form-subtitle {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #4b5563; /* Subtle gray to shift focus to title/price */
    text-align: center;
    line-height: 1.3;
}

/* Perfect Spacing */
.moulcod-form-group {
    margin-bottom: 22px;
}

.moulcod-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #374151;
    letter-spacing: 0.2px;
}

.moulcod-required {
    color: #ef4444;
    margin: 0 4px;
}

/* Inputs - Clean, Readable, Premium Padding */
.moulcod-form-group input[type="text"],
.moulcod-form-group input[type="tel"],
.moulcod-form-group textarea {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid var(--moulcod-border);
    border-radius: 14px;
    font-size: 1.05rem;
    color: #111;
    background: #fdfdfd;
    box-sizing: border-box;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.015);
}

.moulcod-order-form-container[dir="rtl"] .moulcod-form-group input,
.moulcod-order-form-container[dir="rtl"] .moulcod-form-group textarea {
    font-family: inherit;
}

.moulcod-form-group input:focus,
.moulcod-form-group textarea:focus {
    border-color: var(--moulcod-primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(0,0,0,0.06);
    background: #fff;
    transform: translateY(-1px);
}

/* Handle the forced LTR on phone number cleanly within RTL */
.moulcod-order-form-container[dir="rtl"] input[type="tel"] {
    text-align: right;
}

.moulcod-form-group textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* CTA Button Optimization */
.moulcod-submit-group {
    margin-top: 32px;
}

.moulcod-submit-btn {
    width: 100%;
    padding: 20px 24px;
    background-color: var(--moulcod-primary) !important;
    color: #fff !important;
    border: none;
    border-radius: 16px;
    font-size: 1.25rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Smooth hover/press transitions */
    transform: translateY(0) scale(1);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.moulcod-submit-btn:hover {
    background-color: var(--moulcod-primary-hover) !important;
    transform: translateY(-2px) scale(1.015);
    box-shadow: 0 12px 25px rgba(0,0,0,0.18);
}

.moulcod-submit-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.moulcod-submit-btn.loading {
    opacity: 0.8;
    pointer-events: none;
}

/* Trust Indicators Layout */
.moulcod-trust-indicators {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    font-size: 0.82rem;
    color: #6b7280;
    font-weight: 600;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 5px;
}

.moulcod-trust-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* RTL handling for trust items */
.moulcod-order-form-container[dir="rtl"] .moulcod-trust-item svg {
    margin-left: 4px; /* Icon spacing right-to-left */
    margin-right: 0;
}

.moulcod-trust-item svg {
    color: #10b981; /* Green checkmark */
    flex-shrink: 0;
}

/* Spinner Animation */
.moulcod-loading-spinner {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 3px solid #fff;
    width: 24px;
    height: 24px;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    margin: 0 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Messages */
.moulcod-message-container {
    margin-top: 25px;
    padding: 18px;
    border-radius: 14px;
    font-weight: 600;
    text-align: center;
    font-size: 1.05rem;
    transition: all 0.3s ease;
}

.moulcod-message-container.success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #10b981;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.1);
}

.moulcod-message-container.error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Base Woodmart resets */
.woo-variation-items-wrapper, 
.woocommerce-variation-add-to-cart {
    display: flex;
    flex-direction: column;
}

/* Superior Mobile Optimization - Thumb friendly */
@media (max-width: 768px) {
    .moulcod-order-form-container {
        padding: 28px 18px;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.08); /* Big subtle shadow for card feel on mobile */
        border: none;
        margin: 15px auto;
        width: 100%;
        max-width: 100%; /* Use full available width minus margin */
    }
    
    .moulcod-product-title {
        font-size: 1.55rem;
    }
    
    .moulcod-new-price {
        font-size: 1.8rem; /* slightly scale down for mobile */
    }

    .moulcod-form-subtitle {
        font-size: 1.15rem;
        margin-bottom: 22px;
    }
    
    .moulcod-form-group {
        margin-bottom: 18px; /* Reduce vertical spacing slightly */
    }
    
    .moulcod-form-group label {
        font-size: 1rem;
    }
    
    .moulcod-form-group input[type="text"],
    .moulcod-form-group input[type="tel"],
    .moulcod-form-group textarea {
        padding: 18px; /* Larger tap target */
        font-size: 1.1rem; /* Prevent iOS zoom */
    }
    
    .moulcod-submit-btn {
        padding: 22px; 
        font-size: 1.35rem; /* Huge legible thumb target */
    }
    
    /* Layout trust horizontally wrapped for mobile */
    .moulcod-trust-indicators {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        margin-top: 22px;
    }
}
