/* ============================================================
   Integra GYM - Estilos para pagina de login
   Dark first, mobile first, accesibilidad AA.
   ============================================================ */

.auth-body {
    min-height: 100dvh;
    background:
        radial-gradient(1200px 600px at 50% -100px, rgba(0, 204, 204, 0.15) 0%, rgba(20, 20, 20, 0) 60%),
        radial-gradient(900px 600px at 90% 110%, rgba(103, 82, 138, 0.20) 0%, rgba(20, 20, 20, 0) 60%),
        var(--gym-black);
    color: var(--gym-white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.auth-shell {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-card {
    width: 100%;
    background: linear-gradient(180deg, rgba(30, 30, 30, 0.85) 0%, rgba(20, 20, 20, 0.85) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5),
                0 0 80px -30px rgba(0, 204, 204, 0.25);
    padding: 2rem 1.5rem 1.75rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: authCardIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}

.auth-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-logo img {
    height: 36px;
    width: auto;
    filter: drop-shadow(0 0 18px rgba(0, 204, 204, 0.35));
}

.auth-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.85rem;
    letter-spacing: 0.04em;
    text-align: center;
    margin: 0 0 0.5rem;
    text-transform: uppercase;
}

.auth-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.65);
    font-size: var(--text-body-sm);
    margin-bottom: 1.5rem;
}

.auth-step {
    animation: stepIn 0.35s ease-out;
}

@keyframes stepIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ---------- Input de telefono con prefijo ---------- */
.phone-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.phone-input-group:focus-within {
    border-color: var(--gym-aqua);
    background: rgba(0, 204, 204, 0.05);
    box-shadow: 0 0 0 4px rgba(0, 204, 204, 0.15);
}

/* ---------- Selector de pais (compacto en el input) ---------- */
.country-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.75rem 0 0.85rem;
    min-width: 5.5rem;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    color: var(--gym-white);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.country-trigger:hover,
.country-trigger:focus-visible {
    background: rgba(0, 204, 204, 0.12);
    color: var(--gym-aqua);
    outline: none;
}

.country-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.country-dial {
    color: var(--gym-aqua);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.country-chevron {
    font-size: var(--text-caption);
    opacity: 0.55;
    transition: transform 0.2s ease;
}

.country-trigger[aria-expanded="true"] .country-chevron {
    transform: rotate(180deg);
}

/* ---------- Panel / bottom sheet de paises ---------- */
.country-sheet {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.country-sheet[hidden] {
    display: none !important;
}

.country-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.25s ease;
}

.country-sheet-panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: min(72vh, 520px);
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem 1.25rem;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
    animation: sheetUp 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sheetUp {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0); opacity: 1; }
}

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

.country-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto 0.85rem;
}

.country-sheet-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin: 0 0 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

.country-search-wrap {
    position: relative;
    margin-bottom: 0.75rem;
}

.country-search-wrap .bi-search {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

.country-search {
    width: 100%;
    padding: 0.65rem 0.85rem 0.65rem 2.35rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--gym-white);
    font-size: var(--text-body-sm);
}

.country-search:focus {
    outline: none;
    border-color: var(--gym-aqua);
    box-shadow: 0 0 0 3px rgba(0, 204, 204, 0.15);
}

.country-search::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.country-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.country-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 0.5rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--gym-white);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.country-option:hover,
.country-option:focus-visible {
    background: rgba(0, 204, 204, 0.1);
    outline: none;
}

.country-option.is-selected {
    background: rgba(0, 204, 204, 0.14);
}

.country-option-flag {
    font-size: 1.35rem;
    line-height: 1;
    width: 1.75rem;
    text-align: center;
    flex-shrink: 0;
}

.country-option-name {
    flex: 1;
    font-size: var(--text-body-sm);
}

.country-option-dial {
    font-size: var(--text-body-sm);
    font-weight: 600;
    color: var(--gym-aqua);
}

.country-list-empty {
    text-align: center;
    padding: 1.5rem 0.5rem;
    color: rgba(255, 255, 255, 0.45);
    font-size: var(--text-body-sm);
}

@media (min-width: 576px) {
    .country-sheet {
        align-items: center;
        padding: 1rem;
    }

    .country-sheet-panel {
        border-radius: 20px;
        max-height: min(70vh, 480px);
        animation: authCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .country-sheet-handle {
        display: none;
    }
}

.phone-input {
    flex: 1;
    background: transparent !important;
    border: 0 !important;
    color: var(--gym-white) !important;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    padding: 1rem 1rem;
    box-shadow: none !important;
    outline: none;
}

.phone-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
    letter-spacing: 0;
}

/* ---------- Boton principal con spinner ---------- */
.auth-btn {
    border-radius: 14px;
    padding: 0.95rem 1rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.auth-btn:active {
    transform: translateY(1px);
}

.auth-btn .btn-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
}

.auth-btn.is-loading .btn-label { opacity: 0.45; }
.auth-btn.is-loading .btn-spinner { display: inline-block; }
.auth-btn:disabled { opacity: 0.65; cursor: not-allowed; }

/* ---------- Inputs OTP ---------- */
.otp-inputs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin: 0.5rem 0 0.25rem;
}

.otp-digit {
    width: 100%;
    aspect-ratio: 1 / 1.15;
    max-height: 62px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gym-white);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    caret-color: var(--gym-aqua);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.1s;
}

.otp-digit:focus {
    outline: none;
    border-color: var(--gym-aqua);
    background: rgba(0, 204, 204, 0.08);
    box-shadow: 0 0 0 3px rgba(0, 204, 204, 0.18);
    transform: translateY(-1px);
}

.otp-digit.is-filled {
    border-color: rgba(0, 204, 204, 0.55);
    background: rgba(0, 204, 204, 0.06);
}

.otp-inputs.is-error .otp-digit {
    border-color: rgba(220, 53, 69, 0.7);
    animation: shake 0.4s;
}

@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-5px); }
    40%, 60% { transform: translateX(5px); }
}

/* ---------- Links auxiliares ---------- */
.auth-link {
    color: var(--gym-aqua);
    font-weight: 600;
    font-size: var(--text-body-sm);
    text-decoration: none;
}

.auth-link:hover:not(:disabled) {
    color: #00e6e6;
    text-decoration: underline;
}

.auth-link:disabled {
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

.auth-link-small {
    color: rgba(255, 255, 255, 0.55);
    font-size: var(--text-label);
    text-decoration: none;
}

.auth-link-small:hover {
    color: var(--gym-white);
}

/* ---------- Alertas inline ---------- */
.auth-alert {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: var(--text-body-sm);
    line-height: 1.5;
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    animation: alertIn 0.3s ease-out;
}

.auth-alert.is-error {
    background: rgba(220, 53, 69, 0.12);
    border: 1px solid rgba(220, 53, 69, 0.35);
    color: #ff8a96;
}

.auth-alert.is-info {
    background: rgba(0, 204, 204, 0.10);
    border: 1px solid rgba(0, 204, 204, 0.35);
    color: var(--gym-aqua);
}

.auth-alert.is-success {
    background: rgba(40, 167, 69, 0.12);
    border: 1px solid rgba(40, 167, 69, 0.35);
    color: #6ee7a0;
}

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

/* ---------- Footer ---------- */
.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: var(--text-label);
    letter-spacing: 0.02em;
}

/* ---------- Responsive tweaks ---------- */
@media (min-width: 576px) {
    .auth-card {
        padding: 2.5rem 2.25rem 2rem;
    }
    .auth-title { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-step,
    .auth-alert { animation: none; }
}
