/* Conteneur principal full screen - Takeover mode */
.speedaf-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    z-index: 999999;
    /* Higher than any theme element */
    background: #fff;
    overflow: hidden;
}

/* Fix for body scroll when form is active */
body:has(.speedaf-container) {
    overflow: hidden !important;
}

/* Account for WordPress Admin Bar */
.admin-bar .speedaf-container {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .speedaf-container {
        top: 46px;
    }
}

/* Partie gauche : image */
.speedaf-left {
    position: fixed;
    /* جعل الصورة ثابتة */
    top: 0;
    left: 0;
    width: 50%;
    /* النصف الأيسر */
    height: 100vh;
    /* ارتفاع الشاشة الكامل */
    background: url('https://cdn.shopify.com/s/files/1/0745/2639/2561/files/imgi_4_public.webp?v=1760720364') center center/cover no-repeat;
    z-index: 1;
    /* التأكد من أن الصورة في الخلفية */
}

/* Partie droite : formulaire */
.speedaf-right {
    position: absolute;
    right: 0;
    width: 50%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    background: #fff;
    overflow-y: auto;
    z-index: 2;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
}

/* Formulaire */
.speedaf-form {
    width: 100%;
    padding: 40px 40px 40px 60px;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: none;
}

.form-title {
    font-size: 30px;
    font-weight: 700;
    color: #000;
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #ff6600;
    margin: 20px 0 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-section {
    margin-left: 20px;
    padding: 15px;
    background: #fff3e0;
    border-radius: 8px;
    border: 1px solid #ffe0b2;
}

.form-group {
    position: relative;
    margin-bottom: 14px;
}

.form-group label {
    position: absolute;
    top: 7px;
    left: 16px;
    font-size: 12px;
    color: #000;
    font-weight: 500;
    pointer-events: none;
    z-index: 1;
}

.form-group label .required {
    color: #ff0000;
    margin-left: 2px;
    font-size: 14px;
    font-weight: 700;
}

.form-group .tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 5px;
}

.form-group .tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background: #ff6600;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

.form-group .tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.speedaf-form input,
.speedaf-form select,
.speedaf-form textarea {
    width: 100%;
    padding: 26px 16px 9px 16px;
    border: 2px solid #ff6600;
    border-radius: 8px;
    font-size: 11px;
    outline: none;
    transition: 0.3s ease;
    background: #fff;
    color: #000;
    height: 54px;
    box-sizing: border-box;
}

.speedaf-form textarea {
    height: 120px;
    padding-top: 26px;
    resize: vertical;
}

.speedaf-form input::placeholder,
.speedaf-form select option:first-child,
.speedaf-form textarea::placeholder {
    color: #ccc;
    font-size: 14px;
}

.speedaf-form input:focus,
.speedaf-form select:focus,
.speedaf-form textarea:focus {
    border-color: #e85c00;
    box-shadow: 0 0 6px rgba(255, 102, 0, 0.3);
}

.speedaf-form input.error,
.speedaf-form select.error,
.speedaf-form textarea.error {
    border-color: #ff0000;
    background: #ffe8e8;
}

.speedaf-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
    cursor: pointer;
}

.speedaf-form select[multiple] {
    height: auto;
    padding: 10px 16px;
}

/* Style pour les champs de recherche */
.select-search-wrapper {
    position: relative;
}

.select-search-wrapper input[type="text"] {
    display: none;
    width: 100%;
    padding: 26px 16px 9px 16px;
    border: 2px solid #ff6600;
    border-radius: 8px;
    font-size: 10px;
    outline: none;
    background: #fff;
    color: #000;
    height: 54px;
}

.select-search-wrapper input[type="text"].error {
    border-color: #ff0000;
    background: #ffe8e8;
}

.select-search-wrapper.active input[type="text"] {
    display: block;
}

.select-search-wrapper.active select {
    display: none;
}

.select-search-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 150px;
    overflow-y: auto;
    background: #fff;
    border: 2px solid #ff6600;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 1000;
    display: none;
}

.select-search-list.show {
    display: block;
}

.select-search-list .optgroup-label {
    padding: 8px 16px;
    background: #fff3e0;
    color: #ff6600;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 1px solid #ffe0b2;
}

.select-search-list .option-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: 0.2s ease;
}

.select-search-list .option-item:hover {
    background: #fff3e0;
    color: #ff6600;
}

.select-search-list .option-item.selected {
    background: #ff6600;
    color: #fff;
}

.select-search-list::-webkit-scrollbar {
    width: 6px;
}

.select-search-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.select-search-list::-webkit-scrollbar-thumb {
    background: #ff6600;
    border-radius: 3px;
}

.phone-field {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 16px;
}

.phone-field label {
    position: absolute;
    top: 8px;
    left: 95px;
    font-size: 12px;
    color: #000;
    font-weight: 500;
    pointer-events: none;
    z-index: 1;
}

.phone-field label .required {
    color: #ff0000;
    margin-left: 2px;
    font-size: 14px;
    font-weight: 700;
}

.phone-field .prefix {
    background: #ff6600;
    color: #fff;
    padding: 0 14px;
    border-radius: 8px 0 0 8px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    border: 2px solid #ff6600;
    border-right: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 85px;
}

.phone-field input {
    border-radius: 0 8px 8px 0 !important;
    border-left: none !important;
    flex: 1;
    padding-left: 18px !important;
}

.btn-register {
    background: #ff6600;
    color: #fff;
    font-weight: 600;
    padding: 13px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
    font-size: 16px;
    transition: 0.3s ease;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    height: 50px;
}

.btn-register:hover {
    background: #e85c00;
    transform: translateY(-2px);
}

.error-message {
    background: #fff5f5;
    color: #e53e3e;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #e53e3e;
    text-align: left;
    margin-bottom: 24px;
    font-size: 14px;
    display: none;
    box-shadow: 0 4px 6px rgba(229, 62, 62, 0.05);
}

.error-message.show {
    display: block;
}

.error-message ul {
    list-style: none;
    padding: 0;
    margin: 5px 0 0;
    text-align: left;
}

.error-message ul li {
    margin-bottom: 5px;
}

/* Popup Success */
.speedaf-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    animation: fadeIn 0.3s ease;
}

.speedaf-popup-overlay.show {
    display: flex;
}

.speedaf-popup {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
    position: relative;
}

.speedaf-popup-icon {
    width: 80px;
    height: 80px;
    background: #ff6600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: scaleIn 0.5s ease;
}

.speedaf-popup-icon svg {
    width: 45px;
    height: 45px;
    fill: #fff;
}

.speedaf-popup h2 {
    color: #ff6600;
    font-size: 28px;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.speedaf-popup p {
    color: #555;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 25px 0;
}

.speedaf-popup-btn {
    background: #ff6600;
    color: #fff;
    border: none;
    padding: 14px 40px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.speedaf-popup-btn:hover {
    background: #e85c00;
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Responsive */
@media(max-width:1024px) {
    .speedaf-container {
        flex-direction: column;
    }

    .speedaf-left {
        position: static;
        /* إزالة التثبيت على الشاشات الصغيرة */
        min-height: 300px;
        width: 100%;
        background-size: cover;
        background-position: center center;
    }

    .speedaf-right {
        position: static;
        /* إزالة التثبيت */
        width: 100%;
        padding: 0;
    }

    .speedaf-form {
        max-width: 100%;
        padding: 30px 20px;
        width: 100%;
    }

    .speedaf-popup {
        padding: 30px 20px;
    }
}

/* Cacher l'image sur les petits écrans */
@media(max-width:768px) {
    .speedaf-left {
        display: none;
    }

    .speedaf-right {
        width: 100%;
        padding: 0;
    }

    .speedaf-form {
        padding: 25px 15px;
        width: 100%;
    }

    /* Responsive adjustments for order information */
    .order_data_column h4 {
        font-size: 14px;
    }

    .order_data_column div[style*="font-weight:600"] {
        font-size: 13px;
    }

    .order_data_column div[style*="padding:12px"] {
        padding: 10px;
        font-size: 14px;
    }
}

@media(max-width:768px) {
    .speedaf-left {
        min-height: 250px;
    }

    .speedaf-right {
        padding: 25px 15px;
    }

    .form-title {
        font-size: 26px;
        margin-bottom: 18px;
    }

    .section-title {
        font-size: 18px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .speedaf-form input,
    .speedaf-form select,
    .speedaf-form textarea {
        height: 52px;
        font-size: 14px;
    }

    .speedaf-form textarea {
        height: 100px;
    }

    .phone-field .prefix {
        min-width: 80px;
        font-size: 12px;
    }

    .select-search-list .option-item {
        font-size: 14px;
    }

    .form-group label .required {
        font-size: 12px;
    }
}

@media(max-width:480px) {
    .speedaf-left {
        min-height: 200px;
    }

    .speedaf-right {
        padding: 20px 15px;
    }

    .form-title {
        font-size: 24px;
    }

    .section-title {
        font-size: 16px;
    }

    .speedaf-form input,
    .speedaf-form select,
    .speedaf-form textarea {
        font-size: 13px;
    }

    .select-search-list .option-item {
        font-size: 13px;
    }

    /* Additional responsive adjustments for very small screens */
    .order_data_column div[style*="display:grid"] {
        grid-template-columns: 1fr;
    }

    .order_data_column div[style*="grid-column:1 / -1"] {
        grid-column: 1;
    }
}