/* ==========================================================================
   Forms — Auth, CRUD, and shared form styles
   Extracted from main.css for modularity (v0.8.0)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Authentication Pages
   -------------------------------------------------------------------------- */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Shared Form Controls
   -------------------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--background);
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(92, 107, 89, 0.1);
}

.form-error {
    color: var(--error);
    font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Password visibility toggle — v0.31.0
   Eye-icon button rendered inside a relative-positioned wrapper around a
   password <input>. Paired with the password-toggle Stimulus controller
   at static/js/controllers/password_toggle_controller.js.
   QA closed-test feedback (Testers Community, 2026-05-22) flagged the
   missing show/hide affordance as a usability gap on the login form.
   -------------------------------------------------------------------------- */
.password-input-wrapper {
    position: relative;
}

/* Reserve space at the right edge of the input so the icon button doesn't
   overlap the password text. 2.75rem ≈ 44px tap target (matches the
   `.form-input` min-height = WCAG-friendly touch size). */
.password-input-wrapper .form-input {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0.25rem;
    transform: translateY(-50%);
    /* 44×44px hit area — WCAG 2.1 AA target size. */
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    /* Disable iOS WebView's tap-highlight rectangle — same convention as
       .mobile-bottom-nav-item in side-nav.css. */
    -webkit-tap-highlight-color: transparent;
    transition: color var(--transition-base, 0.2s ease),
                background var(--transition-base, 0.2s ease);
}

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

/* :focus-visible inset matches the .library-hub__card / .side-nav-link
   pattern (v0.30.1) — keep the ring inside the button's footprint so it
   doesn't bleed past the input's border. */
.password-toggle-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.password-toggle-btn .icon {
    width: 20px;
    height: 20px;
}

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

/* --------------------------------------------------------------------------
   Info Box (login, register)
   -------------------------------------------------------------------------- */
.info-box {
    background: var(--info-bg);
    border: 1px solid var(--info);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.info-box ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

.info-box code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-family: var(--font-mono, monospace);
}

.info-box--warning {
    background: rgba(232, 121, 121, 0.1);
    border-color: rgba(232, 121, 121, 0.3);
}

/* --------------------------------------------------------------------------
   CRUD Form Styles
   -------------------------------------------------------------------------- */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.crud-form {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-base);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-textarea {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: var(--background);
    color: var(--text-color);
    resize: vertical;
}

.form-textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(92, 107, 89, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    min-height: 44px;
    background: var(--background);
    color: var(--text-color);
}

.form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(92, 107, 89, 0.1);
}

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

.form-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-base);
    border-top: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   Confirm Delete
   -------------------------------------------------------------------------- */
.confirm-delete-container {
    max-width: 500px;
    margin: 2rem auto;
}

.confirm-delete-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
}

.confirm-delete-card h2 {
    margin: 0 0 1rem;
    color: var(--danger);
}

.confirm-delete-card .entry-title {
    font-size: 1.25rem;
    margin: 1rem 0;
}

.confirm-delete-card .warning {
    color: var(--danger);
    font-weight: 500;
    margin: 1.5rem 0;
}

.delete-form .form-actions {
    justify-content: center;
    border-top: none;
    margin-top: 1rem;
}