/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Remove default browser focus outlines */
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
}

body {
    font-family: 'Arial MT', Arial, sans-serif;
    color: #55636C;
    line-height: 1.6;
    background-color: #f8f9fa;
    padding: 10px;
    margin: 0;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header Styles */
.header {
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.header-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.image-section {
    flex: 0 0 40%;
    max-width: 40%;
}

.treatment-image {
    width: 100%;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    object-fit: cover;
    display: block;
}

.form-header-section {
    flex: 1;
    padding-left: 0;
    max-width: 100%;
    width: 100%;
}

.logo-container {
    margin-bottom: 10px;
}

.logo {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
}

.main-title {
    font-family: 'Cambria', serif;
    color: #333333;
    font-size: clamp(1.1rem, 2.5vw + 0.5rem, 2.2rem);
    font-weight: bold;
    margin: 0 0 15px 0;
    line-height: 1.2;
    white-space: nowrap;
    transition: font-size 0.3s ease;
}

.header-form-section {
    margin-top: 15px;
}

.header-form-section .form-group {
    margin-bottom: 12px;
}

.header-form-section .form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.header-form-section .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.header-form-section .form-label {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.header-form-section .form-input {
    padding: 8px 12px;
    font-size: 0.9rem;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.header-form-section .form-input:focus {
    background-color: white;
}

.header-form-section .form-input:not(:placeholder-shown) {
    background-color: #f5f5f5;
    border-color: #333333;
    color: #333333;
}

.header-form-section {
    border-bottom: 2px solid #333333;
    padding: 20px;
    margin-bottom: 20px;
    background-color: #f8f9fa;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-left: 4px solid #333333;
}

.welcome-text {
    font-size: 1rem;
    line-height: 1.7;
    margin: 0 0 20px 0;
    padding: 10px 0;
}

/* Information Sections */
.info-section {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #f8f9fa;
    border-left: 4px solid #333333;
}

.info-content {
    margin-top: 15px;
}

.info-content p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #55636C;
}

.info-content p:last-child {
    margin-bottom: 0;
}

.treatment-goals {
    list-style: none;
    padding: 0;
    margin: 0;
}

.treatment-goals li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #55636C;
}

.treatment-goals li:before {
    content: "•";
    color: #333333;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Form Styles */
.form {
    width: 100%;
}

.form-section {
    margin-bottom: 30px;
}

.section-title {
    font-family: 'Cambria', serif;
    color: #333333;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #55636C;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    font-size: 1rem;
    font-family: 'Arial MT', Arial, sans-serif;
    color: #55636C;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    min-height: 48px; /* Minimum touch target size */
}

.form-input:focus {
    outline: none;
    border-color: #333333;
    box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
    background-color: white;
}

.form-input:not(:placeholder-shown) {
    background-color: #f5f5f5;
    border-color: #333333;
    color: #333333;
}

.form-input:invalid {
    border-color: #ccc;
    background-color: #f5f5f5;
}

.form-input:valid:not(:placeholder-shown) {
    border-color: #333333;
    background-color: #f5f5f5;
}

/* Special styles for date input */
input[type="date"]:not(:placeholder-shown) {
    background-color: #f5f5f5 !important;
    border-color: #333333 !important;
    color: #333333 !important;
}

input[type="date"]:focus {
    background-color: white !important;
}

input[type="date"]:invalid {
    border-color: #ccc !important;
    background-color: #f5f5f5 !important;
}

/* Submit Button */
.submit-container {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.submit-btn {
    background-color: #333333;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-family: 'Arial MT', Arial, sans-serif;
    outline: none;
}

.submit-btn:hover {
    background-color: #555555;
    transform: translateY(-2px);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Message Container */
.message-container {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
}

.message {
    font-weight: 600;
    font-size: 1rem;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Tablet responsive adjustments */
@media (max-width: 800px) {
    .image-section {
        flex: 0 0 35%;
        max-width: 35%;
    }
    
    .form-header-section {
        flex: 1;
        min-width: 0; /* Allows flex item to shrink below content size */
    }
    
    .main-title {
        font-size: clamp(0.9rem, 2.5vw + 0.3rem, 1.4rem);
        word-wrap: break-word;
        hyphens: auto;
    }
}

@media (max-width: 680px) {
    .image-section {
        flex: 0 0 30%;
        max-width: 30%;
    }
    
    .form-header-section {
        flex: 1;
        min-width: 0;
    }
    
    .main-title {
        font-size: clamp(0.8rem, 2.2vw + 0.2rem, 1.2rem);
        word-wrap: break-word;
        hyphens: auto;
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 0;
        padding: 15px;
        box-shadow: none;
        max-width: 100%;
    }

    .header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .header-content {
        flex-direction: row;
        gap: 15px;
        align-items: flex-start;
    }

    .image-section {
        flex: 0 0 40%;
        max-width: 40%;
        order: 1;
        text-align: left;
    }

    .form-header-section {
        flex: 1;
        padding-left: 0;
        order: 2;
        width: 100%;
        max-width: 100%;
        min-width: 0; /* Allows flex item to shrink below content size */
    }
    
    .treatment-image {
        max-height: 180px;
        object-fit: cover;
        margin: 0 auto;
    }

    #signature {
        height: 200px !important;
    }

    .main-title {
        font-size: clamp(0.9rem, 2.8vw + 0.2rem, 1.3rem);
        text-align: left;
        word-wrap: break-word;
        hyphens: auto;
    }

    .logo {
        max-width: 100%;
        margin: 0 auto;
        padding: 20px 20px 20px 0;
    }

    .header-form-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    .header-form-section .form-row {
        flex-direction: column;
        gap: 0;
    }

    .header-form-section .form-row .form-group {
        margin-bottom: 15px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        margin-bottom: 20px;
    }

    .welcome-section {
        padding: 15px;
    }

    .welcome-text {
        font-size: 0.95rem;
    }

    .info-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .info-content p {
        font-size: 0.9rem;
    }

    .treatment-goals li {
        font-size: 0.9rem;
    }


    .yes-no-questions .radio-group {
        flex-direction: row;
        gap: 15px;
    }

    .allergy-warning {
        padding: 8px;
    }

    .allergy-warning p {
        font-size: 0.85rem;
    }

    .contraindications-list {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .contraindications-list .checkbox-label {
        padding: 8px;
    }

    .contraindications-list .checkbox-text {
        font-size: 0.85rem;
    }

    .contraindications-intro {
        padding: 12px;
    }

    .subsection-title {
        font-size: 1.1rem;
    }

    .contraindications-warning {
        padding: 12px;
    }

    .risks-intro {
        padding: 12px;
    }

    .risk-category {
        padding: 12px;
        margin-bottom: 20px;
    }

    .risk-title {
        font-size: 1rem;
    }

    .risk-list li {
        font-size: 0.85rem;
    }

    .sub-risk-list li {
        font-size: 0.8rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .form-input {
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .submit-btn {
        padding: 12px 30px;
        font-size: 1rem;
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .header-content {
        gap: 10px;
        align-items: center;
    }
    
    .image-section {
        max-width: 180px;
        text-align: center;
    }
    
    .treatment-image {
        max-height: 120px;
        margin: 0 auto;
    }
    
    .form-header-section {
        text-align: center;
        width: 100%;
        max-width: 100%;
    }

    #signature {
        height: 150px !important;
    }

    .main-title {
        font-size: clamp(0.8rem, 2.3vw + 0.1rem, 1.1rem);
        word-wrap: break-word;
        hyphens: auto;
    }

    .logo {
        max-width: 100px;
    }

    .header-form-section {
        padding: 12px;
        margin-bottom: 12px;
    }

    .header-form-section .form-input {
        padding: 6px 8px;
        font-size: 0.85rem;
    }

    .header-form-section .form-label {
        font-size: 0.85rem;
    }

    .welcome-section {
        padding: 12px;
    }

    .info-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .info-content p {
        font-size: 0.85rem;
    }

    .treatment-goals li {
        font-size: 0.85rem;
    }

    .yes-no-questions .form-group {
        padding: 10px;
    }

    .yes-no-questions .radio-group {
        flex-direction: row;
        gap: 10px;
    }

    .allergy-warning {
        padding: 6px;
    }

    .allergy-warning p {
        font-size: 0.8rem;
    }

    .contraindications-list .checkbox-label {
        padding: 6px;
    }

    .contraindications-list .checkbox-text {
        font-size: 0.8rem;
    }

    .contraindications-intro {
        padding: 10px;
    }

    .subsection-title {
        font-size: 1rem;
    }

    .contraindications-warning {
        padding: 10px;
    }

    .contraindications-warning p {
        font-size: 0.85rem;
    }

    .risks-intro {
        padding: 10px;
    }

    .risk-category {
        padding: 10px;
        margin-bottom: 15px;
    }

    .risk-title {
        font-size: 0.95rem;
    }

    .risk-list li {
        font-size: 0.8rem;
    }

    .sub-risk-list li {
        font-size: 0.75rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .form-input {
        padding: 8px 10px;
    }

    .submit-btn {
        padding: 10px 25px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .container {
        padding: 8px;
    }

    .image-section {
        max-width: 120px;
        text-align: center;
    }
    
    .treatment-image {
        max-height: 100px;
        margin: 0 auto;
    }
    
    .form-header-section {
        text-align: center;
    }
    
    .main-title {
        font-size: clamp(0.8rem, 2vw + 0.1rem, 1.1rem);
    }

    .logo {
        max-width: 80px;
    }

    #signature {
        height: 120px !important;
    }
}

@media (max-width: 320px) {
    .container {
        padding: 5px;
    }

    .image-section {
        max-width: 100px;
        text-align: center;
    }
    
    .treatment-image {
        max-height: 80px;
        margin: 0 auto;
    }
    
    .form-header-section {
        text-align: center;
    }
    
    .main-title {
        font-size: clamp(0.7rem, 1.5vw + 0.1rem, 1rem);
    }

    .logo {
        max-width: 70px;
    }

    #signature {
        height: 100px !important;
    }
}

/* Desktop and Large Screens */
@media (min-width: 769px) {
    .treatment-image {
        max-height: none;
        object-fit: contain;
    }
    
    .main-title {
        font-size: clamp(1.5rem, 2vw + 0.8rem, 2.5rem);
    }
}

/* Extra Large Screens */
@media (min-width: 1200px) {
    .main-title {
        font-size: clamp(1.8rem, 1.5vw + 1rem, 3rem);
    }
}

/* Ultra Wide Screens */
@media (min-width: 1600px) {
    .main-title {
        font-size: clamp(2rem, 1vw + 1.5rem, 3.5rem);
    }
}

/* Checkbox and Radio Styles */
.checkbox-group, .radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.checkbox-label, .radio-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
    line-height: 1.5;
    padding: 8px;
    transition: background-color 0.2s ease;
    min-height: 44px; /* Minimum touch target size */
}

.checkbox-label:hover, .radio-label:hover {
    background-color: #f0f0f0;
}

.checkbox-label input[type="checkbox"], 
.radio-label input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: #333333;
    outline: none;
    border: 2px solid #ccc;
    background-color: white;
    box-shadow: none;
}

.checkbox-label input[type="checkbox"]:focus, 
.radio-label input[type="radio"]:focus {
    border-color: #333333;
    box-shadow: none;
}

.checkbox-label input[type="checkbox"]:checked, 
.radio-label input[type="radio"]:checked {
    background-color: #333333;
    border-color: #333333;
}

.checkbox-text, .radio-text {
    flex: 1;
    font-size: 0.95rem;
    color: #55636C;
}

/* Textarea Styles */
.form-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    font-size: 1rem;
    font-family: 'Arial MT', Arial, sans-serif;
    color: #55636C;
    background-color: #f8f9fa;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s ease;
}

.form-textarea:focus {
    outline: none;
    border-color: #333333;
    box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
    background-color: white;
}

.form-textarea:not(:placeholder-shown) {
    background-color: #f5f5f5;
    border-color: #333333;
    color: #333333;
}

.form-textarea:invalid {
    border-color: #ccc;
    background-color: #f5f5f5;
}

.form-textarea:valid:not(:placeholder-shown) {
    border-color: #333333;
    background-color: #f5f5f5;
}

/* Consent Section Styles */
.consent-text {
    background-color: #f8f9fa;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #333333;
}

.consent-text p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #55636C;
    text-align: justify;
}

.consent-text p:last-child {
    margin-bottom: 0;
}

.consent-text p strong {
    color: #333333;
    font-weight: 700;
    font-size: 0.95rem;
}

.consent-checkbox {
    background-color: #f8f9fa;
    padding: 15px;
    border: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.consent-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.consent-checkbox .checkbox-text {
    font-weight: 600;
    color: #333333;
}

/* Signature Section Styles */
.signature-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-left: 4px solid #333333;
}

.sig-wrap {
    margin-top: 15px;
    width: 100%;
    position: relative;
}

.sig-toolbar {
    margin: 10px 0;
    text-align: center;
}

#sig-clear {
    background-color: #333333;
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    outline: none;
}

#sig-clear:hover {
    background-color: #555555;
}

#signature {
    border: 2px solid #e0e0e0;
    background-color: white;
    cursor: crosshair;
    display: block;
    margin: 0 auto;
    width: 100% !important;
    height: 250px !important;
    max-width: 100%;
}

.signature-note {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* Additional Questions Styles */

.dotted-lines {
    background-image: repeating-linear-gradient(
        transparent,
        transparent 20px,
        #ddd 20px,
        #ddd 21px
    );
    line-height: 21px;
}

.allergy-warning {
    margin-top: 10px;
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

.allergy-warning p {
    margin: 0;
    font-size: 0.9rem;
    color: #856404;
}

.treatment-history {
    margin-top: 10px;
}

.treatment-history .form-group {
    margin-bottom: 15px;
}

.treatment-history .form-label {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.yes-no-questions {
    margin-top: 10px;
}

.yes-no-questions .form-group {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-left: 3px solid #333333;
}

.yes-no-questions .form-label {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333333;
}

.yes-no-questions .radio-group {
    display: flex;
    flex-direction: row;
    gap: 20px;
}

/* Contraindications Styles */
.contraindications-intro {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

.subsection-title {
    font-family: 'Cambria', serif;
    color: #333333;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 10px 0;
}

.contraindications-intro p {
    margin: 0;
    font-size: 0.95rem;
    color: #856404;
    line-height: 1.5;
}

.contraindications-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.contraindications-list .checkbox-label {
    padding: 10px;
    background-color: #f8f9fa;
    border-left: 3px solid #333333;
    transition: background-color 0.2s ease;
}

.contraindications-list .checkbox-label:hover {
    background-color: #f5f5f5;
}

.contraindications-list .checkbox-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.contraindications-warning {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.contraindications-warning p {
    margin: 0;
    font-size: 0.95rem;
    color: #721c24;
    font-weight: 600;
}

/* Risks and Aftercare Styles */
.risks-intro {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f5f5f5;
    border: 1px solid #333333;
}

.risks-intro p {
    margin: 0;
    font-size: 0.95rem;
    color: #333333;
    line-height: 1.6;
}

.risks-content {
    margin-top: 20px;
}

.risk-category {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f8f9fa;
    border-left: 4px solid #333333;
}

.risk-title {
    font-family: 'Cambria', serif;
    color: #333333;
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0 0 12px 0;
}

.risk-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.risk-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #55636C;
}

.risk-list li:before {
    content: "•";
    color: #333333;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.risk-list li strong {
    color: #333333;
    font-weight: 600;
}

.sub-risk-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.sub-risk-list li {
    position: relative;
    padding-left: 15px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #666;
}

.sub-risk-list li:before {
    content: "◦";
    color: #333333;
    position: absolute;
    left: 0;
}

/* Error States */
.form-input.error, .form-textarea.error {
    border-color: #ccc;
    background-color: #f5f5f5;
    box-shadow: 0 0 0 3px rgba(200, 200, 200, 0.1);
}

.checkbox-label input[type="checkbox"].error,
.radio-label input[type="radio"].error {
    outline: 2px solid #ccc;
    outline-offset: 2px;
}

.radio-group .radio-label input[type="radio"].error + .radio-text,
.checkbox-group .checkbox-label input[type="checkbox"].error + .checkbox-text {
    color: #666;
    font-weight: 600;
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
    .checkbox-group, .radio-group {
        gap: 10px;
    }

    .checkbox-label, .radio-label {
        gap: 8px;
    }

    .checkbox-text, .radio-text {
        font-size: 0.9rem;
    }

    .consent-text {
        padding: 15px;
    }

    .consent-text p {
        font-size: 0.85rem;
        text-align: left;
    }

    .consent-text p strong {
        font-size: 0.9rem;
    }

    .consent-checkbox {
        padding: 12px;
    }

    .signature-section {
        padding: 15px;
    }

    #signature {
        width: 100%;
        height: 120px;
    }

    #sig-clear {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .form-textarea {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .consent-text {
        padding: 12px;
    }

    .consent-text p {
        font-size: 0.8rem;
    }

    .consent-text p strong {
        font-size: 0.85rem;
    }

    .consent-checkbox {
        padding: 10px;
    }

    .signature-section {
        padding: 12px;
    }

    #signature {
        height: 100px;
    }

    #sig-clear {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .form-textarea {
        padding: 8px 10px;
    }
}

/* Print Styles */
@media print {
    .container {
        box-shadow: none;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .submit-container {
        display: none;
    }

    .message-container {
        display: none;
    }

    .form-input, .form-textarea {
        border: 1px solid #000;
        background-color: white;
    }

    .checkbox-group, .radio-group {
        break-inside: avoid;
    }

    .consent-text {
        background-color: white;
        border: 1px solid #000;
    }
}
