/* HIPAA Authorization Form - Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

/* Container */
.form-container {
    max-width: 850px;
    margin: 20px auto;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Header */
.form-header {
    text-align: center;
    padding: 30px 40px 20px;
    border-bottom: 2px solid #2c5282;
}

.form-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: #2c5282;
    margin-bottom: 5px;
}

.form-header .subtitle {
    font-size: 14px;
    color: #666;
}

/* Form Sections */
.form-section {
    padding: 25px 40px;
    border-bottom: 1px solid #e2e8f0;
}

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

.form-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #2c5282;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.form-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin: 15px 0 10px;
}

.section-note {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

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

.form-group {
    margin-bottom: 15px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.inline-group {
    display: inline-block;
    margin-left: 10px;
    margin-bottom: 0;
}

/* Labels */
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 5px;
}

.required {
    color: #e53e3e;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: #a0aec0;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

/* Checkboxes and Radio Buttons */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input,
.radio-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.radio-group {
    margin-bottom: 10px;
}

.radio-group .radio-label {
    margin-bottom: 8px;
}

/* Sensitive Information Section */
.sensitive-section {
    margin-top: 20px;
    padding: 15px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 4px;
}

.sensitive-section h3 {
    color: #c53030;
    margin-top: 0;
}

.warning-note {
    font-size: 12px;
    color: #c53030;
    margin-bottom: 10px;
}

.checkbox-grid.sensitive {
    grid-template-columns: 1fr;
}

/* Rights Section */
.rights-section {
    background: #f7fafc;
}

.rights-box {
    padding: 15px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.6;
}

.rights-box p {
    margin-bottom: 12px;
}

.rights-box p:last-child {
    margin-bottom: 0;
}

/* Signature Section */
.signature-container {
    margin-bottom: 20px;
}

.signature-wrapper {
    border: 2px solid #2c5282;
    border-radius: 4px;
    background: white;
    margin: 10px 0;
    position: relative;
}

#signatureCanvas {
    display: block;
    width: 100%;
    height: 150px;
    cursor: crosshair;
}

.signature-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
}

.signature-details {
    margin-top: 15px;
}

/* Buttons */
.form-actions {
    padding: 25px 40px;
    background: #f7fafc;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-primary,
.btn-secondary {
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #2c5282;
    color: white;
}

.btn-primary:hover {
    background: #2b6cb0;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

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

#clearSignature {
    padding: 8px 16px;
    font-size: 12px;
}

/* Footer */
.form-footer {
    text-align: center;
    padding: 15px 40px;
    font-size: 11px;
    color: #718096;
    border-top: 1px solid #e2e8f0;
}

/* Validation States */
input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
    border-color: #e53e3e;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    /* Reset for print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: white;
        font-size: 11pt;
    }

    .form-container {
        max-width: 100%;
        margin: 0;
        box-shadow: none;
    }

    /* Hide non-print elements */
    .no-print,
    .form-actions,
    #clearSignature {
        display: none !important;
    }

    /* Header adjustments */
    .form-header {
        padding: 20px 30px 15px;
    }

    .form-header h1 {
        font-size: 18pt;
    }

    /* Section adjustments */
    .form-section {
        padding: 15px 30px;
        page-break-inside: avoid;
    }

    .form-section h2 {
        font-size: 12pt;
    }

    /* Input styling for print */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    textarea,
    select {
        border: none;
        border-bottom: 1px solid #333;
        border-radius: 0;
        padding: 5px 2px;
        background: transparent;
    }

    /* Checkbox/Radio for print */
    .checkbox-label,
    .radio-label {
        font-size: 10pt;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 12px;
        height: 12px;
    }

    /* Signature for print */
    .signature-wrapper {
        border: 1px solid #333;
        min-height: 100px;
    }

    #signatureCanvas {
        display: none !important;
    }

    .signature-image {
        display: block !important;
        height: 100px;
    }

    /* Rights box */
    .rights-box {
        font-size: 9pt;
        padding: 10px;
    }

    .sensitive-section {
        background: #fff !important;
        border: 1px solid #666;
    }

    /* Footer */
    .form-footer {
        font-size: 9pt;
        padding: 10px 30px;
    }

    /* Page breaks */
    .form-section.signature-section {
        page-break-before: auto;
    }

    /* Ensure sections don't break awkwardly */
    .form-section {
        break-inside: avoid;
    }
}

/* ========================================
   RESPONSIVE (Nice to have)
   ======================================== */

@media screen and (max-width: 600px) {
    .form-container {
        margin: 0;
    }

    .form-section,
    .form-header,
    .form-actions {
        padding-left: 20px;
        padding-right: 20px;
    }

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

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .flex-1, .flex-2 {
        flex: none;
        width: 100%;
    }
}
