/* ============================================================
   HomelyDiet Auth & Public Pages
   Shared styles for unauthenticated pages: login, register,
   error pages. Uses the same design tokens as client/style.css.
   ============================================================ */

/* ------------------------------------------------------------
   1. Design Tokens (mirrored from client/style.css)
   ------------------------------------------------------------ */
:root {
    --primary: #5B8C5A;
    --primary-dark: #3D6B3C;
    --primary-light: #7BA97A;
    --accent: #D4A853;
    --accent-light: #E8C97D;

    --bg: #FAF8F5;
    --text: #2D2D2D;
    --text-light: #6B6B6B;
    --text-muted: #6B6B6B;

    --white: #FFFFFF;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;

    --danger: #DC2626;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --success-border: #a7f3d0;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --error-border: #fecaca;

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
}

/* ------------------------------------------------------------
   2. Reset & Base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------
   3. Background Shapes (floating gradient circles)
   ------------------------------------------------------------ */
.bg-shapes {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
}

.shape-1 {
    width: 600px;
    height: 600px;
    background: var(--primary);
    opacity: 0.06;
    top: -200px;
    right: -150px;
    animation: float 20s ease-in-out infinite;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    opacity: 0.06;
    bottom: -100px;
    left: -100px;
    animation: float 25s ease-in-out infinite reverse;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: var(--primary-light);
    opacity: 0.06;
    top: 50%;
    left: 10%;
    animation: float 15s ease-in-out infinite;
}

/* ------------------------------------------------------------
   4. Animations
   ------------------------------------------------------------ */
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 10px) scale(1.02); }
}

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

/* ------------------------------------------------------------
   5. Auth Container & Card
   ------------------------------------------------------------ */
.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    padding: 1.5rem;
}

.auth-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease both;
}

@media (max-width: 480px) {
    .auth-card { padding: 2rem 1.5rem; }
}

/* ------------------------------------------------------------
   6. Logo
   ------------------------------------------------------------ */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease 0.05s both;
}

.auth-logo img {
    border-radius: 50%;
    vertical-align: middle;
}

/* ------------------------------------------------------------
   7. Headings & Text
   ------------------------------------------------------------ */
.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: -0.02em;
    animation: fadeInUp 0.5s ease 0.1s both;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease 0.15s both;
}

/* ------------------------------------------------------------
   8. Form Fields
   ------------------------------------------------------------ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--text-light);
    font-size: 0.875rem;
}

.form-group .optional {
    color: var(--text-muted);
    font-weight: 400;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 140, 90, 0.12);
}

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

/* OTP large centered input */
.otp-input {
    text-align: center !important;
    font-size: 1.75rem !important;
    letter-spacing: 10px !important;
    font-weight: 600 !important;
}

/* ------------------------------------------------------------
   9. Buttons
   ------------------------------------------------------------ */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: opacity 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-green {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}

.btn-green:hover { opacity: 0.9; }

.btn-secondary {
    background: var(--gray-200);
    color: var(--text-light);
}

.btn-full { width: 100%; }

/* ------------------------------------------------------------
   10. Alerts
   ------------------------------------------------------------ */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

/* ------------------------------------------------------------
   11. Auth Links & Footer
   ------------------------------------------------------------ */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    animation: fadeInUp 0.5s ease 0.25s both;
}

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

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

.auth-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
}

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

/* ------------------------------------------------------------
   12. Error Pages
   ------------------------------------------------------------ */
.error-container {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem 1.5rem;
    max-width: 600px;
}

.error-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    margin-bottom: 3rem;
    animation: fadeInUp 0.5s ease both;
}

.error-logo img {
    border-radius: 50%;
}

.error-logo-text {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.error-code {
    font-size: clamp(6rem, 15vw, 10rem);
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    opacity: 0.85;
    animation: fadeInUp 0.6s ease 0.1s both;
}

.error-container h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    animation: fadeInUp 0.6s ease 0.15s both;
}

.error-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.7;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.error-btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.1s;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.error-btn:hover { opacity: 0.9; }
.error-btn:active { transform: scale(0.98); }

.error-footer {
    margin-top: 3rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    animation: fadeInUp 0.6s ease 0.4s both;
}

/* ------------------------------------------------------------
   13. Utility
   ------------------------------------------------------------ */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }

/* Cloudflare Turnstile widget inside auth forms (flexible width, 65px tall) */
.cf-turnstile { margin: 0.25rem 0 1rem; }

/* Honeypot fields (extra_note / extra_ref): off-screen, not display:none, so
   the field is still "visible" to naive bots that only check computed
   display, but unreachable and invisible to real users. */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
