/**
 * Cropac Popup Module - Complete Styling
 * All styles for popup overlay, form, inputs, validation, and success message
 * Fully responsive for desktop and mobile
 */

/* ============================================================================
   POPUP OVERLAY & CONTAINER
   ============================================================================ */

/* Popup Overlay - Dark background backdrop */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.popup-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Popup Wrapper - For positioning close button outside */
.popup-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 700px;
}

/* Popup Box - Background image with form overlay */
.popup-box {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    aspect-ratio: 1 / 1.22;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

/* Crawler Cranes Popup */
.popup-box.crawler-cranes-popup {
    background-image: url('../images/popups/popup-meada-crawler-rental-desktop.png');
}

/* Spider Cranes Popup */
.popup-box.spider-cranes-popup {
    background-image: url('../images/popups/popup-meada-spider-rental-desktop.png');
}

.popup-image {
    display: none;
}

.mobile-image {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================================================
   CLOSE BUTTON
   ============================================================================ */

/* Close Button - Positioned outside popup */
.popup-close {
    position: absolute;
    top: -20px;
    right: -60px;
    width: 50px;
    height: 50px;
    background-color: white;
    border: none;
    border-radius: 50%;
    font-size: 32px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0;
    line-height: 1;
    z-index: 1000;
}

.popup-close:hover {
    background-color: #f0f0f0;
    color: #000;
    transform: rotate(90deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   FORM STYLING
   ============================================================================ */

/* Popup Form Container */
.popup-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 250px;
    position: relative;
    top: 17.5%;
    left: 28%;
}

/* Form Group */
.form-group {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

/* Form Inputs */
.form-group input,
.form-group textarea {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: rgba(255, 255, 255, 0.95);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    font-size: 12px;
    text-align: center;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group input.error,
.form-group textarea.error {
    border-color: #d32f2f;
    background-color: rgba(211, 47, 47, 0.05);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.form-group input.error:focus,
.form-group textarea.error:focus {
    border-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.15);
}

/* ============================================================================
   FORM TEXT & LABELS
   ============================================================================ */

.select-input-text-main {
    font-size: 17px;
    font-weight: 500;
    color: #322f82;
    text-align: right;
    margin-top: 15px;

    margin-bottom: 15px;
    line-height: 1.5;
}

.select-input-text-sub {
    font-size: 14px;
    font-weight: 600;
    color: #000;
    text-align: right;
    margin-top: 5px;
    margin-bottom: 2px;
    line-height: 1.5;
}

.select-radio-text {
    font-size: 17px;
    font-weight: 500;
    color: #322f82;
    text-align: right;
    margin-bottom: 8px;
    line-height: 1.5;
}

/* ============================================================================
   RADIO BUTTON STYLING
   ============================================================================ */

/* Container for the single row: label on left, radio on right */
.radio-row {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    padding: 4px 0;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
}

.radio-row:hover {
    opacity: 0.85;
}

/* Text label styling */
.radio-label {
    font-size: 12px;
    color: #475569;
    font-weight: 500;
    padding-right: 7px;
    transition: color 0.15s ease;
}

.radio-row:hover .radio-label {
    color: #322f82;
}

/* Absolutely hide default browser radio input */
.hidden-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom visual circular wrapper */
.custom-radio {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background-color: #ffffff;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hover border highlight */
.radio-row:hover .custom-radio {
    border-color: #94a3b8;
}

/* Custom inner red indicator dot */
.custom-radio::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #322f82;
    transform: scale(0);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Active/Checked Outer Border state */
.hidden-radio:checked + .custom-radio {
    border-color: #322f82;
}

/* Active/Checked Inner Dot state */
.hidden-radio:checked + .custom-radio::after {
    transform: scale(1);
}

/* ============================================================================
   SUBMIT BUTTON
   ============================================================================ */

.popup-submit {
    padding: 12px 20px;
    background-color: #322f82;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 10px;
}

.popup-submit:hover {
    background-color: #000000;
}

.popup-submit:active {
    transform: scale(0.98);
}

.popup-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================================
   ERROR MESSAGES
   ============================================================================ */

.form-error {
    display: none;
    color: #d32f2f;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
    margin-bottom: 8px;
    animation: slideDownError 0.3s ease-out;
    line-height: 1.3;
}

@keyframes slideDownError {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form-level alert error */
.form-alert-error {
    display: none;
    background-color: #ffebee;
    border: 1px solid #d32f2f;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #c62828;
    font-size: 13px;
    font-weight: 500;
    animation: slideDownError 0.3s ease-out;
    line-height: 1.4;
}

/* ============================================================================
   SUCCESS MESSAGE
   ============================================================================ */

.success-message {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    animation: fadeInSuccess 0.4s ease-out;
}

.success-message.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeInSuccess {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Success Card */
.success-card {
    background-color: #0a8c14;
    border-radius: 22px;
    padding: 20px 22px;
    color: #ffffff;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 20px 40px rgba(10, 140, 20, 0.3);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Success Header Layout */
.success-header-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

/* Checkmark Circle */
.success-checkmark-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.success-checkmark-svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #0a8c14;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Success Title */
.success-title-container {
    text-align: left;
}

.success-title {
    font-weight: 900;
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: -0.5px;
    color: #ffffff;
    text-transform: uppercase;
}

/* Success Divider */
.success-divider {
    height: 3px;
    background-color: #ffffff;
    border-radius: 99px;
    width: 100%;
    margin-bottom: 20px;
    opacity: 1;
}

/* Success Message Text */
.success-message-text {
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 19px;
}

.success-message-highlight {
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 19px;
}

/* Success Callout */
.success-callout-label {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 8px;
    line-height: 1.4;
}

.success-phone-number {
    font-weight: 900;
    font-size: 20px;
    letter-spacing: -0.2px;
    color: #ffffff;
    display: block;
    margin-top: 4px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.success-phone-number:hover {
    opacity: 0.8;
}

/* ============================================================================
   RESPONSIVE DESIGN - MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    
    #serviceFormPopup {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        overflow-y: auto;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 999;
    }

    .popup-wrapper {
        min-height: 100%;
        height: auto;
        margin: auto;
        display: block;
    }

    .popup-overlay.active {
        overflow-y: auto;
        display: flex;
    }

    .popup-image {
        display: block;
        max-width: 100%;
        height: auto;
    }

    .mobile-image {
        display: block;
    }

    .mobile-logo {
        max-width: 200px;
        height: auto;
        margin: 10px auto 0 auto;
    }

    .mobile-heading-text {
        font-size: 30px;
        font-weight: 1000;
        color: #000;
        text-align: center;
        margin-top: 15px;
        line-height: 1;
        margin-bottom: 0;
    }

    .popup-box {
        display: block;
        flex-direction: column;
        aspect-ratio: auto;
        background-image: none;
        width: 100%;
        margin: auto;
        padding: 20px 0;
        background-color: #ffffff;
    }

    .popup-close {
        position: absolute;
        top: 2%;
        left: 85%;
        width: 40px;
        height: 40px;
        font-size: 30px;
    }

    .popup-form {
        max-width: 90%;
        margin: 0 auto;
        position: static;
        top: 0;
        left: 0;
        margin-top: 10px;
    }

    .select-input-text-main {
        font-size: 16px;
        margin-top: 15px;

        margin-bottom: 15px;
        text-align: center;
    }

    .select-input-text-main-sub {
        font-size: 12px;
        text-align: center;
        margin-bottom: 5px;
        font-weight: 600;
    }

    .select-input-text-sub {
        font-size: 14px;
        margin-bottom: 15px;
        text-align: center;
    }

    .select-radio-text {
        font-size: 16px;
        margin-bottom: 6px;
        text-align: center;
    }

    .form-group input,
    .form-group textarea {
        font-size: 14px;
        padding: 8px 16px;
        border: 1px solid #ccc;
        border-radius: 4px;
        width: 100%;
        box-sizing: border-box;
    }

    .radio-row {
        display: flex;
        justify-content: center;
        width: 100%;
        padding: 4px 0;
        cursor: pointer;
        user-select: none;
        transition: opacity 0.15s ease;
    }

    .hidden-radio:checked + .custom-radio {
        order: -1;
    }

    .radio-label {
        order: 1;
        margin-left: 8px;
        font-size: 15px;
        color: #475569;
        font-weight: 500;
        padding-right: 7px;
        transition: color 0.15s ease;
    }

    .popup-submit {
        width: 100%;
        padding: 10px 12px;
        font-size: 16px;
    }

}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.justify-between {
    justify-content: space-between;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}
