:root {
    --primary: #003366;
    --primary-light: #004d99;
    --accent: #ff6b00; /* Subtle orange accent, commonly used with navy */
    --bg-color: #f4f7f9;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #d1d5db;
    --success: #10b981;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 40px;
}

/* Status Bar */
#status-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    z-index: 1000;
    color: white;
    transition: background-color 0.3s ease;
}
#status-bar.online { background-color: var(--success); }
#status-bar.offline { background-color: var(--error); }
#queue-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
}

.container {
    max-width: 800px;
    margin: 40px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-top: 50px;
}

header {
    background: var(--primary);
    color: white;
    padding: 30px;
    text-align: center;
    border-bottom: 4px solid var(--accent);
}
header h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

form { padding: 30px; }

/* Layout Helpers */
.row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.flex-1 { flex: 1; min-width: 150px; }
.flex-2 { flex: 2; min-width: 250px; }
.flex-3 { flex: 3; min-width: 300px; }
.align-center { align-items: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.ml-2 { margin-left: 16px; }
.wrap { flex-wrap: wrap; }

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
}
label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.required { color: var(--error); }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: #f9fafb;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
    background-color: white;
}

/* Specific Field Styles */
.top-field {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--bg-color);
    margin-bottom: 24px;
}
.top-field input { max-width: 300px; }

.border-bottom-only {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    padding: 8px 4px !important;
}
.border-bottom-only:focus {
    border-bottom-color: var(--primary) !important;
    box-shadow: none !important;
}

/* Sections matching the paper form */
.section-container {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}
.section-sidebar {
    background: #e5e7eb;
    color: var(--text-muted);
    font-weight: 700;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    letter-spacing: 2px;
    width: 50px;
}
.section-sidebar.dark {
    background: var(--text-main);
    color: white;
}
.section-content {
    padding: 20px;
    flex: 1;
    background: #fafafa;
}
.section-title {
    display: block;
    margin-bottom: 12px;
    color: var(--text-main);
}

/* Checkboxes and Radios */
.checkbox-group {
    display: flex;
    gap: 20px;
}
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-transform: none;
    color: var(--text-main);
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.checkbox-label:hover {
    background: #eef2f6;
}
input[type="checkbox"], input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Lined Textarea */
.lined-textarea {
    background-image: linear-gradient(transparent, transparent 29px, #d1d5db 29px);
    background-size: 100% 30px;
    line-height: 30px;
    padding: 0 8px;
    border: none;
    resize: vertical;
    min-height: 120px;
    background-color: transparent;
}
.lined-textarea:focus {
    box-shadow: none;
    background-image: linear-gradient(transparent, transparent 29px, var(--primary) 29px);
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 18px;
    background: var(--primary);
    color: white;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    margin-top: 10px;
}
.btn-submit:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.btn-submit:active {
    transform: translateY(0);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal.active { display: flex; }
.modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.success-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Tablet Optimizations */
@media (max-width: 768px) {
    .container { margin: 40px 10px; }
    .section-sidebar {
        writing-mode: horizontal-tb;
        transform: none;
        width: 100%;
        padding: 10px;
        letter-spacing: 1px;
    }
    .section-container { flex-direction: column; }
    .checkbox-grid { grid-template-columns: 1fr; }
}
