/* =========================================================================
   Auth Demo — modern, framework-free UI.
   Self-hosted Inter font + a small design-token system. No external requests,
   so it looks polished and still loads fast.
   ========================================================================= */

/* --- Self-hosted Inter (downloaded to static/fonts) --- */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/inter-500.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/inter-600.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/inter-700.woff2") format("woff2");
}

:root {
    --bg: #f7f8fb;
    --bg-tint: #eef1f8;
    --card: #ffffff;
    --text: #16181d;
    --muted: #6b7280;
    --faint: #9aa1ac;
    --accent: #4f46e5;
    --accent-dark: #4338ca;
    --accent-soft: #eef0fe;
    --border: #e6e8ee;
    --border-strong: #d4d8e2;
    --error-bg: #fdecec;
    --error-text: #b02525;
    --ok-bg: #e8f7ee;
    --ok-text: #1a7f42;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 20px 45px rgba(16, 24, 40, 0.12);
    --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 100%);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-dark); }

h1, h2, h3 { letter-spacing: -0.02em; }
h1 { margin: 0 0 0.4rem; font-size: 1.6rem; font-weight: 700; }

/* --- Nav --- */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.nav .brand {
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.nav .brand:hover { color: var(--text); }
.nav .links { display: flex; align-items: center; gap: 1.1rem; }
.nav .links a { color: var(--muted); font-weight: 500; font-size: 0.93rem; }
.nav .links a:hover { color: var(--text); }
.nav .user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.25rem 0.25rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.nav .user-chip .email { color: var(--muted); font-size: 0.85rem; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .user-chip:hover { color: var(--text); }

/* --- Layout --- */
.container { max-width: 460px; margin: 2.75rem auto; padding: 0 1rem; }
.container.wide { max-width: 760px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.card > h1 + .muted { margin-top: -0.15rem; }

/* --- Hero (home) --- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    color: #fff;
    padding: 3.25rem 2.25rem;
    box-shadow: var(--shadow-lg);
    isolation: isolate;
}
.hero::before {
    content: "";
    position: absolute; inset: 0; z-index: -2;
    background-image: url("../img/hero.jpg");
    background-size: cover;
    background-position: center;
    transform: scale(1.05);
}
.hero::after {
    content: "";
    position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(135deg, rgba(49, 46, 129, 0.86), rgba(139, 92, 246, 0.68));
}
.hero h1 { font-size: 2.1rem; color: #fff; }
.hero p { color: rgba(255, 255, 255, 0.9); max-width: 42ch; }
.hero .actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero .actions .btn { width: auto; }

.badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 0.3rem 0.7rem; border-radius: 999px;
    margin-bottom: 1rem;
}

/* Feature grid under the hero */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.feature .ico { font-size: 1.4rem; }
.feature h3 { margin: 0.4rem 0 0.25rem; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* --- Forms --- */
form p, .form-row { margin: 0 0 1.05rem; }
label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--text); margin-bottom: 0.35rem; }
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="password"],
textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.helptext { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 0.3rem; }
.errorlist { list-style: none; padding: 0; margin: 0.35rem 0; color: var(--error-text); font-size: 0.84rem; }

/* --- Buttons --- */
.btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 0.7rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28); }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-light { background: #fff; color: var(--text); }
.btn-ghost { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--bg-tint); color: var(--text); }
.btn-google {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border-strong);
    display: flex; align-items: center; justify-content: center; gap: 0.6rem;
}
.btn-google:hover { background: var(--bg-tint); color: var(--text); }
.btn-google svg { width: 18px; height: 18px; }
.btn-link { background: none; color: var(--muted); width: auto; padding: 0; font-weight: 500; border: none; }
.btn-link:hover { color: var(--text); }
.btn-row { display: flex; gap: 0.75rem; }
.btn-row .btn { width: auto; flex: 1; }

/* --- Divider --- */
.divider { display: flex; align-items: center; gap: 0.75rem; color: var(--faint); font-size: 0.8rem; margin: 1.35rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* --- Messages --- */
.messages { list-style: none; padding: 0; margin: 1.25rem auto 0; max-width: 760px; }
.messages li { padding: 0.7rem 0.95rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem; font-size: 0.9rem; border: 1px solid transparent; }
.messages li.error { background: var(--error-bg); color: var(--error-text); border-color: #f6cccc; }
.messages li.success { background: var(--ok-bg); color: var(--ok-text); border-color: #bfe7cd; }
.messages li.info, .messages li.warning { background: var(--accent-soft); color: var(--accent-dark); border-color: #dcd9fb; }

/* --- Avatars --- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.avatar-initials { background: var(--grad); color: #fff; font-weight: 600; line-height: 1; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar-md { width: 44px; height: 44px; font-size: 1rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar-xl { width: 104px; height: 104px; font-size: 2.1rem; border: 3px solid #fff; box-shadow: var(--shadow); }

/* --- Profile --- */
.profile-head {
    display: flex; align-items: center; gap: 1.1rem;
    padding-bottom: 1.25rem; margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.profile-head .name { font-size: 1.35rem; font-weight: 700; margin: 0; }
.profile-head .sub { color: var(--muted); font-size: 0.9rem; margin: 0.1rem 0 0; }
.profile-cover {
    height: 96px; border-radius: var(--radius) var(--radius) 0 0;
    background: var(--grad); margin: -2rem -2rem 0;
}
.profile-head.on-cover { margin-top: -52px; padding-top: 0; align-items: flex-end; }

.field-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.field-row:last-child { border-bottom: none; }
.field-row .k { color: var(--muted); font-size: 0.9rem; }
.field-row .v { font-weight: 500; text-align: right; word-break: break-word; }
.muted { color: var(--muted); font-size: 0.88rem; }
.foot { text-align: center; margin-top: 1.15rem; font-size: 0.9rem; color: var(--muted); }
.bio { color: var(--text); margin: 0 0 1.25rem; white-space: pre-line; }

.section-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); font-weight: 600; margin: 0 0 0.5rem; }

/* Avatar chooser on the edit form */
.avatar-picker { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.avatar-picker input[type="file"] { font-size: 0.85rem; }

/* --- Responsive --- */
@media (max-width: 540px) {
    .card { padding: 1.35rem; }
    .hero { padding: 2.25rem 1.35rem; }
    .hero h1 { font-size: 1.7rem; }
    .nav { padding: 0.6rem 1rem; }
    .nav .user-chip .email { display: none; }
    .btn-row { flex-direction: column; }
}
