/* Site-wide styles for templates/base.html. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin-bottom: 1rem;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

.site-nav {
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    z-index: 1001;
}

.logo img {
    height: 32px;
    width: auto;
    display: block;
}

.nav-links-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    margin-left: 2.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a:not(.btn) {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.15s;
    font-size: 0.9375rem;
}

.nav-links a:not(.btn):hover {
    color: var(--text-primary);
}

.nav-links a:not(.btn).active {
    color: var(--text-primary);
    font-weight: 500;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }

    .nav-links-wrapper {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--bg-dark);
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        margin: 0;
        padding: 2rem;
        transform: translateY(-10px);
        transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.2s, visibility 0.2s;
        opacity: 0;
        visibility: hidden;
        z-index: 1000;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-2);
    }

    .nav-links-wrapper.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 1.25rem;
        width: 100%;
    }

    .nav-links a:not(.btn) {
        font-size: 1.125rem;
        width: 100%;
        padding: 0.5rem 0;
    }

    .site-nav .btn {
        width: 100%;
        text-align: center;
        padding: 0.875rem;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.125rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.5;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-primary {
    background-color: var(--primary-strong);
    color: white;
}

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

.btn-outline {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background-color: transparent;
}

.btn-outline:hover {
    background-color: var(--bg-raised);
}

/* Visible keyboard focus everywhere; the browser's default ring is hard to see on the
   dark theme. Text inputs keep their own border-and-glow focus style. */
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible,
[role="button"]:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--primary-text);
    outline-offset: 2px;
}

/* Low-emphasis ghost button: the "back" links atop app pages, "Continue with Google". */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem 0.375rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    text-decoration: none;
    align-self: flex-start;
    transition: background-color 0.15s, color 0.15s;
}

.btn-ghost:hover {
    background: var(--bg-raised);
    color: var(--text-primary);
}

.btn-ghost-block {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem;
    font-size: 1rem;
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Upsell buttons. Same fill as primary: the upgrade is signalled by the copy and the
   amber accent around it, not by a louder button. */
.btn-premium {
    background: var(--primary-strong);
    color: white;
}

.btn-premium:hover {
    background: var(--primary-hover);
}

/* Destructive actions. White on --danger is under AA contrast, so these are tints. */
.btn-danger {
    background: rgba(var(--danger-rgb), 0.16);
    border-color: rgba(var(--danger-rgb), 0.5);
    color: var(--danger-text);
}

.btn-danger:hover {
    background: rgba(var(--danger-rgb), 0.26);
    border-color: var(--danger);
}

.btn-outline-danger {
    background: transparent;
    border-color: rgba(var(--danger-rgb), 0.4);
    color: var(--danger-text);
}

.btn-outline-danger:hover {
    background: rgba(var(--danger-rgb), 0.1);
    border-color: var(--danger);
}

/* On/off switch: <div class="form-switch"><input type="checkbox" class="form-check-input"></div>. */
.form-switch .form-check-input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 1.375rem;
    margin: 0;
    padding: 2px;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.form-switch .form-check-input::after {
    content: '';
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: transform 0.15s, background-color 0.15s;
}

.form-switch .form-check-input:hover {
    border-color: var(--text-muted);
}

.form-switch .form-check-input:checked {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
}

.form-switch .form-check-input:checked::after {
    background: white;
    transform: translateX(1.125rem);
}

.form-switch .form-check-input:focus-visible {
    outline: 2px solid var(--primary-text);
    outline-offset: 2px;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.footer {
    margin-top: auto;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Form Styles */
.auth-container {
    max-width: 450px;
    margin: 4rem auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.6875rem 0.875rem;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

.form-help {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.errorlist {
    list-style: none;
    color: var(--danger-text);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.auth-container .card {
    padding: 2.25rem;
}

.auth-title {
    text-align: center;
    font-size: 1.875rem;
    margin-bottom: 0.5rem;
}

.auth-sub {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* The free month / Founder's price line on signup and email confirmation. */
.auth-offer {
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--premium-text);
    text-align: center;
}

.auth-offer i {
    margin-right: 0.375rem;
}

.auth-offer-block i {
    margin-right: 0;
}

.auth-offer-block {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(var(--premium-rgb), 0.08);
    border: 1px solid rgba(var(--premium-rgb), 0.3);
    border-radius: var(--radius-lg);
    text-align: left;
}

.auth-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.auth-label-row label {
    margin-bottom: 0;
}

.auth-forgot {
    font-size: 0.8125rem;
    color: var(--primary-text);
    text-decoration: none;
}

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

.auth-submit {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    font-size: 1rem;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

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

/* Social Auth */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6875rem;
    background-color: white;
    color: #1f2937;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none !important;
    transition: background-color 0.15s;
    margin-bottom: 0.5rem;
}

.google-btn:hover {
    background-color: #e2e8f0;
}

.google-btn i {
    font-size: 1.125rem;
    color: #4285F4;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider:not(:empty)::before {
    margin-right: 1rem;
}

.divider:not(:empty)::after {
    margin-left: 1rem;
}

/* Django messages, shown as toasts by base.html. */
.flash-toasts {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.flash-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 360px;
    padding: 0.75rem 1rem;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    color: var(--text-primary);
    font-size: 0.875rem;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s;
}

.flash-toast.is-visible {
    opacity: 1;
}

.flash-toast i { flex-shrink: 0; color: var(--primary-text); }
.flash-toast-success i { color: var(--success-text); }
.flash-toast-warning i { color: var(--warning-text); }
.flash-toast-error { border-color: rgba(var(--danger-rgb), 0.5); }
.flash-toast-error i { color: var(--danger-text); }

/* Visually hidden, still read by screen readers (e.g. a label for an input whose purpose
   is clear from the layout). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
    display: none;
}
.htmx-request .htmx-indicator {
    opacity: 1;
    display: inline-block;
}
.htmx-request.htmx-indicator {
    opacity: 1;
    display: inline-block;
}

/* tokens.css sets color-scheme: dark; the chat widget is a light component, so its
   host keeps native controls (the message box) light. */
[id^="nelo-chat-widget-"] {
    color-scheme: light;
}

/* "Email me a sign-in code" on the login page, and the code pages it leads to. */
.auth-code-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.75rem;
}

.auth-code-input {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    letter-spacing: 0.2em;
    text-align: center;
}
