/**
 * Wigmorean Auth Portal — Front-end styles.
 *
 * Color tokens align with the Wigmorean design system:
 *   Crimson  #2271b1   Gold  #646970   Deep Brown  #1d2327   Cream  #f6f7f7
 *
 * @package WigmoreanCRM
 * @author  Kọ́lá Abímbọ́lá
 * @version 1.0.0
 */

/* ═══════════════════════════════════════════════════════════════════
   PORTAL CONTAINER
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-portal {
    max-width: 420px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border: 1px solid #e2ddd5;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(43, 24, 16, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    color: #1d2327;
}

/* ═══════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-heading {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 0.25rem;
    text-align: center;
}

.wig-auth-subtext {
    font-size: 0.9rem;
    color: #6b5e54;
    text-align: center;
    margin: 0 0 1.5rem;
    line-height: 1.45;
}

.wig-auth-subtext strong {
    color: #1d2327;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a3f36;
    margin-bottom: 0.35rem;
}

.wig-auth-input {
    display: block;
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    color: #1d2327;
    background: #f6f7f7;
    border: 1px solid #d4cbbf;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

.wig-auth-input:focus {
    border-color: #646970;
    box-shadow: 0 0 0 3px rgba(197, 151, 59, 0.15);
}

.wig-auth-input::placeholder {
    color: #a89a8c;
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
    box-sizing: border-box;
    line-height: 1.3;
}

.wig-auth-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.wig-auth-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Primary — Crimson */
.wig-auth-btn--primary {
    background: #2271b1;
    color: #fff;
}

.wig-auth-btn--primary:hover:not(:disabled) {
    background: #7a1616;
}

/* Secondary — Cream outline */
.wig-auth-btn--secondary {
    background: transparent;
    color: #1d2327;
    border: 1px solid #d4cbbf;
}

.wig-auth-btn--secondary:hover:not(:disabled) {
    background: #f6f7f7;
    border-color: #646970;
}

/* Danger — for delete */
.wig-auth-btn--danger {
    background: transparent;
    color: #2271b1;
    border: 1px solid #e2c5c5;
}

.wig-auth-btn--danger:hover:not(:disabled) {
    background: #fdf2f2;
    border-color: #2271b1;
}

/* Small variant */
.wig-auth-btn--small {
    width: auto;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Loading state */
.wig-auth-btn--loading {
    position: relative;
    color: transparent !important;
}

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

.wig-auth-btn--secondary.wig-auth-btn--loading::after {
    border-color: rgba(43,24,16,0.15);
    border-top-color: #1d2327;
}

/* Button icon */
.wig-auth-btn__icon {
    display: flex;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: #a89a8c;
    font-size: 0.8rem;
}

.wig-auth-divider::before,
.wig-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2ddd5;
}

.wig-auth-divider span {
    padding: 0 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════
   STATUS MESSAGES
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-status {
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    text-align: center;
}

.wig-auth-status--info {
    background: #e8f0fa;
    color: #1a4b7a;
    border: 1px solid #b8d4f0;
}

.wig-auth-status--success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
}

.wig-auth-status--error {
    background: #fdf2f2;
    color: #2271b1;
    border: 1px solid #e2c5c5;
}

/* ═══════════════════════════════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2ddd5;
    border-top-color: #646970;
    border-radius: 50%;
    animation: wigAuthSpin 0.7s linear infinite;
    margin: 1.5rem auto;
}

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

/* ═══════════════════════════════════════════════════════════════════
   CREDENTIAL LIST (MANAGE VIEW)
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-cred-list {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.wig-auth-cred-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e2ddd5;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #fafaf8;
    transition: background 0.15s;
}

.wig-auth-cred-item:hover {
    background: #f6f7f7;
}

.wig-auth-cred-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.wig-auth-cred-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wig-auth-cred-meta {
    font-size: 0.78rem;
    color: #8a7e72;
}

/* ═══════════════════════════════════════════════════════════════════
   REGISTER SECTION
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-register-section {
    padding-top: 1.25rem;
    border-top: 1px solid #e2ddd5;
}

/* ═══════════════════════════════════════════════════════════════════
   FOOTER / LINKS
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e2ddd5;
}

.wig-auth-link {
    color: #2271b1;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.wig-auth-link:hover {
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════
   MIGRATION NOTICE (PHASE 3)
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-migration-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem;
    background: #e8f0fa;
    border: 1px solid #b8d4f0;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #1a4b7a;
}

.wig-auth-migration-notice svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: #1a4b7a;
}

.wig-auth-migration-notice strong {
    display: block;
    margin-bottom: 0.15rem;
}

/* ═══════════════════════════════════════════════════════════════════
   SECURITY QUESTIONS SETUP (MANAGE VIEW — PHASE 4)
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-recovery-setup {
    padding-top: 1.25rem;
    margin-top: 1.25rem;
    border-top: 1px solid #e2ddd5;
}

.wig-auth-subheading {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 0.25rem;
    text-align: center;
}

.wig-auth-select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b5e54' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.wig-auth-recovery-configured,
.wig-auth-recovery-not-configured {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════
   RECOVERY QUESTION BLOCKS (LOGIN VIEW — PHASE 4)
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-recovery-question {
    margin-bottom: 0.25rem;
}

.wig-auth-recovery-question .wig-auth-label {
    font-weight: 600;
    color: #1d2327;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.45rem;
}

/* ═══════════════════════════════════════════════════════════════════
   MAGIC LINK SENT NOTICE (PHASE 5)
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-magic-sent {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #1b5e20;
}

.wig-auth-magic-sent svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.wig-auth-magic-sent strong {
    display: block;
    margin-bottom: 0.15rem;
}

/* ═══════════════════════════════════════════════════════════════════
   PUSH APPROVAL — WAITING
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-push-wait {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    height: 80px;
}

.wig-auth-push-icon {
    position: relative;
    z-index: 1;
    color: #2271b1;
}

.wig-auth-push-pulse {
    position: absolute;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(139, 26, 26, 0.08);
    animation: wig-push-pulse 2s ease-in-out infinite;
}

@keyframes wig-push-pulse {
    0%, 100% { transform: scale(1);   opacity: 0.4; }
    50%      { transform: scale(1.6); opacity: 0; }
}

.wig-auth-push-timer {
    font-variant-numeric: tabular-nums;
    color: #8a7e72;
}

/* ═══════════════════════════════════════════════════════════════════
   PUSH DEVICES — MANAGE VIEW
   ═══════════════════════════════════════════════════════════════════ */

.wig-auth-push-setup {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2ddd5;
}

.wig-auth-push-devices {
    margin: 0.5rem 0;
}

.wig-auth-push-device {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0ece6;
}

.wig-auth-push-device:last-child {
    border-bottom: none;
}

.wig-auth-push-device-info {
    flex: 1;
    min-width: 0;
}

.wig-auth-push-device-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1d2327;
}

.wig-auth-push-device-meta {
    display: block;
    font-size: 0.78rem;
    color: #8a7e72;
}

.wig-auth-push-configured {
    color: #1b5e20;
}

.wig-auth-push-not-configured {
    color: #646970;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .wig-auth-portal {
        margin: 1rem;
        padding: 1.25rem;
    }

    .wig-auth-heading {
        font-size: 1.3rem;
    }
}


/* ── Password visibility toggle ───────────────────────────────────── */
.wig-auth-input-wrap {
    position: relative;
}
.wig-auth-input-wrap .wig-auth-input {
    padding-right: 44px;
    width: 100%;
}
.wig-auth-pw-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 4px;
    cursor: pointer;
    color: #6b7280;
    line-height: 0;
}
.wig-auth-pw-toggle:hover,
.wig-auth-pw-toggle:focus {
    color: #111827;
}
