/**
 * HMG Intake Form Styles
 * Houston Medical Group
 */

/* Variables */
:root {
    --hmg-primary: #8B0000;
    --hmg-primary-dark: #6B0000;
    --hmg-secondary: #333;
    --hmg-success: #28a745;
    --hmg-border: #ddd;
    --hmg-bg-light: #f9f9f9;
    --hmg-text: #333;
    --hmg-text-muted: #666;
    --hmg-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Wrapper */
.hmg-intake-form-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: var(--hmg-font-family);
    color: var(--hmg-text);
    line-height: 1.6;
}

/* Language Switcher */
.hmg-language-switcher {
    text-align: right;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid var(--hmg-border);
}

.hmg-language-switcher a {
    color: var(--hmg-text-muted);
    text-decoration: none;
    padding: 5px 10px;
    transition: color 0.2s;
}

.hmg-language-switcher a:hover,
.hmg-language-switcher a.active {
    color: var(--hmg-primary);
    font-weight: bold;
}

.hmg-language-switcher .separator {
    color: var(--hmg-border);
}

/* Header */
.hmg-form-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--hmg-primary);
}

.hmg-form-header .hmg-logo {
    max-width: 80px;
    height: auto;
    margin-bottom: 10px;
}

.hmg-form-header h1 {
    color: var(--hmg-primary);
    font-size: 28px;
    margin: 0 0 5px;
}

.hmg-form-header .tagline {
    font-size: 12px;
    color: var(--hmg-text-muted);
    letter-spacing: 1px;
    margin: 0 0 15px;
}

.hmg-form-header .locations {
    font-size: 11px;
    color: var(--hmg-text-muted);
}

.hmg-form-header .location {
    display: inline-block;
    margin: 3px 8px;
}

/* Progress Bar */
.hmg-progress {
    margin-bottom: 30px;
}

.hmg-progress-bar {
    height: 6px;
    background: var(--hmg-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.hmg-progress-fill {
    height: 100%;
    background: var(--hmg-primary);
    transition: width 0.3s ease;
}

.hmg-progress-steps {
    display: flex;
    justify-content: space-between;
    max-width: 400px;
    margin: 0 auto;
}

.hmg-progress-steps .step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--hmg-border);
    color: var(--hmg-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.hmg-progress-steps .step.active {
    background: var(--hmg-primary);
    color: white;
}

.hmg-progress-steps .step.completed {
    background: var(--hmg-success);
    color: white;
}

/* Form Sections */
.hmg-form-section {
    background: white;
    border: 1px solid var(--hmg-border);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
}

.section-title {
    color: var(--hmg-primary);
    font-size: 20px;
    margin: 0 0 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--hmg-primary);
}

.subsection-title {
    color: var(--hmg-secondary);
    font-size: 16px;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--hmg-border);
}

/* Form Rows and Groups */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group.full-width {
    flex: 100%;
    min-width: 100%;
}

.form-group.small {
    flex: 0 0 80px;
    min-width: 80px;
}

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

.form-group .required {
    color: var(--hmg-primary);
}

/* Form Inputs */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--hmg-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--hmg-primary);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Radio and Checkbox Groups */
.radio-group,
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.radio-group.inline {
    gap: 20px;
}

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

.radio-label input,
.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--hmg-primary);
}

.checkbox-group.medical-conditions,
.checkbox-group.pain-areas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

/* Conditional Sections */
.conditional-section {
    display: none;
    padding: 20px;
    background: var(--hmg-bg-light);
    border-radius: 6px;
    margin-top: 15px;
}

.conditional-section.visible {
    display: block;
}

/* Consent Sections */
.consent-section {
    background: var(--hmg-bg-light);
    border: 1px solid var(--hmg-border);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
}

.consent-text {
    background: white;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.7;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--hmg-border);
}

.consent-text p {
    margin: 0;
}

/* Signature Pad */
.signature-group {
    margin-top: 15px;
}

.signature-pad-container {
    border: 2px solid var(--hmg-border);
    border-radius: 4px;
    background: white;
    margin-bottom: 10px;
}

.signature-pad {
    width: 100%;
    height: 150px;
    display: block;
    cursor: crosshair;
}

.btn-clear-signature {
    font-size: 12px;
    padding: 5px 15px;
}

/* Buttons */
.hmg-intake-form-wrapper .btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600 !important;
    text-align: center;
    text-decoration: none !important;
    border: none !important;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1.4;
}

.hmg-intake-form-wrapper .btn-primary {
    background: var(--hmg-primary) !important;
    color: #ffffff !important;
}

.hmg-intake-form-wrapper .btn-primary:hover {
    background: var(--hmg-primary-dark) !important;
    color: #ffffff !important;
}

.hmg-intake-form-wrapper .btn-secondary {
    background: var(--hmg-secondary) !important;
    color: #ffffff !important;
}

.hmg-intake-form-wrapper .btn-secondary:hover {
    background: #444444 !important;
    color: #ffffff !important;
}

.hmg-intake-form-wrapper .btn-success {
    background: var(--hmg-success) !important;
    color: #ffffff !important;
}

.hmg-intake-form-wrapper .btn-success:hover {
    background: #218838 !important;
    color: #ffffff !important;
}

.hmg-intake-form-wrapper .btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.hmg-intake-form-wrapper .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form Navigation */
.form-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--hmg-border);
}

.form-navigation .btn-next,
.form-navigation .btn-submit {
    margin-left: auto;
}

/* Success Message */
.hmg-success-message {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border: 1px solid var(--hmg-border);
    border-radius: 8px;
}

.hmg-success-message .success-icon {
    width: 80px;
    height: 80px;
    background: var(--hmg-success);
    color: white;
    font-size: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.hmg-success-message h2 {
    color: var(--hmg-success);
    margin: 0 0 10px;
}

.hmg-success-message p {
    color: var(--hmg-text-muted);
    margin: 0 0 30px;
}

.success-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Loading Spinner */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error States */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: #dc3545;
}

.form-group.has-error .radio-group,
.form-group.has-error .checkbox-group {
    border: 2px solid #dc3545;
    border-radius: 4px;
    padding: 6px 10px;
    background-color: #fff5f5;
}

.signature-group.has-error .signature-pad-container {
    border: 2px solid #dc3545 !important;
    border-radius: 4px;
    background-color: #fff5f5;
}

.form-group .error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .hmg-intake-form-wrapper {
        padding: 15px;
    }

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

    .form-row {
        gap: 15px;
    }

    .form-group {
        min-width: 100%;
    }

    .form-group.small {
        min-width: 100%;
        flex: 100%;
    }

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

    .checkbox-group.medical-conditions,
    .checkbox-group.pain-areas {
        grid-template-columns: 1fr;
    }

    .form-navigation {
        flex-direction: column;
        gap: 10px;
    }

    .form-navigation .btn {
        width: 100%;
    }

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

    .hmg-progress-steps {
        max-width: 100%;
    }

    .hmg-progress-steps .step {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* Print Styles */
@media print {
    .hmg-language-switcher,
    .hmg-progress,
    .form-navigation,
    .btn-clear-signature,
    .success-actions {
        display: none !important;
    }

    .hmg-form-section {
        border: none;
        padding: 0;
        page-break-inside: avoid;
    }

    .consent-text {
        max-height: none;
        overflow: visible;
    }

    .signature-pad-container {
        border: 1px solid #000;
    }
}
