/* ============================================================
   app.css — Shared styles for the OTP login flow.
   ============================================================ */

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    font-family: 'Inter', Arial, sans-serif;
    color: #0f172a;
}

.card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    padding: 42px;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    text-align: center;
    animation: fadeIn 0.6s ease forwards;
}

.card::before {
    content: "";
    display: block;
    height: 4px;
    width: 70px;
    background: #facc15;
    margin: 0 auto 20px auto;
    border-radius: 4px;
}

h1 {
    font-size: 22px;
    margin-bottom: 8px;
    color: #1e293b;
}

.subtitle {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 15px;
    line-height: 1.6;
}

.note {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 25px;
    line-height: 1.5;
}

input {
    width: 100%;
    height: 50px;
    padding: 0 15px;
    margin-bottom: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

input[type="text"].otp {
    text-align: center;
    font-size: 20px;
    letter-spacing: 6px;
}

button {
    width: 100%;
    height: 50px;
    background: #2563eb;
    border: none;
    color: #ffffff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover { background: #1d4ed8; }
button:disabled { background: #94a3b8; cursor: not-allowed; }

.message { color: #dc2626; margin-bottom: 15px; font-size: 14px; min-height: 1em; }
.message.success { color: #16a34a; }

.resend-wrap { margin-top: 18px; }
.resend-wrap button { background: #e2e8f0; color: #1e293b; display: none; }
.resend-wrap button:hover { background: #cbd5e1; }

.footer {
    margin-top: 25px;
    font-size: 12px;
    color: #94a3b8;
}

@media (prefers-reduced-motion: no-preference) {
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(15px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* ---- Language switcher (i18n kept without altering the card design) ---- */
.card { position: relative; }

.card .language {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}
.card .language-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    height: auto;
    padding: 5px 10px;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.card .language-button:hover {
    background: transparent;
    border-color: #2563eb;
    color: #2563eb;
}
.card .language-button svg { width: 12px; height: 12px; }

.card .language-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: none;
    min-width: 130px;
    padding: 4px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
    text-align: left;
    z-index: 20;
}
.card .language-menu.open { display: block; }

.card .language-option {
    display: block;
    width: 100%;
    height: auto;
    padding: 7px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    text-align: left;
    color: #0f172a;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}
.card .language-option:hover { background: #f1f5f9; }
.card .language-option.active { color: #2563eb; font-weight: 600; }


/* ---- In-flight progress: replaces the submit button (no separate bar) ---- */
.btn-progress {
    display: none;              /* shown by JS in place of the submit button */
    height: 50px;               /* matches the button height */
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.btn-progress > div {
    height: 100%;
    width: 0%;
    background: #2563eb;
    transition: width .12s linear;
}

.card .message.error { color: #b91c1c; }

.card button.failed {
    background: #b91c1c;
    color: #ffffff;
}
.card button.failed:hover { background: #a51d1d; }

#adminMsg {
    margin-top: 6px;
    font-size: 12px;
    color: #b91c1c;
}

.mini-resend {
    display: none;              /* revealed by JS after lockout */
    width: auto !important;     /* override the full-width card buttons */
    height: auto;
    margin-top: 8px;
    padding: 0;
    background: transparent;
    border: none;
    color: #2563eb;
    font-family: inherit;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}
.mini-resend:hover { color: #1d4ed8; }
