/* Codes
 * Copyright (c) 2026 Prokop Šafránek
 * License terms are available at https://accounts.codes/terms.
 */

:root {
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #20201d;
    --color-text-secondary: #6b7280;
    --color-text-tertiary: #9ca3af;
    --color-primary: #20201d;
    --color-primary-hover: #374151;
    --color-error: #dc2626;
    --color-success: #059669;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 200ms ease;
}
[data-theme="dark"] {
    --color-bg: #0a0a0a;
    --color-surface: #141414;
    --color-border: #262626;
    --color-text: #fafafa;
    --color-text-secondary: #a3a3a3;
    --color-text-tertiary: #737373;
    --color-primary: #fafafa;
    --color-primary-hover: #e5e5e5;
    --color-error: #f87171;
    --color-success: #34d399;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--color-bg); color: var(--color-text); line-height: 1.5; min-height: 100vh; min-height: 100dvh; }
.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.auth-container { width: 100%; max-width: 380px; }
.auth-step { animation: fadeIn 0.3s ease; }
.auth-step.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.auth-header { margin-bottom: 32px; }
.auth-header h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; color: var(--color-text); }
.auth-header h1.error-code { font-size: 96px; font-weight: 700; line-height: 1; letter-spacing: -0.04em; margin-bottom: 16px; }
.auth-header p { font-size: 15px; color: var(--color-text-secondary); line-height: 1.6; }
.auth-header strong { color: var(--color-text); }
.auth-header .app-icon { margin-bottom: 16px; }
.app-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; flex-shrink: 0; overflow: hidden; background: #dbeafe; color: #2563eb; }
.app-icon img { width: 100%; height: 100%; object-fit: contain; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--color-text-secondary); font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; padding: 0; margin-bottom: 24px; transition: color var(--transition); }
.back-btn:hover { color: var(--color-text); }
.auth-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 14px; font-weight: 500; color: var(--color-text); }
.form-input { width: 100%; height: 48px; padding: 0 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-family: inherit; font-size: 15px; color: var(--color-text); transition: border-color var(--transition), box-shadow var(--transition); }
.form-input::placeholder { color: var(--color-text-tertiary); }
.form-input:focus { outline: none; border-color: var(--color-primary); }
.form-input.error { border-color: var(--color-error); }
.form-error { font-size: 13px; color: var(--color-error); }
.form-error:empty { display: none; }
.form-hint { font-size: 13px; color: var(--color-text-tertiary); line-height: 1.5; }
.code-inputs { display: flex; gap: 10px; justify-content: center; }
.code-input { width: 48px; height: 48px; text-align: center; font-size: 22px; font-weight: 600; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); transition: border-color var(--transition); flex: 0 0 auto; }
.code-input:focus { outline: none; border-color: var(--color-primary); }
.code-input.error { border-color: var(--color-error); animation: shake 0.4s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.checkbox-wrapper { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.checkbox-wrapper input { display: none; }
.checkbox-box { flex-shrink: 0; width: 20px; height: 20px; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-surface); position: relative; transition: all var(--transition); margin-top: 1px; }
.checkbox-wrapper input:checked + .checkbox-box { background: var(--color-primary); border-color: var(--color-primary); }
.checkbox-box::after { content: ''; position: absolute; top: 4px; left: 7px; width: 5px; height: 9px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); opacity: 0; }
.checkbox-wrapper input:checked + .checkbox-box::after { opacity: 1; }
.checkbox-label { font-size: 14px; color: var(--color-text-secondary); line-height: 1.5; }
.checkbox-label a { color: var(--color-text); text-decoration: underline; text-underline-offset: 2px; }
.checkbox-label a:hover { color: var(--color-text-secondary); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 24px; border-radius: var(--radius-sm); font-family: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; transition: all var(--transition); border: none; position: relative; }
.btn-primary { background: var(--color-primary); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.loading .btn-text { opacity: 0; }
.btn-loader { position: absolute; display: none; }
.btn.loading .btn-loader { display: block; }
.spinner { width: 20px; height: 20px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: none; color: var(--color-text); font-family: inherit; font-size: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--color-text-secondary); }
.auth-divider { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--color-border); text-align: center; font-size: 14px; color: var(--color-text-secondary); }
.auth-divider a { color: var(--color-text); font-weight: 600; text-decoration: none; }
.auth-divider a:hover { text-decoration: underline; }
.resend-text { text-align: center; margin-top: 24px; font-size: 14px; color: var(--color-text-secondary); }
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 100; animation: fadeIn 0.2s ease; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 32px; max-width: 360px; width: 100%; text-align: center; }
.modal-icon { margin-bottom: 20px; color: var(--color-text-secondary); }
.modal h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--color-text-secondary); margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; flex-direction: column; gap: 12px; }
.modal-actions .btn { width: 100%; }
.turnstile-modal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 32px; max-width: 380px; width: 100%; text-align: left; }
.turnstile-modal h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.turnstile-modal p { font-size: 14px; color: var(--color-text-secondary); margin-bottom: 24px; line-height: 1.6; }
.turnstile-status { display: block; margin: 16px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--color-danger-bg); color: var(--color-danger); font-size: 13px; line-height: 1.5; text-align: left; }
.turnstile-status.hidden { display: none; }
.turnstile-retry { display: block; margin-top: 10px; padding: 0; background: none; border: none; color: inherit; font-family: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.turnstile-retry:hover { color: var(--color-text); }
.turnstile-modal .btn { width: 100%; margin-top: 24px; }
.success-container { text-align: center; }
.success-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; background: #ecfdf5; border-radius: 50%; margin-bottom: 24px; color: var(--color-success); }
[data-theme="dark"] .success-icon { background: #0d1f17; }
.success-container .btn { margin-top: 8px; width: 100%; }
.auth-actions { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.warning-box { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; color: #991b1b; }
[data-theme="dark"] .warning-box { background: #1c1010; border-color: #3b1515; color: #fca5a5; }
.warning-box.warning-box-info { background: #fffbeb; border-color: #fde68a; color: #92400e; }
[data-theme="dark"] .warning-box.warning-box-info { background: #1a1508; border-color: #3b2f0f; color: #fcd34d; }
.warning-box svg { flex-shrink: 0; margin-top: 2px; }
.btn-warning { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px; border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 500; cursor: pointer; transition: all var(--transition); text-decoration: none; width: 100%; background: #f59e0b; color: #ffffff; }
.btn-warning:hover { background: #d97706; }
[data-theme="dark"] .btn-warning { background: #d97706; }
[data-theme="dark"] .btn-warning:hover { background: #b45309; }
.btn-warning.loading .btn-text { visibility: hidden; }
.btn-warning.loading .btn-loader { display: flex; }
.btn-warning .btn-loader { display: none; position: absolute; }
.btn-warning .spinner { animation: spin 0.6s linear infinite; width: 20px; height: 20px; }
.hidden { display: none !important; }
.permissions-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 24px; }
.permissions-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--color-text); }
.permissions-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.permission-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 14px; color: var(--color-text); }
.permission-item svg { flex-shrink: 0; color: var(--color-text-secondary); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--color-primary); color: var(--color-bg); padding: 12px 24px; border-radius: 100px; font-size: 14px; font-weight: 500; z-index: 300; opacity: 0; transition: all 300ms ease; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-lg); }
[data-theme="dark"] .toast { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.toast.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 480px) {
.auth-main { padding: 24px 16px; }
.auth-header h1 { font-size: 22px; }
.code-input { height: 52px; font-size: 20px; }
}
