/**
 * ACME Form Modal Styles
 * Accessible modal implementation for form display.
 */

/* Button base styles (modal trigger & submit button) */
.acme-modal-trigger,
.acme-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    line-height: 1;
}

.acme-modal-trigger:hover,
.acme-submit-btn:hover {
    background-color: #0056b3;
}

.acme-modal-trigger:focus,
.acme-submit-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Button sizes */
.acme-modal-trigger.acme-btn-size-xs,
.acme-submit-btn.acme-btn-size-xs {
    padding: 6px 12px;
    font-size: 12px;
}

.acme-modal-trigger.acme-btn-size-sm,
.acme-submit-btn.acme-btn-size-sm {
    padding: 10px 20px;
    font-size: 14px;
}

.acme-modal-trigger.acme-btn-size-md,
.acme-submit-btn.acme-btn-size-md {
    padding: 24px 24px;
    font-size: 15px;
    font-weight: 500;
}

.acme-modal-trigger.acme-btn-size-lg,
.acme-submit-btn.acme-btn-size-lg {
    padding: 16px 32px;
    font-size: 18px;
}

.acme-modal-trigger.acme-btn-size-xl,
.acme-submit-btn.acme-btn-size-xl {
    padding: 20px 40px;
    font-size: 20px;
}

/* Style 1 – Branded Pill */
.acme-modal-trigger.acme-btn-style-1,
.acme-submit-btn.acme-btn-style-1 {
    background-color: var(--e-global-color-92aa8be);
    color: var(--e-global-color-daa8797, #fff);
    fill: var(--e-global-color-daa8797, #fff);
    border-radius: 100px;
    text-transform: uppercase;
    text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
    gap: 18px;
}

.acme-modal-trigger.acme-btn-style-1:hover,
.acme-submit-btn.acme-btn-style-1:hover {
    opacity: 1;
}

/* Style 2 – Classic */
.acme-modal-trigger.acme-btn-style-2,
.acme-submit-btn.acme-btn-style-2 {
    background-color: #007bff;
    color: #fff;
    fill: #fff;
    border-radius: 4px;
    text-transform: none;
    text-shadow: none;
    gap: 18px;
}

.acme-modal-trigger.acme-btn-style-2:hover,
.acme-submit-btn.acme-btn-style-2:hover {
    background-color: #0056b3;
}

/* Style 3 – Outline */
.acme-modal-trigger.acme-btn-style-3,
.acme-submit-btn.acme-btn-style-3 {
    background-color: transparent;
    color: var(--e-global-color-92aa8be, #007bff);
    fill: var(--e-global-color-92aa8be, #007bff);
    border: 2px solid currentColor;
    border-radius: 100px;
    text-transform: uppercase;
    text-shadow: none;
    gap: 18px;
}

.acme-modal-trigger.acme-btn-style-3:hover,
.acme-submit-btn.acme-btn-style-3:hover {
    background-color: var(--e-global-color-92aa8be, #007bff);
    color: #fff;
    fill: #fff;
}

/* Style 4 – Dark */
.acme-modal-trigger.acme-btn-style-4,
.acme-submit-btn.acme-btn-style-4 {
    background-color: #1a1a2e;
    color: #fff;
    fill: #fff;
    border-radius: 8px;
    text-transform: uppercase;
    text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
    gap: 18px;
}

.acme-modal-trigger.acme-btn-style-4:hover,
.acme-submit-btn.acme-btn-style-4:hover {
    background-color: #16213e;
}

/* Button content wrapper */
.acme-button-content-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    flex-direction: column;
}

/* Button icon */
.acme-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    border-right: 1px solid;
    padding-right: 17px;
    padding-top: 6.5px;
    padding-bottom: 6.5px;
}

.acme-button-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.acme-button-icon i {
    font-size: 1.2em;
    line-height: 1;
}

/* Button text */
.acme-button-text {
    flex-shrink: 0;
}

/* Button secondary text */
.acme-button-text-secondary {
    display: block;
    width: 100%;
    font-weight: 400;
    font-size: 14px;
}

/* Modal container */
.acme-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: acmeModalFadeIn 0.3s ease;
}

.acme-modal.acme-modal-open {
    display: flex;
}

/* Modal overlay (backdrop) */
.acme-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    animation: acmeModalOverlayFadeIn 0.3s ease;
}

/* Modal content card */
.acme-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    z-index: 1;
    animation: acmeModalSlideIn 0.3s ease;
}

/* Close button */
.acme-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 28px;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acme-modal-close:hover {
    color: #000;
    transform: scale(1.1);
}

.acme-modal-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 50%;
}

/* Prevent body scroll when modal is open */
body.acme-modal-open {
    overflow: hidden;
}

/* Animations */
@keyframes acmeModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* Drag handle — hidden by default, shown on mobile */
.acme-modal-drag-handle {
    display: none;
    justify-content: center;
    padding: 8px 0 4px;
    cursor: grab;
    touch-action: none;
}

.acme-modal-drag-handle span {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.2);
}

/* Slide-up animation for mobile bottom sheet */
@keyframes acmeModalSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Dismissing transition (applied via JS during swipe close) */
.acme-modal-content.acme-modal-dismissing {
    transition: transform 0.3s ease;
}

/* ── Mobile bottom sheet (≤ 640px) ── */
@media (max-width: 640px) {
    .acme-modal {
        align-items: flex-end;
    }

    .acme-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0;
        max-height: 95dvh;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        animation: acmeModalSlideUp 0.3s ease;
    }

    .acme-modal-close {
        top: 8px;
        right: 8px;
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.06);
        border-radius: 50%;
        font-size: 24px;
        z-index: 2;
    }

    .acme-modal-drag-handle {
        display: flex;
    }

    /* ── Form spacing inside modal ── */

    /* Neutralize Bootstrap row negative margins */
    .acme-modal .acme-form.row {
        margin-left: 0;
        margin-right: 0;
        gap: 10px;
    }

    /* Neutralize Bootstrap column gutter padding */
    .acme-modal .acme-form [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
    }

    /* Form title label */
    .acme-modal .acme-form-label {
        margin-bottom: 8px;
        font-size: 15px;
    }

    /* Field labels — tighter spacing */
    .acme-modal .acme-field-label {
        margin-bottom: 2px;
        font-size: 13px;
    }

    /* Field wrappers (p and div) — compact vertical rhythm */
    .acme-modal p.acme-field,
    .acme-modal div.acme-field {
        margin-bottom: 0;
    }

    /* Choice fields: override Bootstrap justify-content-between */
    .acme-modal .acme-field-choice.justify-content-between {
        justify-content: flex-start !important;
    }

    /* Steps bar — compact but separated from content */
    .acme-modal .acme-steps-bar {
        margin-bottom: 14px;
        padding-bottom: 14px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .acme-modal .acme-step-separator {
        width: 24px;
        margin: 0 6px;
    }

    .acme-modal .acme-step-label {
        font-size: 12px;
    }

    /* Submit button — full width */
    .acme-modal .acme-submit-btn {
        width: 100%;
        margin-top: 4px;
    }

    /* Inputs — full width, vertically centered text, prevent iOS zoom */
    .acme-modal .acme-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    .acme-modal .acme-form select,
    .acme-modal .acme-form textarea {
        width: 100% !important;
        box-sizing: border-box;
        font-size: 16px !important;
        line-height: 1.4;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .acme-modal .acme-form select {
        height: auto;
    }
}

/* ── Tablet (641px – 1024px) ── */
@media (min-width: 641px) and (max-width: 1024px) {
    .acme-modal-content {
        width: 90% !important;
        max-width: min(90vw, 700px) !important;
        border-radius: 12px;
        padding: 24px;
    }

    .acme-modal-close {
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.06);
        border-radius: 50%;
    }

    /* Tighter form spacing on tablet */
    .acme-modal .acme-form-label {
        margin-bottom: 12px;
    }

    .acme-modal .acme-submit-btn {
        width: 100%;
    }
}

/* Accessibility: Focus trap visual indicator */
.acme-modal-content:focus {
    outline: none;
}

/* Form inside modal adjustments */
.acme-modal .acme-form {
    margin: 0;
}

.acme-modal .acme-form-label {
    margin-bottom: 20px;
}
