:root {
    --primary-bronze: #6b5344;
    --primary-bronze-light: #8a6d5b;
    --primary-bronze-dark: #5a4837;
    --bg-cream: #fdfbf8;
    --bg-section: #f9f6f2;
    --border-light: #e8e0d8;
    --text-dark: #1a1a1a;
    --text-muted: #666;
    --white: #ffffff;
    --success-green: #2e7d32;
    --error-red: #c62828;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-cream);
}

.form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

header {
    background: var(--white);
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 2px solid var(--primary-bronze);
    margin-bottom: 1.5rem;
}

header .header-inner {
    max-width: 800px;
    margin: 0 auto;
}

.tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0px;
}

.tab-btn {
    padding: 0.8rem 1.2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--primary-bronze);
    background: var(--bg-section);
}

.tab-btn.active {
    color: var(--primary-bronze);
    border-bottom: 3px solid var(--primary-bronze);
    background: var(--bg-section);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

header h1 {
    font-size: 1.5rem;
    font-weight: 400;
    font-family: 'Zapf Chancery', 'Brush Script MT', cursive;
    color: var(--text-dark);
}

header .tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

header .contact-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.form-title {
    text-align: center;
    margin: 1.5rem 0;
}

.form-title h2 {
    font-size: 1.4rem;
    color: var(--primary-bronze);
    font-weight: 400;
}

.form-intro {
    background: var(--bg-section);
    border: 1px solid var(--border-light);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.form-section {
    background: var(--white);
    border: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
    padding: 1.25rem;
}

.section-heading {
    font-size: 1.1rem;
    color: var(--primary-bronze);
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    letter-spacing: 0.5px;
}

.question-group {
    margin-bottom: 1.25rem;
}

.question-group:last-child {
    margin-bottom: 0;
}

.q-label {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--text-dark);
}

.q-number {
    color: var(--primary-bronze);
    font-weight: 700;
}

.q-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.4rem;
}

.q-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    border-left: 2px solid var(--border-light);
    padding-left: 0.75rem;
    font-style: italic;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-light);
    font-family: 'Times New Roman', Times, serif;
    font-size: 0.95rem;
    background: var(--white);
    color: var(--text-dark);
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-bronze);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

.input-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.input-row .input-group {
    flex: 1;
    min-width: 200px;
}

.input-group {
    margin-bottom: 0.5rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    font-weight: 700;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.radio-option input[type="radio"] {
    accent-color: var(--primary-bronze);
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-option input[type="checkbox"] {
    accent-color: var(--primary-bronze);
    cursor: pointer;
}

.file-upload-area {
    margin-top: 0.5rem;
    padding: 0.75rem;
    border: 1px dashed var(--border-light);
    background: var(--bg-section);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-upload-area:hover {
    border-color: var(--primary-bronze);
}

.file-upload-area input[type="file"] {
    display: none;
}

.file-upload-area .upload-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-upload-area .upload-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.file-list {
    margin-top: 0.4rem;
    font-size: 0.8rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: var(--white);
    border: 1px solid var(--border-light);
    margin-top: 0.25rem;
}

.file-item .remove-file {
    color: var(--error-red);
    cursor: pointer;
    font-weight: bold;
    border: none;
    background: none;
    font-size: 1rem;
    padding: 0 0.25rem;
}

.signature-section {
    background: var(--white);
    border: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
    padding: 1.25rem;
}

.signature-pad-wrapper {
    position: relative;
    margin: 0.75rem 0;
}

.signature-pad-wrapper canvas {
    border: 1px solid var(--border-light);
    width: 100%;
    height: 150px;
    cursor: crosshair;
    touch-action: none;
    background: var(--white);
}

.signature-controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-family: 'Times New Roman', Times, serif;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
    background: var(--primary-bronze);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-bronze-dark);
}

.btn-secondary {
    background: var(--bg-section);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-submit {
    width: 100%;
    padding: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qr-desktop-only {
    display: inline-block;
}

@media (max-width: 1024px) {
    .qr-desktop-only {
        display: none !important;
    }
}

@media (pointer: coarse) {
    .qr-desktop-only {
        display: none !important;
    }
}

.qr-section {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-section);
    border: 1px solid var(--border-light);
    text-align: center;
}

.qr-section p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

#qr-code-container {
    display: inline-block;
    padding: 0.5rem;
    background: var(--white);
    margin: 0.5rem 0;
}

.mobile-sig-status {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.mobile-sig-status.waiting {
    color: var(--primary-bronze);
}

.mobile-sig-status.received {
    color: var(--success-green);
}

.submit-section {
    margin-top: 1.5rem;
}

.submit-notice {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-style: italic;
}

.form-message {
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.95rem;
    text-align: center;
    display: none;
}

.form-message.success {
    display: block;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: var(--success-green);
}

.form-message.error {
    display: block;
    background: #fce4ec;
    border: 1px solid #ef9a9a;
    color: var(--error-red);
}

.form-message.info {
    display: block;
    background: #fff3e0;
    border: 1px solid #ffcc80;
    color: #e65100;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-bronze);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 1rem;
    color: var(--primary-bronze);
    font-size: 1rem;
}

footer {
    background: #f5f5f5;
    border-top: 1px solid var(--border-light);
    padding: 1.5rem;
    text-align: center;
    margin-top: 2rem;
}

footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

footer a {
    color: var(--primary-bronze);
}

@media (max-width: 600px) {
    .form-container {
        padding: 0 0.5rem 1.5rem;
    }

    .form-section,
    .signature-section {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .input-row {
        flex-direction: column;
        gap: 0;
    }

    .radio-group,
    .checkbox-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .signature-pad-wrapper canvas {
        height: 120px;
    }
}
