/* ==========================
   Forms (login, add meeting, etc.)
   ========================== */

.form-page {
    padding: 3rem 0 4rem;
    background: #f8fafc;
    min-height: 65vh;
}

.form-card {
    width: min(480px, 100%);
    margin: 0 auto;
    padding: 2.5rem;

    background: #fff;
    border: 1px solid rgb(17 52 86 / 10%);
    border-radius: 12px;

    box-shadow: 0 4px 12px rgb(17 52 86 / 6%);
}

.form-card h1 {
    margin: 0 0 1.5rem;

    color: var(--color-secondary);
    font-size: 1.75rem;
}

.form-subtitle {
    margin: -1rem 0 1.5rem;

    color: #64748b;
    font-size: .9rem;
}

.form-field {
    margin-bottom: 1.25rem;
}

/* The honeypot on public forms (see HoneypotMixin) - moved off-screen
   rather than display:none, which some bots know to skip. */
.form-field-trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-field-help {
    margin: 0.35rem 0 0;

    color: #64748b;
    font-size: 0.8rem;
}

.form-field label {
    display: block;
    margin-bottom: 0.4rem;

    color: var(--color-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;

    border: 1px solid rgb(17 52 86 / 20%);
    border-radius: 6px;

    font-family: inherit;
    font-size: 1rem;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-checkbox label {
    color: var(--color-secondary);
    font-size: 0.9rem;
}

.form-errors {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;

    background: rgb(218 65 68 / 8%);
    border: 1px solid rgb(218 65 68 / 30%);
    border-radius: 6px;

    color: var(--color-primary);
    font-size: 0.9rem;
}

.form-submit {
    display: inline-block;

    padding: 0.75rem 1.5rem;

    background: var(--color-primary);
    border: none;
    border-radius: 6px;

    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;

    transition: transform 0.2s ease;
}

.form-submit:hover {
    transform: translateY(-1px);
}

.form-back-link {
    margin-top: 1.5rem;
}

.form-back-link a {
    color: var(--color-secondary);
    font-size: .9rem;
    font-weight: 600;
}

.form-back-link a:hover {
    color: var(--color-primary);
}

/* "+ Add new" next to a foreign-key dropdown (see resource_form.html /
   resource_form.js) - a small stand-in for what Django admin's own "+"
   icon does next to a FK field, without the popup-window machinery. */
.resource-category-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.resource-category-field select {
    flex: 1;
}

.resource-category-add-toggle {
    padding: 0.5rem 0.9rem;

    background: none;
    border: 1px solid rgb(17 52 86 / 20%);
    border-radius: 6px;

    color: var(--color-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.resource-category-add-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.resource-category-add {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;

    margin-top: 0.75rem;
}

/* An explicit `display` above always beats the browser's own default
   [hidden] { display: none } rule, regardless of selector specificity -
   author styles outrank user-agent styles in the cascade regardless of
   specificity. Without this, toggling the `hidden` attribute in JS
   still leaves the element visible. Same story for the error box. */
.resource-category-add[hidden],
.form-errors[hidden] {
    display: none;
}

.resource-category-add input {
    flex: 1;
    min-width: 10rem;
    padding: 0.5rem 0.7rem;

    border: 1px solid rgb(17 52 86 / 20%);
    border-radius: 6px;

    font-family: inherit;
    font-size: 0.95rem;
}

.resource-category-add-submit {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    text-transform: none;
}

/* Shown above a form after a successful submit (Contact, Join). */
.form-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    margin-bottom: 1rem;
    padding: 0.75rem 1rem;

    background: rgb(22 163 74 / 8%);
    border: 1px solid rgb(22 163 74 / 30%);
    border-radius: 6px;

    color: #15803d;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Phones: the form card's padding gives the fields more room. */
@media (max-width: 600px) {
    .form-page {
        padding: 2rem 0 3rem;
    }

    .form-card {
        padding: 1.75rem 1.25rem;
    }

    /* The category dropdown gets the full width, with + New Category
       underneath it. */
    .resource-category-field {
        flex-direction: column;
        align-items: stretch;
    }

    .resource-category-add-toggle {
        align-self: flex-start;
    }
}
