/**
 * MARCHEGO COD - Premium Checkout Form Styles
 * Version: 2.0.0 - Marchego Brand Design
 * Colors: Gold #D4B674, Black #1A1A1A
 */

/* ================================
   CSS CUSTOM PROPERTIES
   ================================ */
:root {
    /* Marchego Brand Colors */
    --mcod-primary: #D4B674;
    --mcod-primary-hover: #C0A060;
    --mcod-primary-light: #FAF6ED;
    --mcod-primary-glow: rgba(212, 182, 116, 0.25);

    /* Neutrals */
    --mcod-black: #1A1A1A;
    --mcod-dark: #374151;
    --mcod-gray: #6B7280;
    --mcod-light-gray: #9CA3AF;
    --mcod-border: #E5E7EB;
    --mcod-bg: #FAFAFA;
    --mcod-surface: #FFFFFF;

    /* Semantic */
    --mcod-success: #10B981;
    --mcod-success-light: #D1FAE5;
    --mcod-error: #EF4444;
    --mcod-error-light: #FEE2E2;

    /* Typography */
    --mcod-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Spacing */
    --mcod-radius: 12px;
    --mcod-radius-lg: 16px;
    --mcod-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --mcod-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
}

/* ================================
   FORM WRAPPER
   ================================ */
.mcod-checkout-form-wrapper {
    direction: rtl;
    width: 100%;
    max-width: 100%;
    margin: 24px 0;
    font-family: var(--mcod-font);
}

.mcod-checkout-form {
    background: var(--mcod-surface);
    border-radius: var(--mcod-radius-lg);
    padding: 0;
    box-shadow: var(--mcod-shadow);
    border: 1px solid var(--mcod-border);
    overflow: hidden;
}

/* ================================
   PRODUCT SUMMARY CARD
   ================================ */
.mcod-product-summary {
    background: linear-gradient(135deg, var(--mcod-primary-light) 0%, #FCF9F3 100%);
    padding: 20px;
    border-bottom: 1px solid var(--mcod-border);
    display: flex;
    gap: 16px;
    align-items: center;
}

.mcod-product-image {
    width: 80px;
    height: 80px;
    border-radius: var(--mcod-radius);
    object-fit: cover;
    border: 2px solid var(--mcod-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.mcod-product-info {
    flex: 1;
    min-width: 0;
}

.mcod-product-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--mcod-black);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.mcod-product-price-display {
    font-size: 44px;
    font-weight: 800;
    color: var(--mcod-primary);
}

/* ================================
   FORM SECTIONS
   ================================ */
.mcod-form-body {
    padding: 24px;
}

.mcod-form-section {
    margin-bottom: 20px;
}

.mcod-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--mcod-gray);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mcod-section-title svg {
    width: 18px;
    height: 18px;
    color: var(--mcod-primary);
}

/* ================================
   FORM INPUTS
   ================================ */
.mcod-form-row {
    margin-bottom: 16px;
}

.mcod-form-row:last-child {
    margin-bottom: 0;
}

.mcod-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--mcod-black);
    font-size: 14px;
}

.mcod-form-row label .required {
    color: var(--mcod-error);
    margin-right: 2px;
}

.mcod-input-wrapper {
    position: relative;
}

.mcod-input-wrapper .mcod-input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--mcod-light-gray);
    pointer-events: none;
    transition: color 0.2s;
    z-index: 1;
}

/* Hide icon for select elements - they have native dropdown arrow */
.mcod-input-wrapper select+.mcod-input-icon {
    display: none;
}

.mcod-input-wrapper input:focus+.mcod-input-icon {
    color: var(--mcod-primary);
}

.mcod-checkout-form input[type="text"],
.mcod-checkout-form input[type="tel"],
.mcod-checkout-form input[type="number"] {
    width: 100%;
    padding: 16px 18px;
    padding-right: 48px;
    border: 2px solid var(--mcod-border);
    border-radius: var(--mcod-radius);
    font-size: 16px;
    font-weight: 500;
    color: var(--mcod-black);
    background: var(--mcod-surface);
    transition: all 0.2s ease;
    direction: rtl;
    min-height: 54px;
}

.mcod-checkout-form select {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid var(--mcod-border);
    border-radius: var(--mcod-radius);
    font-size: 16px;
    font-weight: 500;
    color: var(--mcod-black);
    background: var(--mcod-surface);
    transition: all 0.2s ease;
    direction: rtl;
    min-height: 54px;
    cursor: pointer;
    appearance: auto;
}

.mcod-checkout-form input:hover,
.mcod-checkout-form select:hover {
    border-color: #D1D5DB;
}

.mcod-checkout-form input:focus,
.mcod-checkout-form select:focus {
    outline: none;
    border-color: var(--mcod-primary);
    box-shadow: 0 0 0 4px var(--mcod-primary-glow);
}

.mcod-checkout-form input::placeholder {
    color: var(--mcod-light-gray);
    font-weight: 400;
}

.mcod-checkout-form select:disabled {
    background: var(--mcod-bg);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Error state */
.mcod-checkout-form input.mcod-error,
.mcod-checkout-form select.mcod-error {
    border-color: var(--mcod-error);
    animation: mcod-shake 0.4s ease;
}

.mcod-checkout-form input.mcod-error:focus,
.mcod-checkout-form select.mcod-error:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

@keyframes mcod-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

/* ================================
   QUANTITY SECTION
   ================================ */
.mcod-quantity-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--mcod-bg);
    border-radius: var(--mcod-radius);
    border: 1px solid var(--mcod-border);
}

.mcod-quantity-section label {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--mcod-black);
}

.mcod-quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--mcod-surface);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--mcod-border);
}

.mcod-qty-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--mcod-surface);
    cursor: pointer;
    font-size: 22px;
    font-weight: 600;
    color: var(--mcod-primary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mcod-qty-btn:hover {
    background: var(--mcod-primary);
    color: var(--mcod-surface);
}

.mcod-qty-btn:active {
    transform: scale(0.95);
}

.mcod-quantity-wrapper input[type="number"] {
    width: 60px;
    height: 44px;
    border: none;
    border-right: 1px solid var(--mcod-border);
    border-left: 1px solid var(--mcod-border);
    border-radius: 0;
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--mcod-black);
    padding: 0;
    min-height: auto;
    -moz-appearance: textfield;
}

.mcod-quantity-wrapper input[type="number"]::-webkit-outer-spin-button,
.mcod-quantity-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* ================================
   SHIPPING METHOD SELECTOR
   ================================ */
.mcod-shipping-method-section {
    margin-bottom: 20px;
}

.mcod-shipping-method-section>label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--mcod-black);
    font-size: 14px;
}

.mcod-shipping-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mcod-shipping-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 14px;
    background: var(--mcod-surface);
    border: 2px solid var(--mcod-border);
    border-radius: var(--mcod-radius);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.mcod-shipping-option:hover {
    border-color: var(--mcod-primary);
    background: var(--mcod-primary-light);
}

.mcod-shipping-option.selected {
    border-color: var(--mcod-primary);
    background: var(--mcod-primary-light);
    box-shadow: 0 0 0 4px var(--mcod-primary-glow);
}

.mcod-shipping-option input[type="radio"] {
    display: none;
}

.mcod-shipping-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mcod-bg);
    border-radius: 12px;
    color: var(--mcod-gray);
    transition: all 0.25s ease;
}

.mcod-shipping-option:hover .mcod-shipping-icon,
.mcod-shipping-option.selected .mcod-shipping-icon {
    background: var(--mcod-primary);
    color: var(--mcod-surface);
    transform: scale(1.05);
}

.mcod-shipping-icon svg {
    width: 26px;
    height: 26px;
}

.mcod-shipping-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mcod-shipping-name {
    font-weight: 700;
    color: var(--mcod-black);
    font-size: 14px;
}

.mcod-shipping-option.selected .mcod-shipping-name {
    color: var(--mcod-primary);
}

.mcod-shipping-desc {
    font-size: 12px;
    color: var(--mcod-gray);
    line-height: 1.3;
}

.mcod-shipping-price {
    font-weight: 800;
    font-size: 18px;
    color: var(--mcod-primary);
    margin-top: 4px;
}

/* ================================
   ORDER SUMMARY
   ================================ */
.mcod-order-summary {
    background: var(--mcod-bg);
    border-radius: var(--mcod-radius);
    padding: 18px 20px;
    margin: 20px 0;
    border: 1px solid var(--mcod-border);
}

.mcod-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 15px;
    color: var(--mcod-dark);
}

.mcod-summary-row:not(:last-child) {
    border-bottom: 1px solid var(--mcod-border);
}

.mcod-summary-row.mcod-total {
    font-weight: 800;
    font-size: 20px;
    color: var(--mcod-black);
    padding-top: 14px;
    margin-top: 4px;
    border-top: 2px solid var(--mcod-border);
    border-bottom: none;
}

.mcod-summary-row.mcod-total span:last-child {
    color: var(--mcod-primary);
    font-size: 24px;
}

/* ================================
   SUBMIT BUTTON - PREMIUM DESIGN
   ================================ */
.mcod-form-submit {
    margin-top: 28px;
    position: relative;
}

.mcod-submit-button {
    width: 100%;
    padding: 22px 28px;
    background: linear-gradient(135deg, #D4B674 0%, #C4A462 50%, #B09252 100%) !important;
    border: none !important;
    border-radius: 50px !important;
    color: #FFFFFF !important;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow:
        0 6px 24px rgba(212, 182, 116, 0.45),
        0 2px 8px rgba(212, 182, 116, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Shine effect overlay */
.mcod-submit-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: left 0.6s ease;
}

.mcod-submit-button:hover::before {
    left: 100%;
}

.mcod-submit-button:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow:
        0 12px 40px rgba(212, 182, 116, 0.55),
        0 4px 16px rgba(212, 182, 116, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    background: linear-gradient(135deg, #E0C888 0%, #D4B674 50%, #C4A462 100%);
}

.mcod-submit-button:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow:
        0 4px 16px rgba(212, 182, 116, 0.45),
        0 2px 8px rgba(212, 182, 116, 0.3);
}

.mcod-submit-button:disabled {
    background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%);
    cursor: not-allowed;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: none;
}

.mcod-submit-button:disabled::before {
    display: none;
}

.mcod-submit-button svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Button text wrapper */
.mcod-btn-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Loading state */
.mcod-btn-loading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mcod-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: mcod-spin 0.75s linear infinite;
}

@keyframes mcod-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Subtle pulse animation on load */
@keyframes mcod-btn-pulse {

    0%,
    100% {
        box-shadow:
            0 6px 24px rgba(212, 182, 116, 0.45),
            0 2px 8px rgba(212, 182, 116, 0.3);
    }

    50% {
        box-shadow:
            0 8px 32px rgba(212, 182, 116, 0.55),
            0 4px 12px rgba(212, 182, 116, 0.4);
    }
}

.mcod-submit-button:not(:disabled):not(:hover) {
    animation: mcod-btn-pulse 2.5s ease-in-out infinite;
}

/* Focus state for accessibility */
.mcod-submit-button:focus {
    outline: none;
    box-shadow:
        0 0 0 4px rgba(212, 182, 116, 0.3),
        0 6px 24px rgba(212, 182, 116, 0.45);
}

/* ================================
   TRUST BADGES
   ================================ */
.mcod-trust-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--mcod-border);
}

.mcod-trust-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--mcod-gray);
    font-weight: 500;
}

.mcod-trust-badge svg {
    width: 16px;
    height: 16px;
    color: var(--mcod-success);
}

/* ================================
   MESSAGES
   ================================ */
.mcod-messages {
    margin-top: 16px;
}

.mcod-message {
    padding: 16px 18px;
    border-radius: var(--mcod-radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: mcod-fadeIn 0.3s ease;
}

.mcod-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mcod-message.success {
    background: var(--mcod-success-light);
    border: 1px solid var(--mcod-success);
    color: #065F46;
}

.mcod-message.error {
    background: var(--mcod-error-light);
    border: 1px solid var(--mcod-error);
    color: #991B1B;
}

@keyframes mcod-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   VARIATION OPTIONS
   ================================ */
.mcod-variations-wrapper {
    margin-bottom: 20px;
    padding: 18px;
    background: var(--mcod-bg);
    border-radius: var(--mcod-radius);
    border: 1px solid var(--mcod-border);
}

.mcod-variation-row {
    margin-bottom: 14px;
}

.mcod-variation-row:last-child {
    margin-bottom: 0;
}

.mcod-variation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mcod-variation-option {
    padding: 12px 20px;
    border: 2px solid var(--mcod-border);
    border-radius: 10px;
    background: var(--mcod-surface);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--mcod-dark);
    transition: all 0.2s ease;
}

.mcod-variation-option:hover {
    border-color: var(--mcod-primary);
    color: var(--mcod-primary);
}

.mcod-variation-option.selected {
    border-color: var(--mcod-primary);
    background: var(--mcod-primary);
    color: var(--mcod-surface);
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 480px) {
    .mcod-checkout-form-wrapper {
        margin: 16px 0;
    }

    .mcod-form-body {
        padding: 20px 16px;
    }

    .mcod-product-summary {
        padding: 16px;
    }

    .mcod-product-image {
        width: 70px;
        height: 70px;
    }

    .mcod-product-name {
        font-size: 15px;
    }

    .mcod-product-price-display {
        font-size: 18px;
    }

    .mcod-shipping-methods {
        grid-template-columns: 1fr;
    }

    .mcod-shipping-option {
        flex-direction: row;
        text-align: right;
        padding: 14px 16px;
    }

    .mcod-shipping-icon {
        width: 44px;
        height: 44px;
    }

    .mcod-shipping-details {
        flex: 1;
        align-items: flex-start;
    }

    .mcod-shipping-price {
        font-size: 16px;
    }

    .mcod-submit-button {
        padding: 18px 20px;
        font-size: 16px;
    }

    .mcod-quantity-section {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .mcod-quantity-wrapper {
        justify-content: center;
    }

    .mcod-trust-section {
        flex-direction: column;
        align-items: center;
    }
}

/* ================================
   LOADING STATE
   ================================ */
.mcod-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.mcod-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--mcod-primary-light);
    border-top-color: var(--mcod-primary);
    border-radius: 50%;
    animation: mcod-spin 0.8s linear infinite;
}

/* ================================
   OUT OF STOCK OVERLAY
   ================================ */
.mcod-out-of-stock .mcod-form-body {
    position: relative;
    min-height: 300px;
}

.mcod-stock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 100;
    border-radius: var(--mcod-radius);
    animation: mcod-fadeIn 0.4s ease;
}

.mcod-stock-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #DC2626;
    padding: 16px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 
        0 6px 24px rgba(220, 38, 38, 0.15),
        0 2px 8px rgba(220, 38, 38, 0.1);
    border: 2px solid rgba(220, 38, 38, 0.1);
}

.mcod-stock-badge svg {
    width: 26px;
    height: 26px;
    stroke-width: 2.5;
}

.mcod-stock-overlay p {
    color: var(--mcod-gray);
    font-size: 15px;
    font-weight: 500;
}

/* ================================
   SIMILAR PRODUCTS SECTION
   ================================ */
.mcod-similar-products {
    margin-top: 24px;
    padding: 24px;
    background: var(--mcod-surface);
    border-radius: var(--mcod-radius-lg);
    border: 1px solid var(--mcod-border);
    box-shadow: var(--mcod-shadow);
}

.mcod-similar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--mcod-black);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mcod-similar-title svg {
    color: var(--mcod-primary);
}

.mcod-similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.mcod-similar-card {
    background: var(--mcod-bg);
    border-radius: var(--mcod-radius);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-decoration: none;
    display: block;
    border: 1px solid var(--mcod-border);
}

.mcod-similar-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--mcod-shadow-lg);
    border-color: var(--mcod-primary);
}

.mcod-similar-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--mcod-border);
}

.mcod-similar-card-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--mcod-border) 0%, var(--mcod-bg) 100%);
}

.mcod-similar-card-info {
    padding: 14px;
}

.mcod-similar-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--mcod-black);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.8em;
}

.mcod-similar-card-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--mcod-primary);
}

.mcod-similar-card-price del {
    color: var(--mcod-gray);
    font-weight: 400;
    font-size: 13px;
}

.mcod-similar-card-price ins {
    text-decoration: none;
}

@media (max-width: 480px) {
    .mcod-similar-products {
        padding: 18px;
        margin-top: 16px;
    }
    
    .mcod-similar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .mcod-similar-card-info {
        padding: 12px;
    }
    
    .mcod-similar-card-name {
        font-size: 13px;
    }
    
    .mcod-similar-card-price {
        font-size: 15px;
    }
    
    .mcod-stock-badge {
        padding: 14px 22px;
        font-size: 16px;
    }
}