/* ============================================================================
   MODALS.CSS - INDICE DE NAVEGACION
   ============================================================================
   Buscar [MXX] para saltar a cada seccion. Ejemplo: Ctrl+F -> [M04]

   [M01] MODALS (BASE) ................. .modal, .modal-content, slideUp
   [M02] LOGIN OTP MODAL ............... .login-otp-modal, #registro-*
   [M03] MODAL SCREENS & TRANSITIONS ... .modal-screen, slide-in/out
   [M04] MODAL FORMS & PHONE INPUT ..... .form-input, .phone-input-*
   [M05] OTP SECTION ................... .otp-input, .otp-display
   [M06] MODAL BUTTONS & NOTIFICATIONS . .btn-submit, .app-notification
   [M07] OVERLAY ADJUSTMENTS & PHANTOM . .login-otp-overlay, .phantom-*
   [M08] MASTER SYSTEM ................. .active states, default hidden
   [M09] RESPONSIVE (MEDIA QUERIES) .... 640px, 480px modal overrides
   ============================================================================ */
/* ==========================================================================
   [M01] MODALS (BASE)
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: end;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    width: 100%;
    max-width: 550px;
    height: 90vh;
    border-radius: 30px 30px 0 0;
    padding: 25px;
    overflow-y: auto;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-sizing: border-box;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}


/* ==========================================================================
   [M02] LOGIN OTP MODAL - El modal en sí
   ========================================================================== */
.login-otp-modal {
    width: 100%;
    max-width: 400px;
    border-radius: 28px;
    overflow: hidden;
    position: relative !important;
    margin: 0 !important;
    transform: none !important;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.login-otp-modal .modal-content-wrapper,
#registro-cliente-card {
    pointer-events: auto;
}

/* ============================================================================
   [M02a] MODAL CONTENT WRAPPER - Ajuste para el wrapper de contenido
   Sin padding lateral: la franja roja debe tocar los bordes
   ============================================================================ */
.modal-content-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    position: relative;
    background: white;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
   [M02b] MODAL ACCENT LINE - Franja Roja
   Toca los bordes laterales; border-radius superior para encajar con el modal
   ============================================================================ */
.modal-accent-line {
    width: 100% !important;
    min-width: 100%;
    height: 12px !important;
    background: linear-gradient(90deg, #ce2029, #f43f5e) !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10;
    border-radius: 28px 28px 0 0 !important;
    flex-shrink: 0;
}

/* ============================================================================
   [M02c] MODAL BODY PADDING - Relleno interno del contenido (clase única)
   Padding consistente en todas las pantallas; el contenido no toca los bordes
   ============================================================================ */
.modal-body-padding {
    padding: 40px 30px 30px 30px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

/* Modal de registro cliente: centrado, sin scroll en contenedor */
#registro-cliente-modal {
    overflow: hidden;
}

#registro-cliente-card {
    max-height: 90vh;
    overflow: hidden;
}

/* Box-sizing global para modales */
.modal-content-wrapper *,
#registro-cliente-card * {
    box-sizing: border-box;
}

/* Ensure direct children are full width and don't overflow */
.login-otp-modal>* {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Phone input en modales: no desbordar ancho */
.modal-body-padding .phone-input-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Formularios dentro del modal: centrado horizontal */
.modal-body-padding form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
}
.modal-body-padding form > label,
.modal-body-padding form > .phone-input-container,
.modal-body-padding form > div {
    align-self: stretch;
}
.modal-body-padding form label {
    text-align: center;
    margin-left: 0;
}

/* ==========================================================================
   [M03] MODAL SCREENS & TRANSITIONS
   #login-otp-overlay.modal-overlay-base (index y solicitar_negocio): intercambio por .active
   ========================================================================== */

#login-otp-overlay.modal-overlay-base .modal-screen {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: none;
    flex-direction: column;
    min-width: 0;
}

#login-otp-overlay.modal-overlay-base .modal-screen.active {
    display: flex !important;
    flex-direction: column;
}

#login-otp-overlay.modal-overlay-base .modal-content-wrapper > .modal-body-padding {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* [ELIMINADO] Regla duplicada de .modal-content-wrapper - ahora en [M02a] */


/* ==========================================================================
   [M04] MODAL FORMS & PHONE INPUT
   ========================================================================== */
.modal-title {
    margin: 0 0 20px 0;
    color: #ce2029;
    font-weight: 900;
    font-size: 24px;
    text-align: center;
}

#link-problemas-login {
    position: relative;
    z-index: 1000002;
}

.modal-title-inicia-sesion {
    color: #2a2a2a;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modal-title-inicia-sesion .fa-right-to-bracket {
    color: #D32F2F;
    font-size: 1.1em;
}

.modal-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: center;
}

.modal-error-message {
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    margin-top: 0.75rem;
    line-height: 1.4;
}
.modal-error-message.hidden {
    display: none;
}

/* Form Row - Nombre y Apellido lado a lado */
.form-row {
    display: flex;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.form-group-half {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

/* Form Elements - All Responsive */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #333;
    font-size: 14px;
}

.form-label .asterisk {
    color: #ff0000;
}

.form-input.email-invalid {
    border-color: #ff0000;
}

.form-email-error {
    color: #ff0000;
    font-size: 12px;
    margin-top: -10px;
    margin-bottom: 12px;
    display: none;
}

.form-email-error.visible {
    display: block;
}

#map.map-registro {
    display: none;
    position: relative;
    width: 100%;
    height: 150px;
    border-radius: 8px;
    border: 2px solid #ddd;
    margin-top: 0;
    margin-bottom: 0;
    box-sizing: border-box;
}

#map.map-registro.map-visible {
    display: block;
    margin-top: 10px;
    margin-bottom: 15px;
}

.map-badge-ubicacion {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: transparent;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.map-badge-ubicacion::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #ce2029;
    opacity: 0.6;
    border-radius: inherit;
    z-index: -1;
}

.map-badge-ubicacion:hover::before {
    filter: brightness(1.1);
}

.map-badge-ubicacion:disabled {
    cursor: not-allowed;
}

.map-badge-ubicacion:disabled::before {
    opacity: 0.5;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 15px;
    box-sizing: border-box;
    max-width: 100%;
    font-family: inherit;
}

.form-help-text {
    color: #666;
    display: block;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.4;
}

/* Phone Input Container - Responsive */
.phone-input-container {
    display: flex;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.phone-input-container:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Recovery Modal - Label Hierarchy (bajar intensidad del rojo) */
#form-recovery-email label {
    color: #94a3b8 !important;
    /* Un slate-400 suave */
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.phone-input-dual {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
}

.phone-input-dual .phone-country-field,
.phone-input-dual .phone-number-input {
    margin-bottom: 0;
}

.phone-country-field {
    position: relative;
    flex-shrink: 0;
    min-width: 110px;
    max-width: 140px;
    min-height: 44px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    border-radius: 8px 0 0 8px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.phone-flag-display {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    display: inline-block;
    padding: 0;
    pointer-events: none;
}

.phone-country-select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.phone-country-trigger {
    flex: 1;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 6px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    background: transparent;
    box-sizing: border-box;
}

.phone-country-trigger:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(206, 32, 41, 0.25);
}

.phone-country-code {
    flex: 0 0 auto;
}

.phone-country-arrow {
    flex-shrink: 0;
    font-size: 10px;
    color: #333;
    pointer-events: none;
}

.phone-country-dropdown {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.phone-country-dropdown.is-open {
    display: block;
}

.phone-country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

.phone-country-option:hover {
    background: #f0f0f0;
}

.phone-country-option .fi {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-block;
}

.phone-input-dual .phone-number-input {
    min-height: 44px;
    border-radius: 0 8px 8px 0;
    border: 1px solid #e0e0e0;
    border-left: none;
    box-sizing: border-box;
}

.phone-input-dual .phone-number-input:focus {
    border-left: none;
    border-color: #e0e0e0;
}

.phone-country-wrapper {
    position: relative;
    flex-shrink: 0;
    min-width: 100px;
    max-width: 140px;
}

.phone-country-select {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    appearance: none;
    background: white;
    cursor: pointer;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23333" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    box-sizing: border-box;
    font-family: inherit;
}

.country-flag-display {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 18px;
    z-index: 1;
}

.phone-number-input {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   [M05] OTP SECTION
   [M05] OTP SECTION
   ========================================================================== */
.otp-input-wrapper {
    margin: 30px 0;
    text-align: center;
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 280px;
}

.otp-input {
    width: 100%;
    text-align: center;
    letter-spacing: 12px;
    font-size: 32px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    padding: 20px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #f8f9fa;
    color: transparent;
    caret-color: #ce2029;
    position: relative;
    z-index: 2;
}

.otp-input:focus {
    border-color: #ce2029;
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(206, 32, 41, 0.1);
}

.otp-input::placeholder {
    color: transparent;
}

/* Display visual de dígitos OTP */
.otp-display {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    font-size: 32px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 12px;
    color: #333;
    padding: 20px;
    border-radius: 12px;
}

/* Wrapper OTP: ancho fijo para overlay alineado con inputs */
.otp-segmented-wrapper {
    position: relative;
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Segmented OTP (6 cajas): overlay con space-between para alinear con inputs */
.otp-input-wrapper:has(.otp-segmented) .otp-display,
.otp-segmented-wrapper .otp-display {
    padding: 0;
    gap: 0;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    font-size: 24px;
    letter-spacing: 0;
}
.otp-display-digit {
    width: 40px;
    height: 50px;
    min-width: 40px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Courier New', Consolas, monospace;
    color: #111827;
    flex-shrink: 0;
    line-height: 1;
    box-sizing: border-box;
}

.otp-actions {
    text-align: center;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.change-number-link {
    font-size: 13px;
    color: #666;
    text-decoration: none;
}

.change-number-link:hover {
    color: #ce2029;
    text-decoration: underline;
}

.change-number-link a {
    color: #666;
    text-decoration: none;
}

.change-number-link a:hover {
    color: #ce2029;
    text-decoration: underline;
}

.resend-link {
    color: #ce2029;
    text-decoration: none;
    font-weight: 700;
}

.resend-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   [M06] MODAL BUTTONS & NOTIFICATIONS
   [M06] MODAL BUTTONS & NOTIFICATIONS
   ========================================================================== */
.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    min-width: 120px;
    flex: 1;
    max-width: 100%;
}

.btn-cancel {
    background: transparent !important;
    color: #666666 !important;
    font-weight: 600 !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-decoration: underline;
}

.btn-submit {
    background: #ce2029;
    color: white;
}

.btn-cancel:hover,
.btn-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Register customer modal fixes */
.register-customer-card {
    box-sizing: border-box;
    height: auto;
    min-height: 0;
    overflow: visible;
}

.register-cancel-btn {
    display: block;
    width: 100%;
    text-align: center;
}

/* App Notifications - Responsive */
.app-notification {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom, 0));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0));
    border-radius: 25px;
    z-index: 999999;
    font-size: 14px;
    font-weight: 500;
    max-width: calc(100% - 40px);
    box-sizing: border-box;
    text-align: center;
    word-wrap: break-word;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.app-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.app-notification.notification-success {
    background: rgba(40, 167, 69, 0.9);
}

.app-notification.notification-error {
    background: rgba(220, 53, 69, 0.9);
}

.app-notification.notification-info {
    background: rgba(0, 123, 255, 0.9);
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    margin-right: 8px;
    animation: btnSpin 0.8s linear infinite;
    vertical-align: -2px;
}

@keyframes btnSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Prevent horizontal scroll on body when modal is open */
body.modal-open {
    overflow-x: hidden;
    overflow-y: hidden;
    position: fixed;
    width: 100%;
}

/* Asegurar que el body no esté bloqueado al inicio */
body:not(.modal-open) {
    overflow: auto !important;
    overflow-y: auto !important;
}

.login-modal-animate {
    animation: loginModalIn 0.3s ease;
}

@keyframes loginModalIn {
    0% {
        opacity: 0;
        transform: scale(0.96);
    }

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

/* Contenedor OTP: ancho fijo, sin auto ni inline-flex */
.otp-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Contenedor de los 6 inputs: ancho fijo y rígido (position: relative para overlay) */
.otp-segmented-wrapper {
    position: relative;
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    box-sizing: border-box;
}

.otp-segmented {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    flex-wrap: nowrap;
    box-sizing: border-box;
}

.otp-digit {
    width: 40px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 16px;
    padding: 0;
    box-sizing: border-box;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(15, 23, 42, 0.12);
    outline: none;
    transition: all 0.2s ease;
    /* Anti-puntos negros: no estilo password ni apariencia nativa de contraseña */
    background: white !important;
    color: black !important;
    -webkit-text-security: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    font-family: 'Courier New', Consolas, monospace !important;
}

.otp-digit:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(206, 32, 41, 0.9);
    box-shadow: 0 0 0 3px rgba(206, 32, 41, 0.2);
}

/* Garantizar que los inputs OTP muestren números visibles (nunca estilo password) */
input.otp-digit {
    -webkit-text-security: none !important;
}

/* Máxima prioridad: OTP digit y cualquier input con clase otp- (evitar puntos negros Safari/Chrome) */
.otp-digit,
input[class*='otp-'] {
    -webkit-text-security: none !important;
    text-security: none !important;
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    font-family: 'Courier New', Consolas, monospace !important;
}

/* Input OTP: texto invisible; solo .otp-display muestra los dígitos (evita doble número / puntos) */
.otp-digit,
input[class*='otp-'] {
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: none !important;
    caret-color: #ce2029 !important;
}

.otp-disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* Mensaje de error dentro del modal OTP: visible y centrado (no usar toasts) */
#otp-modal-message {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    min-height: 1.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25;
}
#otp-modal-message:empty,
#otp-modal-message.hidden {
    display: none !important;
}
#otp-modal-message:not(.hidden):not(:empty) {
    display: block !important;
    visibility: visible;
    opacity: 1;
}

/* Ensure all modals and overlays are responsive */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* Prevent text overflow */
input,
textarea,
select,
button {
    max-width: 100%;
    box-sizing: border-box;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   [M07] OVERLAY ADJUSTMENTS & PHANTOM
   [M07] OVERLAY ADJUSTMENTS & PHANTOM
   ========================================================================== */
/* ============================================================================
   MODAL OVERLAY BASE - Clase comun para overlays que cierra ModalController
   display:grid + place-items:center = centrado infalible
   ============================================================================ */
/* Regla base absoluta: oculto hasta que .active lo muestre */
.modal-overlay-base {
    display: none !important;
    place-items: center;
    padding: 15px;
}

/* ============================================================================
   OVERLAY: Centrado Infalible con CSS Grid - padding:15px seguridad movil
   ============================================================================ */
.login-otp-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000 !important;
    place-items: center !important;
    padding: 20px;
    overflow: hidden;
    box-sizing: border-box;
}

.phantom-header {
    margin-bottom: 25px;
    text-align: center;
}

.phantom-title {
    margin: 0;
    color: #2d3436;
    font-weight: 800;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.phantom-title i {
    color: #d63031;
}

.phantom-desc {
    color: #636e72;
    font-size: 14px;
    margin-top: 8px;
    line-height: 1.5;
}

.phantom-form-group {
    margin-bottom: 20px;
}

.phantom-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #2d3436;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.phantom-input-field {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: #f9f9f9;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    font-size: 15px;
    color: #2d3436;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.phantom-input-field:focus {
    background: #fff;
    border-color: #d63031;
    outline: none;
    box-shadow: 0 0 0 4px rgba(214, 48, 49, 0.1);
}

.phantom-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-phantom-cancel {
    background: transparent;
    color: #636e72;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}

.btn-phantom-cancel:hover {
    background: #f5f6fa;
    color: #2d3436;
}

.btn-phantom-submit {
    flex: 1;
    background: linear-gradient(135deg, #ff4757, #e84118);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(232, 65, 24, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-phantom-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(232, 65, 24, 0.4);
}

/* ==========================================================================

/* ==========================================================================
   [M08] MASTER SYSTEM (MODALS/OVERLAYS)
   All modals/overlays hidden by default, shown via .active class
   ========================================================================== */

/* Overlays sin .modal-overlay-base: ocultos por defecto */
#overlay-publicitario {
    display: none;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
}

/* ==========================================================================
   Modal enter animations (fluid open, no abrupt appearance)
   ========================================================================== */
@keyframes modalOverlayEnter {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* Solo animar scale para no depender de opacity (evitar modal invisible) */
@keyframes modalContentEnter {
    from { transform: scale(0.96); }
    to { transform: scale(1); }
}
.modal-overlay-base.active.modal-overlay-enter {
    animation: modalOverlayEnter 0.22s ease-out forwards;
}
#registro-cliente-modal.modal-content-enter,
#registro-modal.modal-content-enter,
#login-otp-modal.modal-content-enter {
    animation: modalContentEnter 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

/* ACTIVE STATE: Shown and interactive - .modal-overlay-base controls visibility */
.modal-overlay-base.active {
    display: grid !important;
    place-items: center;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

#login-otp-modal.active {
    display: flex;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

#registro-cliente-overlay.active,
#registro-overlay.active {
    z-index: 999999 !important;
}

#registro-cliente-modal.active {
    display: flex;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    z-index: 1000000 !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

#registro-modal.active {
    display: flex;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    z-index: 100000;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

#overlay-publicitario.active {
    display: flex;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    z-index: 200000;
}

/* Hamburger menu overlay - hidden by default */
.menu-hamburguesa-overlay {
    pointer-events: none;
}

.menu-hamburguesa-overlay.active {
    pointer-events: auto;
}

/* ==========================================================================
   [M09] RESPONSIVE (MEDIA QUERIES)
   Consolidado: sin reglas de accent-stripe (ya no necesita border-radius)
   ========================================================================== */

/* --- Mobile/tablet: dvh solo en mobile (teclado), safe-area, 420px --- */
@media (max-width: 768px) {
    .login-otp-modal,
    #login-otp-modal,
    .modal-content-wrapper,
    #registro-cliente-card,
    #registro-modal {
        max-width: 420px;
        width: 92vw;
        max-height: 90dvh;
        overflow-y: auto;
        padding-top: env(safe-area-inset-top, 0);
    }
    .login-otp-overlay .modal-content-wrapper,
    #registro-overlay .modal-content-wrapper,
    #registro-cliente-overlay .modal-content-wrapper {
        padding-top: env(safe-area-inset-top, 0);
    }
}

/* --- Small screens (max-width: 640px) --- */
@media (max-width: 640px) {
    .login-otp-overlay {
        padding: 12px !important;
    }

    .modal-content-wrapper {
        border-radius: 2rem !important;
        max-height: 95vh !important;
        overflow-y: auto !important;
    }

    .modal-accent-line {
        border-radius: 2rem 2rem 0 0 !important;
    }

    .modal-body-padding {
        padding: 30px 20px 20px 20px !important;
    }

    .otp-segmented {
        gap: 8px;
    }

    .otp-input-wrapper:has(.otp-segmented) .otp-display {
        gap: 8px;
    }

    .otp-digit {
        width: 40px;
        height: 50px;
        font-size: 16px;
    }

    .otp-display-digit {
        width: 40px;
        height: 50px;
        min-width: 40px;
        min-height: 50px;
        font-size: 16px;
    }

    .modal-screen {
        padding: 12px !important;
        /* min-height removed */
    }
}

/* --- Mobile (max-width: 480px) --- */
@media (max-width: 480px) {
    .login-otp-overlay {
        padding: 10px;
        align-items: center;
        /* Asegura que no se pegue al techo */
    }

    .login-otp-modal {
        max-width: 95%;
        /* Casi todo el ancho pero con aire */
        max-height: 90vh;
        /* No toca los bordes superior/inferior */
    }

    .modal-content-wrapper {
        max-height: 90vh !important;
        border-radius: 1.75rem !important;
    }

    .modal-accent-line {
        border-radius: 1.75rem 1.75rem 0 0 !important;
    }

    .modal-body-padding {
        padding: 20px 24px 30px 24px !important;
    }

    .form-input {
        padding: 10px;
        font-size: 14px;
    }

    .phone-country-wrapper {
        min-width: 90px;
        max-width: 120px;
    }

    .phone-country-select {
        padding: 10px 10px 10px 35px;
        font-size: 13px;
    }

    .btn-cancel,
    .btn-submit {
        width: 100%;
        max-width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group-half {
        margin-bottom: 15px;
    }

    .otp-input {
        font-size: 24px;
        letter-spacing: 8px;
        padding: 15px;
        max-width: 100%;
    }

    .app-notification {
        bottom: 15px;
        padding: 10px 16px;
        font-size: 13px;
        max-width: calc(100% - 20px);
        border-radius: 20px;
    }
}