/*
 * Admin Auth — Refined Professional
 * =================================
 * Styles the unified auth shell (login, 2FA, resend verification, license
 * activation). Loaded by templates/admin_auth_base.html after admin/tokens.css.
 * All colors come from design tokens so dark mode + runtime accent work for free.
 */

/* ===== PAGE SHELL ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6, 1.5rem);
    background-color: var(--bg-color);
    /* Quiet, professional ambient wash — no busy dot grid. */
    background-image:
        radial-gradient(1200px 600px at 100% 0%, rgba(var(--primary-color-rgb), 0.06), transparent 60%),
        radial-gradient(1000px 500px at 0% 100%, rgba(var(--primary-color-rgb), 0.05), transparent 55%);
}

/* ===== CARD ===== */
.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--card-border-radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2.25rem;
    animation: authCardIn 0.35s ease both;
}

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

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

/* ===== HEADER ===== */
.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    background-color: rgba(var(--primary-color-rgb), 0.10);
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* When a page supplies a business logo image instead of the icon badge. */
.auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}

.auth-title {
    margin: 0 0 0.35rem;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

.auth-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-color-muted);
}

/* ===== FORM FIELDS ===== */
.auth-form { display: block; }

.auth-field {
    position: relative;
    margin-bottom: 1rem;
}

.auth-field__icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.95rem;
    pointer-events: none;
}

.auth-input {
    width: 100%;
    height: 46px;
    padding: 0 0.875rem 0 2.5rem;
    font-size: 0.95rem;
    color: var(--text-color);
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    appearance: none;
}

.auth-input::placeholder { color: var(--text-light); }

.auth-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.15);
}

.auth-input:focus + .auth-field__icon,
.auth-field:focus-within .auth-field__icon {
    color: var(--primary-color);
}

/* Optional explicit label */
.auth-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color);
}

/* ===== SUBMIT BUTTON ===== */
.auth-submit {
    width: 100%;
    height: 46px;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--button-border-radius);
    cursor: pointer;
    transition: background-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-fast);
}

.auth-submit:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

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

.auth-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.35);
}

/* ===== SECONDARY LINKS / FOOTER ===== */
.auth-links {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-color-muted);
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover { text-decoration: underline; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

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

.auth-footer {
    margin-top: 1.75rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-light);
}

/* ===== THEME TOGGLE (icon-only, top-right of card) ===== */
.auth-theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color-muted);
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
}

.auth-theme-toggle:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Theme JS injects/sets a <span> label; keep it for screen readers only. */
.auth-theme-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== FLASH MESSAGES ===== */
.auth-message {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-left-width: 3px;
    border-radius: var(--radius-md);
    background-color: var(--bg-dark);
    color: var(--text-color);
}

.auth-message__icon { margin-top: 0.1rem; font-size: 0.95rem; }
.auth-message p { margin: 0; }

.auth-message--error {
    border-left-color: var(--error-color);
    background-color: rgba(var(--error-color-rgb), 0.08);
}
.auth-message--error .auth-message__icon { color: var(--error-color); }

.auth-message--success {
    border-left-color: var(--success-color);
    background-color: rgba(var(--success-color-rgb), 0.08);
}
.auth-message--success .auth-message__icon { color: var(--success-color); }

.auth-message--info {
    border-left-color: var(--info-color);
    background-color: rgba(var(--info-color-rgb), 0.08);
}
.auth-message--info .auth-message__icon { color: var(--info-color); }

/* ===== FORM GRID (multi-field auth pages, e.g. register) ===== */
.auth-row {
    display: flex;
    gap: 1rem;
}
.auth-row > * { flex: 1; }

/* ===== MOBILE ===== */
@media (max-width: 480px) {
    .auth-card { padding: 2rem 1.5rem; border-radius: var(--card-border-radius); }
    .auth-input { font-size: 16px; } /* prevents iOS zoom */
}
