/**
 * Marathon Registration System Stylesheet
 * Camford International School
 * Mobile-First, Responsive Design
 */

/* ===================================
   CSS Variables
   =================================== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #d1d5db;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ===================================
   Reset and Base Styles
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===================================
   Container and Layout
   =================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    flex: 1;
    padding: 40px 0;
}

/* ===================================
   Banner
   =================================== */
.hero-banner {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 400px;
}

/* ===================================
   Header
   =================================== */
.site-header {
    background: white;
    color: var(--text-color);
    padding: 30px 0;
    box-shadow: var(--shadow-md);
    border-bottom: 3px solid var(--primary-color);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.school-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: white;
    border-radius: 50%;
    padding: 10px;
    box-shadow: var(--shadow-sm);
}

.school-logo-simple {
    height: 80px;
    width: auto;
    object-fit: contain;
}

.header-text h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-color);
}

.event-title {
    font-size: 18px;
    font-weight: 300;
    color: var(--text-light);
}

/* ===================================
   Forms
   =================================== */
.registration-container {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    margin: 0 auto;
    max-width: 900px;
}

.form-intro {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--bg-light);
}

.form-intro h2 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.form-intro p {
    color: var(--text-light);
    font-size: 16px;
}

.event-info-note {
    background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
    border-left: 4px solid var(--primary-color);
    padding: 20px 25px;
    margin-bottom: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.event-info-note h3 {
    font-size: 20px;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 600;
}

.event-info-note ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.event-info-note ul li {
    padding: 8px 0 8px 28px;
    position: relative;
    color: var(--text-color);
    line-height: 1.6;
}

.event-info-note ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 18px;
}

.form-section {
    margin-bottom: 40px;
}

.form-section h3 {
    font-size: 22px;
    color: var(--text-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bg-light);
}

.form-section h4 {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 15px;
    margin-top: 20px;
}

.section-note {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 4px;
}

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

.form-group {
    flex: 1;
    min-width: 250px;
}

.form-group.col-md-6 {
    flex: 0 0 calc(50% - 10px);
}

.form-group.col-md-4 {
    flex: 0 0 calc(33.333% - 14px);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

.required {
    color: var(--danger-color);
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 15px;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control.error {
    border-color: var(--danger-color);
}

.form-control.success {
    border-color: var(--secondary-color);
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: var(--text-light);
}

.validation-message {
    margin-top: 5px;
    font-size: 13px;
    color: var(--danger-color);
    display: none;
}

.validation-message.show {
    display: block;
}

/* T-Shirt Size Selector Styling */
select[id*="tshirt"] {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%232563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.38 3.46L16 2a4 4 0 01-8 0L3.62 3.46a2 2 0 00-1.34 2.23l.58 3.47a1 1 0 00.99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 002-2V10h2.15a1 1 0 00.99-.84l.58-3.47a2 2 0 00-1.34-2.23z"></path></svg>');
    background-repeat: no-repeat;
    background-position: 12px center;
    padding-left: 45px !important;
    font-weight: 500;
}

select[id*="tshirt"]:focus {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%231d4ed8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.38 3.46L16 2a4 4 0 01-8 0L3.62 3.46a2 2 0 00-1.34 2.23l.58 3.47a1 1 0 00.99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 002-2V10h2.15a1 1 0 00.99-.84l.58-3.47a2 2 0 00-1.34-2.23z"></path></svg>');
}

label[for*="tshirt"] {
    display: flex;
    align-items: center;
    gap: 6px;
}

label[for*="tshirt"]::before {
    content: "👕";
    font-size: 18px;
}

/* Radio and Checkbox */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
}

/* Family Members */
.family-member-block {
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.additional-member {
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    position: relative;
}

.remove-member-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: var(--transition);
}

.remove-member-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Fee Summary */
.fee-summary-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 30px;
    border-radius: var(--border-radius);
}

.fee-breakdown {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
}

.fee-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.fee-row:last-child {
    border-bottom: none;
}

.fee-row.fee-total {
    padding-top: 20px;
    margin-top: 10px;
    border-top: 2px solid var(--primary-color);
    font-size: 18px;
}

.fee-amount {
    color: var(--primary-color);
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 14px 32px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background: #059669;
}

.btn-outline {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

/* Loading Indicator */
.form-loading {
    text-align: center;
    padding: 40px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    margin-top: 20px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Alerts */
.alert {
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.alert h2 {
    margin-bottom: 10px;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--secondary-color);
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-close:hover {
    color: var(--text-color);
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.modal-body {
    color: var(--text-color);
    line-height: 1.8;
}

.modal-body ol {
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 12px;
}

/* Size Guide Link */
.size-guide-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: 2px solid var(--primary-color);
}

.size-guide-link:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Size Guide Modal Styles */
.size-guide-modal {
    max-width: 1000px !important;
    max-height: 95vh;
}

.size-guide-subtitle {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 15px;
}

.size-guide-table-container {
    overflow-x: auto;
    margin-bottom: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.size-guide-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

.size-guide-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.size-guide-table th {
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.size-guide-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.size-guide-table tbody tr:hover {
    background-color: #f9fafb;
}

.size-guide-table tbody tr:last-child {
    border-bottom: none;
}

.size-guide-table td {
    padding: 12px 10px;
    text-align: center;
    color: var(--text-color);
}

.size-guide-table td:first-child {
    text-align: left;
    font-weight: 500;
    background-color: #f9fafb;
    white-space: nowrap;
}

.size-guide-tips {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.size-guide-tips h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 18px;
}

.size-guide-tips ul {
    list-style: none;
    padding: 0;
    margin-bottom: 15px;
}

.size-guide-tips li {
    padding: 8px 0;
    position: relative;
    padding-left: 25px;
}

.size-guide-tips li:before {
    content: "📐";
    position: absolute;
    left: 0;
    font-size: 16px;
}

.size-note {
    background: white;
    padding: 12px;
    border-radius: 6px;
    margin: 0;
    font-size: 14px;
    color: var(--text-color);
}

/* Welcome Modal Specific Styles */
.welcome-modal-content {
    max-width: 800px;
    max-height: 90vh;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    margin: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.welcome-banner {
    width: 100%;
    overflow: visible;
}

.welcome-banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.welcome-text {
    padding: 40px;
    text-align: center;
    background: white;
}

.welcome-text h2 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 15px;
}

.welcome-text p {
    color: var(--text-color);
    font-size: 18px;
    margin-bottom: 25px;
    line-height: 1.6;
}

.welcome-text .btn {
    min-width: 200px;
    font-size: 18px;
    padding: 12px 30px;
}

/* Footer */
.site-footer {
    background: var(--text-color);
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-top: auto;
}

.site-footer p {
    margin-bottom: 10px;
}

.site-footer a {
    color: white;
}

.site-footer a:hover {
    opacity: 0.8;
}

.powered-by {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.powered-by a {
    color: #60a5fa;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.powered-by a:hover {
    color: #93c5fd;
    text-decoration: none;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .hero-banner {
        max-height: 250px;
    }

    .banner-image {
        max-height: 250px;
    }

    .header-text h1 {
        font-size: 22px;
    }

    .event-title {
        font-size: 16px;
    }

    .school-logo {
        width: 60px;
        height: 60px;
    }

    .school-logo-simple {
        height: 60px;
    }

    .registration-container {
        padding: 25px;
    }

    .form-intro h2 {
        font-size: 26px;
    }

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

    .form-group,
    .form-group.col-md-6,
    .form-group.col-md-4 {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .fee-row {
        font-size: 14px;
    }

    .modal-content {
        padding: 25px;
    }

    .modal {
        padding: 10px;
    }

    .welcome-modal-content {
        max-height: 85vh;
    }

    .welcome-text {
        padding: 30px 25px;
    }

    .welcome-text h2 {
        font-size: 24px;
    }

    .welcome-text p {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .hero-banner {
        max-height: 200px;
    }

    .banner-image {
        max-height: 200px;
    }

    .school-logo-simple {
        height: 50px;
    }

    .container {
        padding: 0 15px;
    }

    .registration-container {
        padding: 20px;
    }

    .form-intro h2 {
        font-size: 22px;
    }

    .size-guide-modal {
        max-width: 95% !important;
        padding: 20px !important;
    }

    .size-guide-table {
        font-size: 11px;
    }

    .size-guide-table th,
    .size-guide-table td {
        padding: 8px 5px;
        font-size: 10px;
    }

    .size-guide-link {
        font-size: 12px;
        padding: 6px 12px;
    }

    .form-section h3 {
        font-size: 18px;
    }

    .modal {
        padding: 5px;
        align-items: flex-start;
    }

    .welcome-modal-content {
        max-height: 95vh;
        margin-top: 10px;
    }

    .welcome-text {
        padding: 25px 20px;
    }

    .welcome-text h2 {
        font-size: 20px;
    }

    .welcome-text p {
        font-size: 14px;
    }

    .welcome-text .btn {
        min-width: 150px;
        font-size: 16px;
        padding: 10px 20px;
    }
}
