/* ============================================
   AUTH DESIGN SYSTEM — Transcription Service
   Modern 2026 Glassmorphism + Depth
   ============================================ */

/* Fonts — Satoshi for headings, DM Sans for body */
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@700,500,400&display=swap');

:root {
    --auth-primary: #2563EB;
    --auth-primary-light: #3B82F6;
    --auth-primary-dark: #1D4ED8;
    --auth-primary-glow: rgba(37, 99, 235, 0.15);
    --auth-primary-ghost: rgba(37, 99, 235, 0.06);
    --auth-surface: rgba(255, 255, 255, 0.72);
    --auth-surface-solid: #ffffff;
    --auth-border: rgba(37, 99, 235, 0.12);
    --auth-border-hover: rgba(37, 99, 235, 0.25);
    --auth-text: #0f172a;
    --auth-text-secondary: #64748b;
    --auth-text-muted: #94a3b8;
    --auth-success: #10b981;
    --auth-success-bg: rgba(16, 185, 129, 0.08);
    --auth-error: #ef4444;
    --auth-error-bg: rgba(239, 68, 68, 0.08);
    --auth-warning: #f59e0b;
    --auth-warning-bg: rgba(245, 158, 11, 0.08);
    --auth-info: #3b82f6;
    --auth-info-bg: rgba(59, 130, 246, 0.08);
    --auth-radius: 20px;
    --auth-radius-sm: 12px;
    --auth-radius-xs: 8px;
    --auth-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
    --auth-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    --auth-shadow-glow: 0 0 40px rgba(37, 99, 235, 0.12);
    --auth-font-display: 'Satoshi', 'DM Sans', system-ui, sans-serif;
    --auth-font-body: 'DM Sans', system-ui, sans-serif;
    --auth-font-mono: 'JetBrains Mono', monospace;
    --auth-transition: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Background ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #f0f4ff;
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(37, 99, 235, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 90%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse 40% 30% at 10% 80%, rgba(37, 99, 235, 0.04) 0%, transparent 50%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232563EB' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
    animation: auth-drift 60s linear infinite;
    pointer-events: none;
}

@keyframes auth-drift {
    from { transform: translate(0, 0); }
    to { transform: translate(30px, 30px); }
}

/* ---- Glass Card ---- */
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--auth-surface);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 2.5rem;
    box-shadow: var(--auth-shadow-lg);
    position: relative;
    z-index: 1;
    animation: auth-card-in 0.6s var(--auth-transition) both;
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--auth-radius);
    background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

/* ---- Logo / Brand ---- */
.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-light) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
    animation: auth-icon-in 0.8s var(--auth-transition) 0.2s both;
}

@keyframes auth-icon-in {
    from { opacity: 0; transform: scale(0.5) rotate(-10deg); }
    to { opacity: 1; transform: scale(1) rotate(0deg); }
}

.auth-brand-icon svg {
    width: 28px;
    height: 28px;
    color: white;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-brand h1 {
    font-family: var(--auth-font-display);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--auth-text);
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.auth-brand p {
    font-family: var(--auth-font-body);
    font-size: 0.875rem;
    color: var(--auth-text-secondary);
    margin: 0;
}

/* ---- Form Controls ---- */
.auth-field {
    margin-bottom: 1.25rem;
}

.auth-field label {
    display: block;
    font-family: var(--auth-font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--auth-text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.auth-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--auth-font-body);
    font-size: 0.9375rem;
    color: var(--auth-text);
    background: var(--auth-surface-solid);
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    outline: none;
    transition: all 0.25s var(--auth-transition);
    box-sizing: border-box;
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px var(--auth-primary-glow);
}

.auth-input:hover:not(:focus) {
    border-color: var(--auth-border-hover);
}

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

.auth-input[type="password"] {
    font-family: var(--auth-font-body);
    letter-spacing: 0.1em;
}

/* ---- Buttons ---- */
.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-family: var(--auth-font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--auth-radius-sm);
    cursor: pointer;
    transition: all 0.25s var(--auth-transition);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    text-align: center;
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.auth-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.auth-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-btn-ghost {
    background: transparent;
    color: var(--auth-text-secondary);
    border: 1.5px solid var(--auth-border);
}

.auth-btn-ghost:hover {
    background: var(--auth-primary-ghost);
    border-color: var(--auth-border-hover);
    color: var(--auth-primary);
}

.auth-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    border-radius: var(--auth-radius-xs);
}

/* ---- Alerts ---- */
.auth-alert {
    padding: 0.875rem 1rem;
    border-radius: var(--auth-radius-sm);
    font-family: var(--auth-font-body);
    font-size: 0.8125rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
    animation: auth-alert-in 0.3s var(--auth-transition);
}

@keyframes auth-alert-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-alert-error {
    background: var(--auth-error-bg);
    color: var(--auth-error);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.auth-alert-success {
    background: var(--auth-success-bg);
    color: var(--auth-success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.auth-alert-info {
    background: var(--auth-info-bg);
    color: var(--auth-info);
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.auth-alert-warning {
    background: var(--auth-warning-bg);
    color: var(--auth-warning);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

/* ---- Divider ---- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--auth-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

/* ---- YubiKey Pulse Animation ---- */
.yubikey-pulse {
    width: 96px;
    height: 96px;
    margin: 1.5rem auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yubikey-pulse::before,
.yubikey-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--auth-primary);
    opacity: 0;
}

.yubikey-pulse.active::before {
    animation: yubikey-ring 2s var(--auth-transition) infinite;
}

.yubikey-pulse.active::after {
    animation: yubikey-ring 2s var(--auth-transition) 0.5s infinite;
}

@keyframes yubikey-ring {
    0% { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(1.6); opacity: 0; }
}

.yubikey-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, #6366f1 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
    position: relative;
    z-index: 1;
    transition: transform 0.3s var(--auth-transition);
}

.yubikey-pulse.active .yubikey-icon {
    animation: yubikey-breathe 2s ease-in-out infinite;
}

@keyframes yubikey-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.yubikey-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

/* ---- Section Cards (Security Page) ---- */
.auth-section {
    background: var(--auth-surface-solid);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: box-shadow 0.3s var(--auth-transition);
}

.auth-section:hover {
    box-shadow: var(--auth-shadow);
}

.auth-section-title {
    font-family: var(--auth-font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--auth-text);
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-section-desc {
    font-size: 0.8125rem;
    color: var(--auth-text-secondary);
    margin: 0 0 1rem;
}

/* ---- Key List ---- */
.auth-key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(37, 99, 235, 0.06);
}

.auth-key-item:last-child {
    border-bottom: none;
}

.auth-key-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.auth-key-icon {
    width: 36px;
    height: 36px;
    background: var(--auth-primary-ghost);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-key-icon svg {
    width: 18px;
    height: 18px;
    color: var(--auth-primary);
}

.auth-key-name {
    font-family: var(--auth-font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--auth-text);
}

.auth-key-date {
    font-size: 0.75rem;
    color: var(--auth-text-muted);
}

/* ---- Badge ---- */
.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 100px;
    font-family: var(--auth-font-body);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.auth-badge-success {
    background: var(--auth-success-bg);
    color: var(--auth-success);
}

.auth-badge-error {
    background: var(--auth-error-bg);
    color: var(--auth-error);
}

.auth-badge-info {
    background: var(--auth-info-bg);
    color: var(--auth-info);
}

/* ---- Backup Codes ---- */
.auth-codes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--auth-radius-sm);
    border: 1px dashed var(--auth-border);
}

.auth-codes-grid code {
    font-family: var(--auth-font-mono);
    font-size: 0.875rem;
    color: var(--auth-text);
    padding: 0.375rem 0;
    text-align: center;
    letter-spacing: 0.05em;
}

/* ---- Link ---- */
.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: var(--auth-font-body);
    font-size: 0.8125rem;
    color: var(--auth-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-link:hover {
    color: var(--auth-primary);
}

/* ---- Details/Accordion ---- */
.auth-details {
    margin-top: 1.25rem;
    border-top: 1px solid var(--auth-border);
    padding-top: 1.25rem;
}

.auth-details summary {
    cursor: pointer;
    font-family: var(--auth-font-body);
    font-size: 0.8125rem;
    color: var(--auth-text-secondary);
    padding: 0.5rem 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.auth-details summary::-webkit-details-marker { display: none; }

.auth-details summary::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.2s;
    margin-left: auto;
}

.auth-details[open] summary::after {
    transform: rotate(180deg);
}

.auth-details summary:hover {
    color: var(--auth-primary);
}

/* ---- Stagger animations ---- */
.auth-stagger > * {
    animation: auth-stagger-in 0.5s var(--auth-transition) both;
}
.auth-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.auth-stagger > *:nth-child(2) { animation-delay: 0.15s; }
.auth-stagger > *:nth-child(3) { animation-delay: 0.2s; }
.auth-stagger > *:nth-child(4) { animation-delay: 0.25s; }
.auth-stagger > *:nth-child(5) { animation-delay: 0.3s; }
.auth-stagger > *:nth-child(6) { animation-delay: 0.35s; }
.auth-stagger > *:nth-child(7) { animation-delay: 0.4s; }

@keyframes auth-stagger-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .auth-page { padding: 1rem; }
    .auth-card { padding: 1.75rem; border-radius: 16px; }
    .auth-codes-grid { grid-template-columns: 1fr; }
}
