/* ── Reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────────── */
.header {
    background: #1a1a2e;
    color: #fff;
    padding: 24px 32px;
    text-align: center;
}
.header h1 {
    font-size: 1.6rem;
    margin-bottom: 4px;
}
.header p {
    font-size: 0.9rem;
    opacity: 0.75;
}

/* ── Form ─────────────────────────────────────────── */
form {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 16px;
}

/* ── Field groups ─────────────────────────────────── */
.field-group {
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    background: #fff;
    transition: box-shadow 0.2s;
}
.field-group:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.field-group legend {
    font-weight: 700;
    font-size: 1rem;
    color: #1a1a2e;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-icon {
    display: inline-block;
    width: 18px;
    text-align: center;
    transition: transform 0.2s;
    font-size: 0.75rem;
}
.field-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.group-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.field-group.collapsed .group-fields {
    display: none;
}

/* ── Form field ───────────────────────────────────── */
.form-field {
    display: flex;
    flex-direction: column;
}
.form-field label {
    font-size: 0.78rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.form-field input {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafbfc;
}
.form-field input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
    background: #fff;
}
.form-field input::placeholder {
    color: #94a3b8;
    opacity: 0.7;
}

/* ── Buttons ──────────────────────────────────────── */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.btn-generate,
.btn-reset {
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.btn-generate {
    background: #2563eb;
    color: #fff;
}
.btn-generate:hover {
    background: #1d4ed8;
}
.btn-reset {
    background: #e2e8f0;
    color: #334155;
}
.btn-reset:hover {
    background: #cbd5e1;
}
.btn-generate:active,
.btn-reset:active {
    transform: scale(0.98);
}

/* ── Status ───────────────────────────────────────── */
.status {
    max-width: 900px;
    margin: 0 auto 24px;
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}
.status.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.status.loading {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.hidden {
    display: none;
}

/* ── Footer ───────────────────────────────────────── */
.footer {
    margin-top: auto;
    text-align: center;
    padding: 16px;
    font-size: 0.78rem;
    color: #94a3b8;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 600px) {
    .header {
        padding: 16px;
    }
    .header h1 {
        font-size: 1.25rem;
    }
    form {
        margin: 12px;
    }
    .group-fields {
        grid-template-columns: 1fr;
    }
    .form-actions {
        flex-direction: column;
    }
    .btn-generate,
    .btn-reset {
        width: 100%;
    }
}
