/* Modern form design (aligned with docs/sample-modern-form.html) */
:root {
    --bg-page: #eef2f7;
    --bg-card: #ffffff;
    --bg-header: #0c2d4a;
    --text: #1a2332;
    --text-muted: #5c6b7a;
    --border: #d8e0ea;
    --border-focus: #1a6fb5;
    --accent: #1a6fb5;
    --accent-hover: #145a94;
    --error: #c5221f;
    --success: #137333;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 4px 24px rgba(12, 45, 74, 0.08);
    --shadow-focus: 0 0 0 3px rgba(26, 111, 181, 0.2);
    --font: "DM Sans", system-ui, sans-serif;
    --max-width: 720px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-page);
    min-height: 100vh;
}

/* Sticky header */
.site-header {
    background: var(--bg-header);
    color: #fff;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.site-header__inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-header__logo {
    height: 48px;
    width: auto;
    background: #fff;
    padding: 6px 10px;
    border-radius: 8px;
}

.site-header__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

@media (max-width: 767px) {
    .site-header__title {
        display: none;
    }
}

/* Page shell */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

.form-intro {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 1.5rem;
    line-height: 1.6;
}

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

.form-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.form-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.form-section__title {
    margin: 0 0 0.35rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section__title::before {
    content: "";
    width: 4px;
    height: 1.25em;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}

.form-section__subtitle {
    margin: 1.25rem 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.form-section__hint {
    margin: 0 0 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1rem;
}

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

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

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.field--full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

.field input,
.field select,
.field textarea {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    width: 100%;
    height: auto;
    margin: 0;
    word-break: normal;
}

.field textarea {
    min-height: 100px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    background: #fff;
    box-shadow: var(--shadow-focus);
}

.field input.error,
.field select.error,
.field textarea.error {
    border-color: var(--error);
    background: #fef7f6;
}

.field:has(input.error) label,
.field:has(select.error) label,
.field:has(textarea.error) label {
    color: var(--error);
}

.date-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 0.5rem;
}

.date-row .field label {
    font-size: 0.75rem;
}

.form-actions {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.btn-submit {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.85rem 2.5rem;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(26, 111, 181, 0.35);
    transition: background 0.15s, transform 0.1s;
}

.btn-submit:hover {
    background: var(--accent-hover);
}

.btn-submit:active {
    transform: scale(0.98);
}

.form-status {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--error);
    min-height: 1.25em;
    font-weight: 600;
}

/* Success screen */
.success-view {
    text-align: center;
    padding: 3rem 2rem;
}

.success-view__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--success);
}

.success-view h2 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.success-view p {
    color: var(--text-muted);
    margin: 0;
}

/* Loader overlay */
#loader {
    display: none;
    position: fixed;
    z-index: 99999;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    background: rgba(238, 242, 247, 0.85);
}

.l_circle {
    margin: 0 auto;
    width: 50px;
    height: 50px;
    position: relative;
}

.container1 > div,
.container2 > div,
.container3 > div {
    width: 10px;
    height: 10px;
    background-color: var(--accent);
    border-radius: 100%;
    position: absolute;
    animation: bouncedelay 1.2s infinite ease-in-out;
    animation-fill-mode: both;
}

.l_circle .l_circle-container {
    position: absolute;
    width: 100%;
    height: 100%;
}

.container2 {
    transform: rotateZ(45deg);
}

.container3 {
    transform: rotateZ(90deg);
}

.circle1 { top: 0; left: 0; }
.circle2 { top: 0; right: 0; }
.circle3 { right: 0; bottom: 0; }
.circle4 { left: 0; bottom: 0; }

.container2 .circle1 { animation-delay: -1.1s; }
.container3 .circle1 { animation-delay: -1.0s; }
.container1 .circle2 { animation-delay: -0.9s; }
.container2 .circle2 { animation-delay: -0.8s; }
.container3 .circle2 { animation-delay: -0.7s; }
.container1 .circle3 { animation-delay: -0.6s; }
.container2 .circle3 { animation-delay: -0.5s; }
.container3 .circle3 { animation-delay: -0.4s; }
.container1 .circle4 { animation-delay: -0.3s; }
.container2 .circle4 { animation-delay: -0.2s; }
.container3 .circle4 { animation-delay: -0.1s; }

@keyframes bouncedelay {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* jQuery UI dialog */
.ui-widget {
    font-family: var(--font);
}

.ui-dialog .ui-dialog-titlebar {
    background: var(--bg-header);
    color: #fff;
    border: none;
}

.ui-dialog .ui-dialog-content {
    color: var(--text);
}
