:root {
    --primary-color: #2c5aa0;
    --secondary-color: #f8b334;
    --accent-color: #e74c3c;
    --light-color: #f5f5f5;
    --dark-color: #333;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f9f9f9;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.full-width { width: 100% !important; }

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), #1e3a8a);
    color: white;
    border-bottom: 5px solid var(--secondary-color);
    padding: 1.25rem 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}

@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
        gap: 2rem;
    }
}

.logo-img {
    max-width: 200px;
    height: auto;
    object-fit: contain;
}

.school-info {
    font-size: 14px;
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.school-info:last-child { margin-bottom: 0; }

/* Form Title */
.form-title {
    text-align: center;
    margin: 30px 0;
    color: var(--primary-color);
    font-size: 2.5rem;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* Program Type Selector */
.form-type-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 15px;
}

.form-type-btn {
    padding: 12px 25px;
    background-color: var(--light-color);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.form-type-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.form-type-btn input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.form-type-btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

/* Form Sections */
.form-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    padding: 30px;
    margin-bottom: 30px;
    border-left: 5px solid var(--primary-color);
}

.section-title {
    color: var(--primary-color);
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1.3;
}

/* Form Layout */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.form-col {
    flex: 1;
    min-width: 250px;
    padding: 0 10px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

input[type="text"],
input[type="date"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white;
    min-height: 46px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.12);
}

textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

.required:after {
    content: " *";
    color: var(--accent-color);
    font-weight: bold;
}

/* Checkbox Groups */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.checkbox-group:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.checkbox-group input[type="radio"],
.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 12px;
    margin-top: 3px;
    transform: scale(1.2);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    font-weight: 500;
    line-height: 1.5;
}

/* Enhanced File Upload */
.file-upload-wrapper { position: relative; }

.file-upload {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    margin-top: 5px;
}

.file-upload:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.15);
}

.file-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
    color: var(--primary-color);
}

.file-upload-text {
    color: #6b7280;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
}

.file-upload small {
    color: #9ca3af;
    font-size: 12px;
}

.file-upload.accepted {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.file-upload.rejected {
    border-color: var(--error-color);
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.file-info {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    display: none;
    font-weight: 500;
}

.file-info.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.file-info.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

/* Buttons */
.btn-submit {
    background: linear-gradient(135deg, var(--primary-color), #1e3a8a);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 40px auto;
    width: 280px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
    font-family: inherit;
    letter-spacing: 0.3px;
}

.btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e3a8a, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.4);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.add-contact-btn {
    background: linear-gradient(135deg, var(--secondary-color), #f59e0b);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(248, 179, 52, 0.3);
    font-family: inherit;
    font-size: 14px;
}

.add-contact-btn:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: translateY(-1px);
}

.remove-contact-btn {
    background: linear-gradient(135deg, var(--accent-color), #dc2626);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.remove-contact-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: scale(1.05);
}

/* Tables */
.emergency-contacts {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.emergency-contacts th,
.emergency-contacts td {
    border: 1px solid #e5e7eb;
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

.emergency-contacts th {
    background: linear-gradient(135deg, var(--primary-color), #1e3a8a);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.emergency-contacts tr:nth-child(even) {
    background-color: #f8fafc;
}

.emergency-contacts tr:hover {
    background-color: #e0f2fe;
}

.emergency-contacts input {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 14px;
}

/* Utility Classes */
.hidden { display: none !important; }

.note {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 20px;
    color: #78350f;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Terms readability */
#nursery-terms p,
#aftercare-terms p {
    margin-bottom: 10px;
    line-height: 1.6;
}

#nursery-terms ul,
#aftercare-terms ul {
    margin: 10px 0 15px 0;
    padding-left: 22px;
}

#nursery-terms ul li,
#aftercare-terms ul li {
    margin-bottom: 6px;
    line-height: 1.55;
}

#nursery-terms h3,
#aftercare-terms h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.15rem;
}

/* Progress Banner */
.progress-banner {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
    animation: pulse 2s infinite;
    display: flex;
    align-items: center;
    gap: 15px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
}

.whatsapp-btn {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    text-decoration: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
    margin: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn:hover {
    background: linear-gradient(135deg, #128c7e, #0d6b5a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, var(--primary-color), #1e3a8a);
    color: white;
    margin-top: 60px;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container { padding: 0 15px; }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-col {
        min-width: 100%;
        padding: 0;
    }

    .form-type-selector {
        flex-direction: column;
        align-items: center;
    }

    .form-type-btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .file-upload {
        padding: 25px 15px;
    }

    .btn-submit {
        width: 100%;
        max-width: 300px;
        margin: 25px auto;
    }

    .modal-content {
        margin: 20px;
        padding: 25px;
    }

    .emergency-contacts {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .emergency-contacts th,
    .emergency-contacts td {
        padding: 8px 8px;
        font-size: 13px;
        white-space: nowrap;
    }

    .form-section {
        padding: 22px;
        margin-bottom: 22px;
    }

    .school-info {
        font-size: 13px;
    }

    .logo-img {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .form-section {
        padding: 18px;
    }

    .form-title {
        font-size: 1.6rem;
        margin: 20px 0;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .btn-submit {
        font-size: 16px;
        padding: 14px 30px;
    }

    header {
        padding: 0.9rem 0;
    }

    .note {
        font-size: 0.88rem;
        padding: 12px 14px;
    }
}

/* Print Styles */
@media print {
    body * { visibility: hidden; }
    #print-content, #print-content * {
        visibility: visible;
        position: relative;
        background: white !important;
        color: black !important;
    }
    #print-content {
        width: 100%;
        margin: 0;
        padding: 20px;
        box-shadow: none;
    }
    .no-print, header, footer, .btn-submit, .modal-overlay {
        display: none !important;
    }
    @page { margin: 1in; }
}