/**
 * Thames Admissions Forms - Frontend Styles
 * Designed to match Thames British School brand colors
 * Style: Minimalist with underline inputs
 */

/* CSS Variables */
:root {
    --thames-primary: #1a237e;
    --thames-primary-light: #3f51b5;
    --thames-accent: #e91e63;
    --thames-accent-hover: #c2185b;
    --thames-text: #333333;
    --thames-text-light: #666666;
    --thames-text-placeholder: #999999;
    --thames-border: #cccccc;
    --thames-border-light: #e0e0e0;
    --thames-bg-light: #f8f9fa;
    --thames-success: #28a745;
    --thames-error: #dc3545;
    --thames-white: #ffffff;
}

/* Form Wrapper */
.thames-form-wrapper {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Form Base */
.thames-form {
    background: transparent;
    border-radius: 0;
    width: 100%;
}

/* Section Styles */
.thames-form-section {
    margin-bottom: 35px;
    padding-bottom: 0;
    border-bottom: none;
}

.thames-form-section:last-of-type {
    border-bottom: none;
}

.thames-section-title {
    color: var(--thames-accent);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 25px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--thames-accent);
    display: inline-block;
}

/* Child Section */
.thames-child-section {
    background: transparent;
    border-radius: 0;
    padding: 20px 0;
    margin-bottom: 15px;
    border-top: 1px solid var(--thames-border-light);
}

.thames-child-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.thames-child-title {
    color: var(--thames-primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 20px 0;
}

/* Form Rows */
.thames-form-row {
    margin-bottom: 20px;
}

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

.thames-form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .thames-form-row-2col {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Form Fields */
.thames-form-field {
    display: flex;
    flex-direction: column;
}

.thames-form-field label {
    display: none; /* Hide labels, use placeholders instead */
}

.thames-form-field.show-label label {
    display: block;
    color: var(--thames-text);
    font-size: 0.9rem;
    font-weight: 400;
    margin-bottom: 8px;
}

.thames-form-field .required {
    color: var(--thames-accent);
}

.thames-form-field input[type="text"],
.thames-form-field input[type="email"],
.thames-form-field input[type="tel"],
.thames-form-field input[type="date"],
.thames-form-field select,
.thames-form-field textarea {
    width: 100%;
    padding: 12px 0;
    font-size: 1rem;
    border: none;
    border-bottom: 1px solid var(--thames-border);
    border-radius: 0;
    background: transparent;
    color: var(--thames-text);
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.thames-form-field input:focus,
.thames-form-field select:focus,
.thames-form-field textarea:focus {
    outline: none;
    border-bottom-color: var(--thames-accent);
    box-shadow: none;
}

.thames-form-field input::placeholder,
.thames-form-field textarea::placeholder {
    color: var(--thames-text-placeholder);
    font-weight: 400;
}

.thames-form-field textarea {
    resize: vertical;
    min-height: 120px;
    border: 1px solid var(--thames-border-light);
    border-radius: 4px;
    padding: 12px;
    background: var(--thames-white);
}

.thames-form-field textarea:focus {
    border-color: var(--thames-accent);
}

/* Small field modifier */
.thames-field-small {
    max-width: 200px;
}

/* Select styling */
.thames-form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-color: transparent;
    padding-right: 20px;
    cursor: pointer;
}

.thames-form-field select option {
    background: var(--thames-white);
    color: var(--thames-text);
}

/* Checkbox Styles */
.thames-checkbox-field {
    flex-direction: row !important;
    align-items: flex-start;
}

.thames-checkbox-field label {
    display: flex !important;
}

.thames-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-weight: normal !important;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--thames-text);
}

.thames-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--thames-primary);
    border: 2px solid var(--thames-border);
    border-radius: 3px;
}

/* Checkbox Group (for days) */
.thames-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.thames-checkbox-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--thames-border-light);
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.thames-checkbox-inline:hover {
    border-color: var(--thames-accent);
}

.thames-checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--thames-accent);
}

.thames-checkbox-inline:has(input:checked) {
    background: rgba(233, 30, 99, 0.08);
    border-color: var(--thames-accent);
}

/* Consent Section */
.thames-consent-section {
    background: transparent;
    border-radius: 0;
    padding: 20px 0;
    margin-top: 20px;
}

.thames-data-notice {
    margin-top: 15px;
    padding: 15px;
    background: rgba(26, 35, 126, 0.03);
    border-left: 3px solid var(--thames-primary);
    border-radius: 0;
}

.thames-data-notice p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--thames-text-light);
    line-height: 1.6;
}

/* Submit Button */
.thames-form-submit {
    margin-top: 30px;
    text-align: left;
}

.thames-submit-btn {
    display: inline-block;
    padding: 14px 36px;
    background: var(--thames-accent);
    color: var(--thames-white);
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.1s;
}

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

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

.thames-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.thames-submit-btn .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.thames-submit-btn .btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--thames-white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: thames-spin 0.8s linear infinite;
}

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

/* Form Messages */
.thames-form-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.thames-form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.thames-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Field Validation States */
.thames-form-field.has-error input,
.thames-form-field.has-error select,
.thames-form-field.has-error textarea {
    border-color: var(--thames-error);
}

.thames-form-field.has-error input:focus,
.thames-form-field.has-error select:focus,
.thames-form-field.has-error textarea:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Animation for child sections */
.thames-child-section {
    animation: thames-fadeIn 0.3s ease;
}

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

/* Responsive adjustments */
@media (max-width: 480px) {
    .thames-section-title {
        font-size: 1.1rem;
    }

    .thames-form-field input,
    .thames-form-field select,
    .thames-form-field textarea {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .thames-submit-btn {
        width: 100%;
        padding: 14px 20px;
    }

    .thames-checkbox-group {
        flex-direction: column;
        gap: 10px;
    }

    .thames-field-small {
        max-width: 100%;
    }
}

/* Date input styling */
.thames-form-field input[type="date"] {
    color: var(--thames-text-placeholder);
}

.thames-form-field input[type="date"]:valid,
.thames-form-field input[type="date"]:focus {
    color: var(--thames-text);
}

.thames-form-field input[type="date"]::-webkit-datetime-edit-text,
.thames-form-field input[type="date"]::-webkit-datetime-edit-month-field,
.thames-form-field input[type="date"]::-webkit-datetime-edit-day-field,
.thames-form-field input[type="date"]::-webkit-datetime-edit-year-field {
    color: inherit;
}

/* Section title adjustments */
.thames-form-section .thames-section-title {
    width: 100%;
    display: block;
}

/* Form row spacing */
.thames-form-row {
    margin-bottom: 25px;
}

/* Hide labels on selects but show placeholder text */
.thames-form-field select {
    color: var(--thames-text-placeholder);
}

.thames-form-field select:valid:not([value=""]),
.thames-form-field select option:checked:not([value=""]) {
    color: var(--thames-text);
}

.thames-form-field select:focus {
    color: var(--thames-text);
}

/* Form message adjustments */
.thames-form-message {
    margin-top: 25px;
    padding: 20px;
    border-radius: 4px;
    text-align: left;
    font-weight: 400;
    font-size: 0.95rem;
}

/* Ensure full width on all containers */
.thames-enquiry-form,
.thames-visit-form,
.thames-openday-form {
    width: 100%;
}

/* Print styles */
@media print {
    .thames-form-wrapper {
        max-width: 100%;
    }

    .thames-submit-btn {
        display: none;
    }
}
