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

body {
    background: #f6f7fb;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 24px 0;
}

.main-container {
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.header-section {
    background: #ffffff;
    padding: 28px 20px;
    text-align: center;
    border-bottom: 1px solid #eceff4;
    position: relative;
}

.header-section::before { display: none; }

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

.logo-container {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.logo-container img {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.header-section h3 {
    color: #111;
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

.header-section h4 {
    color: #333;
    font-size: 1.3em;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.content-section {
    padding: 40px;
}

.terms-intro {
    text-align: center;
    font-size: 1.05em;
    color: #4a4f57;
    margin-bottom: 24px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #eceff4;
}

.terms-list {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #eceff4;
}

.terms-list ul {
    list-style: none;
    padding: 0;
}

.terms-list li {
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fcfdff;
    border-radius: 8px;
    border: 1px solid #e9edf3;
    color: #2f343b;
    line-height: 1.6;
}

.terms-list li:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.notice-box {
    background: #fffef4;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid #f3eac2;
}

.notice-box p {
    color: #2d3436;
    font-weight: 500;
    margin: 0;
    font-size: 1.05em;
}

.form-section {
    background: #ffffff;
    padding: 28px;
    border-radius: 12px;
    margin-top: 24px;
    border: 1px solid #eceff4;
}

.checkbox-container {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 28px; /* space before the booking row */
    border: 0;
}

.checkbox-container label {
    display: flex;
    align-items: flex-start; /* align checkbox with multiline text */
    gap: 12px;
    line-height: 1.25; /* tighter vertical spacing in consent text */
    width: 100%; /* ensure label spans the container width */
    cursor: pointer;
}

.checkbox-container span {
    display: block;
    flex: 1 1 auto; /* allow text to take remaining width */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.checkbox-container span {
    font-size: 1.05em;
    color: #2d3436;
    font-weight: 500;
}

/* Mobile-safe rules to avoid overlap of checkbox and following fields */
.checkbox-container {
    margin-bottom: 24px !important; /* extra space before next row */
}
.checkbox-container label {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap; /* allow text to wrap to next line */
}
.checkbox-container input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 4px;
    flex: 0 0 auto;
}
.checkbox-container .black-text {
    display: block;
    flex: 1 1 100%;
    min-width: 0;
    white-space: normal;  /* allow wrapping */
    line-height: 1.4;
    word-break: break-word;
}

@media (max-width: 480px) {
    /* Stack checkbox above text on very small screens for maximum safety */
    .checkbox-container label {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .checkbox-container input[type="checkbox"] {
        margin: 0 0 4px 0; /* space below checkbox when stacked */
    }
    .checkbox-container .black-text {
        width: 100%;
    }
    .form-section .row {
        margin-bottom: 16px; /* more vertical space between rows on small screens */
    }
}

.input-field {
    margin-bottom: 20px;
}

.input-field input {
    border-bottom: 2px solid #ddd !important;
    transition: border-color 0.3s;
}

.input-field input:focus {
    border-bottom: 2px solid #4facfe !important;
    box-shadow: 0 1px 0 0 #4facfe !important;
}

.input-field .prefix {
    color: #4facfe !important;
}

.input-field label {
    color: #666 !important;
}

.signature-container {
    background: white;
    border: 3px solid #4facfe;
    border-radius: 15px;
    padding: 20px;
    margin: 30px auto;
    max-width: 650px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.signature-title {
    text-align: center;
    color: #4facfe;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.2em;
}

#signature-pad {
    width: 100%;
    height: 220px;
    border-radius: 10px;
    background: #fafafa;
    cursor: crosshair;
}

.btns {
    text-align: center;
    margin-top: 15px;
}

.btn {
    border-radius: 25px !important;
    text-transform: none;
    font-weight: 600;
    padding: 0 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.btn:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.btn.red {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%) !important;
}

.btn-submit {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
    font-size: 1.1em !important;
    padding: 0 40px !important;
    height: 50px !important;
    line-height: 50px !important;
}

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

.error-message {
    background: #fff5f5;
    color: #e53e3e;
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    margin: 10px 0;
    border-left: 4px solid #e53e3e;
    display: none;
    font-weight: 500;
}

.submit-container {
    text-align: center;
    margin-top: 30px;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    animation: fadeIn 0.3s ease-in-out;
}

.modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Success Modal */
.success-modal {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease-out;
    position: relative;
}

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

.success-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease-out 0.2s both;
}

.success-icon i {
    font-size: 60px;
    color: white;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.success-modal h2 {
    color: #2d3436;
    font-size: 2em;
    margin-bottom: 15px;
    font-weight: 700;
}

.success-modal p {
    color: #636e72;
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 30px;
}

.success-modal .btn-close {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
    transition: all 0.3s;
}

.success-modal .btn-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.5);
}

/* Error Modal */
.error-modal {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease-out;
}

.error-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease-out 0.2s both;
}

.error-icon i {
    font-size: 60px;
    color: white;
}

.error-modal h2 {
    color: #2d3436;
    font-size: 2em;
    margin-bottom: 15px;
    font-weight: 700;
}

.error-modal p {
    color: #636e72;
    font-size: 1.05em;
    line-height: 1.6;
    margin-bottom: 30px;
    text-align: left;
}

.error-modal .btn-close {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%) !important;
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(235, 51, 73, 0.4);
    transition: all 0.3s;
}

.error-modal .btn-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(235, 51, 73, 0.5);
}

/* Loading Spinner */
.spinner-container {
    display: none;
    margin-top: 20px;
    text-align: center;
}

.spinner-container.active {
    display: block;
}

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

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

.checkbox-row::after {
    content: "";
    display: block;
    clear: both; /* ensure nothing overlaps the next row */
}

/* Guard against Materialize prefix icon overlapping when focused on small screens */
.row.checkbox-row + .row .input-field .prefix {
    z-index: 1;
    position: relative;
}

/* Ensure the first input row after the checkbox has its own breathing room */
.row.first-input { clear: both; }
.row.first-input .input-field { margin-top: 0; }
.row.first-input { margin-top: 12px; }

@media (max-width: 768px) {
    .content-section {
        padding: 20px;
    }

    .form-section {
        padding: 20px;
    }

    .header-section h3 {
        font-size: 1.5em;
    }

    .header-section h4 {
        font-size: 1.1em;
    }

    .success-modal, .error-modal {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 16px 0;
    }
    .header-section h3 { font-size: 1.4em; }
    .header-section h4 { font-size: 1.05em; }
    .logo-container img, .header-section img { max-width: 160px; }
    #signature-pad { height: 180px; }
    .checkbox-container span { font-size: 0.88em; line-height: 1.06; }
    .checkbox-container label { gap: 14px; }
    .checkbox-row { margin-bottom: 28px !important; }
    .checkbox-container { padding-bottom: 6px; }
    .checkbox-row + .row { margin-top: 18px; }
    .checkbox-row + .row .input-field { clear: both; margin-top: 8px; }
    .row.first-input { margin-top: 20px !important; }
    /* Keep the label from floating too high on tiny screens to prevent overlap */
    .row.first-input .input-field label { transition: transform 0.2s ease; }
    .row.first-input .input-field label.active { transform: translateY(-8px) scale(0.95) !important; }
    .row.first-input .input-field { padding-top: 2px; }
    .btn-submit { height: 48px !important; line-height: 48px !important; }
    .error-message { font-size: 0.95em; }
}

@media (max-width: 992px) {
    .content-section {
        padding: 20px;
    }

    .form-section {
        padding: 20px;
    }
}
