/* ===========================
   FORM PAGE LAYOUT
   =========================== */

.form-container {
    max-width: 800px;
    margin: var(--spacing-xl) auto;
    padding: var(--spacing-lg);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: var(--spacing-lg);
    transition: gap var(--transition-base), color var(--transition-base);
}

.back-link:hover {
    gap: 10px;
    color: var(--primary-dark);
}

.form-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.form-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: rgba(30, 64, 175, 0.08);
    color: var(--primary);
    margin: 0 auto var(--spacing-sm);
}

.form-header-icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.form-header h1 {
    font-size: 1.6rem;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.form-header p {
    color: var(--gray-600);
    font-size: 0.9rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-section {
    display: none;
    animation: fadeIn var(--transition-base);
}

.form-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--gray-100);
}

.section-title.mt-lg {
    margin-top: var(--spacing-xl);
}

.section-subtitle {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: var(--spacing-md);
    font-style: italic;
}

/* ---------- Section Head (icon + title + description) ---------- */

.section-head {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
}

.section-head.mt-lg {
    margin-top: var(--spacing-xl);
}

.section-head-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: rgba(30, 64, 175, 0.08);
    color: var(--primary);
}

.section-head-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.section-head-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.3;
}

.section-head-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 1px;
}

/* ---------- Form Panel (groups one section's fields) ---------- */

.form-panel {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.form-panel:last-child {
    margin-bottom: 0;
}

.form-panel .section-head {
    margin-bottom: var(--spacing-md);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

/* Grid items default to min-width:auto, which lets unbreakable/nowrap
   content (e.g. long .btn labels) force the track wider than its
   container and overflow the page horizontally on narrow screens. */
.form-row > * {
    min-width: 0;
}

.form-row.full {
    grid-template-columns: 1fr;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: space-between;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 2px solid var(--gray-100);
}

.btn-prev,
.btn-next,
.btn-submit {
    flex: 1;
}

/* ---------- Word-limit counter (dưới textarea) ---------- */

.word-limit-counter {
    text-align: right;
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: var(--spacing-xs);
}

.word-limit-counter.over-limit {
    color: var(--danger);
    font-weight: 700;
}

/* ---------- Error Messages ---------- */

.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.error-message::before {
    content: '⚠';
    font-weight: bold;
}

.form-field.error input,
.form-field.error textarea,
.form-field.error select {
    border-color: var(--danger);
}

/* ---------- Success Message ---------- */

.success-section {
    text-align: center;
    padding: var(--spacing-2xl);
    background-color: #f0fdf4;
    border-radius: var(--radius-lg);
    border: 2px solid var(--success);
}

.success-section h2 {
    color: var(--success);
    margin-bottom: var(--spacing-md);
}

.success-section p {
    color: #166534;
    margin: var(--spacing-md) 0;
}

.submission-id {
    display: inline-block;
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--white);
    border: 2px solid var(--success);
    border-radius: var(--radius-md);
    font-weight: 700;
    color: var(--success);
    font-size: 1.1rem;
    letter-spacing: 1px;
    margin: var(--spacing-lg) 0;
    font-family: 'Courier New', monospace;
}

.summary-table {
    width: 100%;
    max-width: 460px;
    margin: 0 auto var(--spacing-lg);
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.summary-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
}

.summary-table tr:last-child td {
    border-bottom: none;
}

.summary-table td:first-child {
    color: var(--gray-500);
    font-weight: 600;
    width: 42%;
}

/* ---------- Intro / Landing Section (process steps) ---------- */

.process-steps {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.process-step {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.process-step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.process-step-text {
    padding-top: 4px;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--gray-700);
}

/* ---------- Inline input inside checkbox label ---------- */

.inline-input {
    display: inline-block;
    width: auto;
    min-width: 160px;
    padding: 3px 10px;
    font-size: 0.85rem;
    margin-left: 4px;
    vertical-align: middle;
}

.alert ul {
    margin: var(--spacing-sm) 0 0;
    padding-left: 1.2em;
}

.alert li {
    margin-bottom: 4px;
}

.alert li:last-child {
    margin-bottom: 0;
}
