/**
 * Oftimor Unified Auth — Frontend Styles
 * Modern, mobile-first, bank-grade feel
 */

:root {
    --ofa-primary: #2563eb;
    --ofa-primary-dark: #1d4ed8;
    --ofa-success: #16a34a;
    --ofa-danger: #dc2626;
    --ofa-warning: #f59e0b;
    --ofa-whatsapp: #25d366;
    --ofa-whatsapp-dark: #128c7e;
    --ofa-google: #4285f4;
    --ofa-apple: #000;
    --ofa-text: #1a1a2e;
    --ofa-text-muted: #6b7280;
    --ofa-bg: #f8fafc;
    --ofa-card-bg: #ffffff;
    --ofa-border: #e5e7eb;
    --ofa-radius: 12px;
    --ofa-radius-sm: 8px;
    --ofa-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --ofa-transition: 0.2s ease;
}

/* ─── Container ────────────────────────────────────────────────────── */

.ofa-auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ofa-text);
    -webkit-font-smoothing: antialiased;
}

.ofa-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--ofa-card-bg);
    border-radius: var(--ofa-radius);
    box-shadow: var(--ofa-shadow);
    padding: 40px 32px;
    border: 1px solid var(--ofa-border);
}

.ofa-auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.ofa-auth-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--ofa-text);
}

.ofa-auth-subtitle {
    font-size: 14px;
    color: var(--ofa-text-muted);
    margin: 0;
}

/* ─── Alerts ───────────────────────────────────────────────────────── */

.ofa-alert {
    padding: 12px 16px;
    border-radius: var(--ofa-radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.ofa-alert-error {
    background: #fef2f2;
    color: var(--ofa-danger);
    border: 1px solid #fecaca;
}

.ofa-alert-success {
    background: #f0fdf4;
    color: var(--ofa-success);
    border: 1px solid #bbf7d0;
}

/* ─── Tabs ─────────────────────────────────────────────────────────── */

.ofa-tabs {
    display: flex;
    gap: 4px;
    background: var(--ofa-bg);
    border-radius: var(--ofa-radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}

.ofa-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--ofa-text-muted);
    cursor: pointer;
    transition: all var(--ofa-transition);
}

.ofa-tab:hover {
    color: var(--ofa-text);
}

.ofa-tab.active {
    background: var(--ofa-card-bg);
    color: var(--ofa-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ofa-tab svg {
    flex-shrink: 0;
}

.ofa-tab-content {
    display: none;
}

.ofa-tab-content.active {
    display: block;
}

/* ─── Form Elements ────────────────────────────────────────────────── */

.ofa-form {
    margin: 0;
}

.ofa-form-step {
    display: none;
}

.ofa-form-step.active {
    display: block;
}

.ofa-field {
    margin-bottom: 18px;
}

.ofa-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ofa-text);
    margin-bottom: 6px;
}

.ofa-field input[type="email"],
.ofa-field input[type="tel"],
.ofa-field input[type="text"],
.ofa-field input[type="date"],
.ofa-field select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--ofa-border);
    border-radius: var(--ofa-radius-sm);
    font-size: 15px;
    color: var(--ofa-text);
    background: var(--ofa-card-bg);
    transition: border-color var(--ofa-transition), box-shadow var(--ofa-transition);
    outline: none;
    box-sizing: border-box;
}

.ofa-field input:focus {
    border-color: var(--ofa-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ofa-field select:focus {
    border-color: var(--ofa-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ofa-field-hint {
    font-size: 12px;
    color: var(--ofa-text-muted);
    margin-top: 4px;
    display: block;
}

.ofa-inline-note {
    margin: -4px 0 16px;
    font-size: 13px;
    color: var(--ofa-text-muted);
    line-height: 1.45;
}

.ofa-field-row {
    display: flex;
    gap: 12px;
}

.ofa-field-row .ofa-field {
    flex: 1;
}

/* Phone input */
.ofa-phone-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.ofa-phone-prefix {
    position: absolute;
    left: 14px;
    font-size: 15px;
    color: var(--ofa-text-muted);
    pointer-events: none;
}

.ofa-phone-wrapper input {
    padding-left: 28px !important;
}

/* ─── OTP Code Inputs ──────────────────────────────────────────────── */

.ofa-code-info {
    text-align: center;
    font-size: 14px;
    color: var(--ofa-text-muted);
    margin-bottom: 20px;
}

.ofa-code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.ofa-code-digit {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid var(--ofa-border);
    border-radius: var(--ofa-radius-sm);
    outline: none;
    color: var(--ofa-text);
    transition: all var(--ofa-transition);
    -moz-appearance: textfield;
}

.ofa-code-digit::-webkit-outer-spin-button,
.ofa-code-digit::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ofa-code-digit:focus {
    border-color: var(--ofa-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.ofa-code-digit.filled {
    border-color: var(--ofa-primary);
    background: #f0f4ff;
}

.ofa-countdown {
    text-align: center;
    font-size: 13px;
    color: var(--ofa-text-muted);
    margin-top: 12px;
}

/* ─── Buttons ──────────────────────────────────────────────────────── */

.ofa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: var(--ofa-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ofa-transition);
    text-decoration: none;
    box-sizing: border-box;
}

.ofa-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ofa-btn-primary {
    background: var(--ofa-primary);
    color: #fff;
}

.ofa-btn-primary:hover:not(:disabled) {
    background: var(--ofa-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.ofa-btn-whatsapp {
    background: var(--ofa-whatsapp);
    color: #fff;
}

.ofa-btn-whatsapp:hover:not(:disabled) {
    background: var(--ofa-whatsapp-dark);
    transform: translateY(-1px);
}

.ofa-btn-google {
    background: #fff;
    color: var(--ofa-text);
    border: 1.5px solid var(--ofa-border);
}

.ofa-btn-google:hover {
    background: #f8f9fa;
    border-color: #dadce0;
}

.ofa-btn-apple {
    background: var(--ofa-apple);
    color: #fff;
}

.ofa-btn-apple:hover {
    background: #333;
}

.ofa-btn-outline {
    background: transparent;
    color: var(--ofa-text);
    border: 1.5px solid var(--ofa-border);
}

.ofa-btn-outline:hover {
    background: var(--ofa-bg);
}

.ofa-btn-danger {
    background: var(--ofa-danger);
    color: #fff;
}

.ofa-btn-danger:hover {
    background: #b91c1c;
}

.ofa-btn-link {
    background: transparent;
    color: var(--ofa-primary);
    font-size: 13px;
    padding: 8px;
    font-weight: 500;
}

.ofa-btn-link:hover {
    text-decoration: underline;
}

/* ─── Divider ──────────────────────────────────────────────────────── */

.ofa-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.ofa-divider::before,
.ofa-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ofa-border);
}

.ofa-divider span {
    padding: 0 16px;
    font-size: 13px;
    color: var(--ofa-text-muted);
    white-space: nowrap;
}

/* ─── Social Buttons ───────────────────────────────────────────────── */

.ofa-social-buttons {
    display: flex;
    gap: 12px;
}

.ofa-social-buttons--signup {
    margin-bottom: 12px;
}

.ofa-social-buttons--priority {
    margin-bottom: 18px;
}

.ofa-social-buttons .ofa-btn {
    flex: 1;
}

/* ─── Footer ───────────────────────────────────────────────────────── */

.ofa-auth-footer {
    margin-top: 24px;
    text-align: center;
}

.ofa-auth-footer p {
    margin: 4px 0;
    font-size: 12px;
    color: var(--ofa-text-muted);
}

.ofa-auth-footer a {
    color: var(--ofa-primary);
    text-decoration: none;
    font-weight: 600;
}

.ofa-secure-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--ofa-success) !important;
}

.ofa-sites-info {
    letter-spacing: 0.5px;
}

/* ─── Account Page ─────────────────────────────────────────────────── */

.ofa-account-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ofa-account-card {
    background: var(--ofa-card-bg);
    border-radius: var(--ofa-radius);
    box-shadow: var(--ofa-shadow);
    padding: 32px;
    border: 1px solid var(--ofa-border);
}

.ofa-account-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ofa-border);
}

.ofa-account-card-wide {
    max-width: 1040px;
    margin: 0 auto;
}

.ofa-account-hero {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 28px;
}

.ofa-account-title {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.1;
}

.ofa-account-subtitle {
    margin: 0;
    color: var(--ofa-text-muted);
    font-size: 15px;
}

.ofa-status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.ofa-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: #eff6ff;
    color: var(--ofa-primary);
    border: 1px solid #bfdbfe;
}

.ofa-status-pill-verified {
    background: #f0fdf4;
    color: var(--ofa-success);
    border-color: #bbf7d0;
}

.ofa-status-pill-failed {
    background: #fef2f2;
    color: var(--ofa-danger);
    border-color: #fecaca;
}

.ofa-status-pill-neutral,
.ofa-status-pill-unverified {
    background: var(--ofa-bg);
    color: var(--ofa-text-muted);
    border-color: var(--ofa-border);
}

.ofa-account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 24px;
}

.ofa-account-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}

.ofa-shortcut-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--ofa-border);
  border-radius: var(--ofa-radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  text-decoration: none;
  color: var(--ofa-text);
  transition: transform var(--ofa-transition), box-shadow var(--ofa-transition), border-color var(--ofa-transition);
}

.ofa-shortcut-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--ofa-shadow-soft);
  border-color: #bfdbfe;
}

.ofa-shortcut-card strong {
  font-size: 15px;
}

.ofa-shortcut-card span {
  color: var(--ofa-text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.ofa-section-link {
  color: var(--ofa-primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.ofa-account-section-main {
    margin-bottom: 0;
}

.ofa-account-side {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ofa-account-side .ofa-account-section {
    margin-bottom: 0;
}

.ofa-section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.ofa-muted {
    color: var(--ofa-text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.ofa-account-form .ofa-field-row {
    align-items: flex-end;
}

.ofa-phone-verify {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f8fbff;
}

.ofa-phone-verify__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ofa-phone-verify__status {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ofa-phone-verify__status.is-verified {
    background: #dcfce7;
    color: #166534;
}

.ofa-phone-verify__status.is-pending {
    background: #f1f5f9;
    color: #475569;
}

.ofa-phone-verify__send,
.ofa-phone-verify__confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: .18s ease;
}

.ofa-phone-verify__send:hover,
.ofa-phone-verify__confirm:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.ofa-phone-verify__meta {
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
}

.ofa-phone-verify__code {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.ofa-phone-verify__code[hidden] {
    display: none;
}

.ofa-phone-verify__code input {
    min-height: 44px;
}

.ofa-form-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
}

.ofa-form-actions .ofa-btn {
    width: auto;
    min-width: 180px;
}

.ofa-kyc-card {
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    border: 1px solid #dbeafe;
    border-radius: var(--ofa-radius);
    padding: 24px;
}

.ofa-kyc-summary {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.ofa-kyc-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    font-size: 14px;
}

.ofa-kyc-label {
    color: var(--ofa-text-muted);
}

.ofa-kyc-actions .ofa-btn {
    width: 100%;
}

.ofa-account-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.ofa-account-actions .ofa-btn {
    width: auto;
    min-width: 180px;
}

.ofa-account-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
}

.ofa-profile-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ofa-avatar img {
    border-radius: 50%;
}

.ofa-linked-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ofa-linked-list li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.ofa-provider-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.ofa-provider-google { background: var(--ofa-google); }
.ofa-provider-apple { background: var(--ofa-apple); }
.ofa-provider-whatsapp { background: var(--ofa-whatsapp); }
.ofa-provider-email { background: var(--ofa-primary); }

.ofa-sessions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ofa-sessions-table th {
    text-align: left;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ofa-text-muted);
    border-bottom: 1px solid var(--ofa-border);
}

.ofa-sessions-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f3f4f6;
}

@media (max-width: 900px) {
    .ofa-account-shortcuts {
        grid-template-columns: 1fr;
    }

    .ofa-account-grid {
        grid-template-columns: 1fr;
    }

    .ofa-account-hero {
        flex-direction: column;
    }

    .ofa-status-pills {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .ofa-field-row,
    .ofa-social-buttons,
    .ofa-account-actions {
        flex-direction: column;
    }

    .ofa-account-card {
        padding: 24px 18px;
    }

    .ofa-account-title {
        font-size: 24px;
    }

    .ofa-form-actions .ofa-btn,
    .ofa-account-actions .ofa-btn {
        width: 100%;
        min-width: 0;
    }
}

.ofa-account-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.ofa-muted {
    color: var(--ofa-text-muted);
    font-size: 14px;
}

/* ─── Loading Spinner ──────────────────────────────────────────────── */

.ofa-btn.loading {
    position: relative;
    color: transparent !important;
}

.ofa-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ofa-spin 0.6s linear infinite;
}

@keyframes ofa-spin {
    to { transform: rotate(360deg); }
}

/* ─── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .ofa-auth-card {
        padding: 28px 20px;
    }

    .ofa-code-digit {
        width: 42px;
        height: 48px;
        font-size: 20px;
    }

    .ofa-social-buttons {
        flex-direction: column;
    }

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

    .ofa-account-actions {
        flex-direction: column;
    }
}

/* ─── Human Challenge ─────────────────────────────────────────────── */

.ofa-human-check {
    margin: 16px 0;
    padding: 14px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f8fbff;
}

.ofa-human-check__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.ofa-human-check__refresh {
    background: transparent;
    border: 0;
    color: var(--ofa-primary, #2563eb);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.ofa-human-check__prompt {
    margin: 0 0 12px;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 600;
}

.ofa-human-check__options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ofa-human-check__option {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    border: 1px solid #d6e0ee;
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
}

.ofa-human-check__option.is-selected {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px #2563eb;
}

.ofa-human-check__emoji {
    font-size: 1.2rem;
    line-height: 1;
}

@media (max-width: 640px) {
    .ofa-human-check__options {
        grid-template-columns: 1fr;
    }

    .ofa-phone-verify__code {
        grid-template-columns: 1fr;
    }
}
