/**
 * Dental Forms Pro - Complete Form Styles
 * Version: 6.0.0 - Enhanced and Optimized
 */

/* ============ RESET & BASE ============ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============ ROOT VARIABLES ============ */
:root {
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --success-color: #11998e;
    --success-light: #38ef7d;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --text-dark: #333;
    --text-medium: #666;
    --text-light: #999;
    --border-color: #e0e6ed;
    --bg-light: #f9f9f9;
    --bg-hover: #f0f5ff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 5px 15px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* ============ MAIN CONTAINER ============ */
.dif-form-container {
    max-width: 900px !important;
    margin: 40px auto !important;
    background: white !important;
    border-radius: 15px !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif !important;
    position: relative !important;
    z-index: 100 !important; /* Above theme modals */
    overflow: visible !important; /* Force visibility */
}
/* Keep form aligned to content column */
.entry-content .dif-form-container,
.x-main .dif-form-container {
    width: 100% !important;
    max-width: min(900px, 100%) !important;  /* or clamp(680px, 92vw, 900px) */
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Optional: slightly reduce overall z-index now that clipping is fixed */
.dif-form-container { z-index: 200 !important; }


/* ============ HEADER ============ */
.dif-form-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 50px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.dif-form-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 8s ease-in-out infinite;
}

.dif-form-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, rgba(0,0,0,0.1), transparent);
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(3deg); }
}

.practice-logo {
    max-height: 180px !important;  /* Increased from 120px */
    max-width: 400px !important;   /* Increased from 280px */
    margin: 0 auto 25px;
    display: block;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
    position: relative;
    z-index: 2;
    width: auto;
    height: auto;
}

.dif-form-header {
    text-align: center;
    padding: 30px 20px;
    margin-bottom: 30px;
}

.dif-form-header img {
    max-height: 180px !important;
    max-width: 400px !important;
    width: auto;
    height: auto;
}

.dif-form-header h2 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 12px;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    letter-spacing: 1px;
    position: relative;
    z-index: 2;
}

.form-subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin: 10px 0 35px;
    position: relative;
    z-index: 2;
}

/* ============ PROGRESS BAR ============ */
.dif-progress-container {
    margin-top: 35px;
    position: relative;
    z-index: 2;
}

.dif-progress-bar {
    background: rgba(255,255,255,0.25);
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.dif-progress-fill {
    background: linear-gradient(90deg, white, rgba(255,255,255,0.9));
    height: 100%;
    width: 25%;
    border-radius: 5px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(255,255,255,0.3);
}

.dif-progress-text {
    font-size: 0.95rem;
    opacity: 0.95;
    color: white;
    font-weight: 500;
}

.current-section, .total-sections {
    font-weight: 700;
    font-size: 1.05rem;
}

/* ============ FORM BODY ============ */
.dif-form-body {
    padding: 45px;
    background: #ffffff;
}

/* Single, clear select styling */
.dif-form-group select,
.dif-form-section select {
    color: #333333 !important;
    background-color: #ffffff !important;
}

.dif-form-group select:focus,
.dif-form-section select:focus {
    color: #333333 !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}


.dif-form-group.disabled-field {
    opacity: 0.5;
}

.dif-form-group.disabled-field select {
    color: #666666 !important; /* Still visible when disabled */
}

/* Ensure options are visible */
.dif-form-section select option,
.dif-form-group select option,
select option {
    padding: 8px 12px !important;
    color: #333333 !important;
    background-color: #ffffff !important;
    font-size: 16px !important;
}

/* Focus state */
.dif-form-section select:focus,
.dif-form-group select:focus,
select:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    outline: none !important;
}

/* Hover state */
.dif-form-section select:hover:not(:disabled),
.dif-form-group select:hover:not(:disabled),
select:hover:not(:disabled) {
    border-color: #667eea !important;
}

/* Disabled state */
.dif-form-section select:disabled,
.dif-form-group select:disabled,
select:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    background-color: #f5f5f5 !important;
}

/* Error state */
.dif-form-section select.error,
.dif-form-group select.error,
select.error {
    border-color: #e74c3c !important;
    background-color: #fff5f5 !important;
}

/* Remove any conflicting styles from parent containers */
.dif-form-group.disabled-field {
    opacity: 1 !important; /* Don't reduce opacity on parent */
}

.dif-form-group.disabled-field select {
    opacity: 0.6 !important; /* Only reduce opacity on select itself */
}

/* ============ FORM SECTIONS ============ */
.dif-form-section {
    display: none !important;
    animation: fadeInUp 0.4s ease !important;
    position: relative !important;
    z-index: 101 !important; /* Above container */
    overflow: visible !important; /* Prevent clipping */
}
.dif-form-section.active {
    display: block !important;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Fix checkbox alignment in allergy section */
.dif-checkbox-group,
.dif-checkbox-item {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Left align */
    width: 100%;
}

.dif-checkbox-group input[type="checkbox"],
.dif-checkbox-item input[type="checkbox"] {
    margin: 0 8px 0 0; /* Remove any left margin, keep right margin for spacing */
    width: auto;
    flex-shrink: 0; /* Prevent checkbox from shrinking */
}

.dif-checkbox-label {
    text-align: left;
    margin: 0;
    flex: 1; /* Allow label to take remaining space */
}

/* For the grid layout of allergies */
.dif-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    align-items: start;
}

.dif-checkbox-grid .dif-checkbox-item {
    justify-content: flex-start;
    padding-left: 0; /* Remove any left padding */
}

/* Additional styling for the date fields */
.dob-fields-container {
    margin-bottom: 20px;
}

.dob-field {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
}

.dob-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dob-field::placeholder {
    color: #999;
}

/* ============ SECTION HEADERS ============ */
.dif-section-header {
    text-align: center;
    margin-bottom: 45px;
    padding-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    position: relative;
}

.dif-section-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
}

.dif-section-title {
    font-size: 1.9rem;
    color: var(--text-dark);
    margin-bottom: 12px;
    font-weight: 600;
}

.dif-section-subtitle {
    color: var(--text-medium);
    font-size: 1.05rem;
    line-height: 1.6;
}

.dif-subsection-title {
    font-size: 1.3rem;
    color: #444;
    margin: 35px 0 20px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

/* Make logo larger and remove URL text */
.dif-form-header .practice-logo {
    max-height: 100px; 
    margin-bottom: 15px;
}

/* Hide any URL text that might be showing */
.dif-form-header img + p,
.dif-form-header img + span {
    display: none;
}

/* ============ FORM GRID ============ */
.dif-form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr)); /* Added minmax(0, 1fr) to prevent squeeze */
    gap: 24px;
    overflow: visible; /* Allow overflow for dropdowns */
}

.dif-col-3 { grid-column: span 3; }
.dif-col-4 { grid-column: span 4; }
.dif-col-6 { grid-column: span 6; }
.dif-col-8 { grid-column: span 8; }
.dif-col-12 { grid-column: span 12; }

/* ============ FORM GROUPS ============ */
.dif-form-group {
    margin-bottom: 28px;
}

.dif-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

/* Fix for dropdown selected text visibility and cutoff */
.dif-form-group select,
.dif-select,
select {
    color: #333 !important;
    background-color: #fff !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    padding: 13px 40px 13px 16px !important;
    position: static !important;   /* ⬅︎ back to normal flow */
    z-index: auto !important;      /* ⬅︎ let stacking be natural */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a 1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    transition: var(--transition) !important;
    width: 100% !important;
}

.dif-form-group select:focus,
.dif-select:focus,
select:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15) !important;
    background-color: #fafbff !important;
}
.dif-form-group select option:checked,
select option:checked {
    color: #333 !important;
    background-color: #f0f5ff !important;
}
.dif-form-group select:not(:placeholder-shown),
.dif-form-group select:valid,
select:not([value=""]):not([value="- Select -"]) {
    color: #333 !important;
}
.dif-form-group select::-ms-expand {
    display: none !important;
}
/* Neutralize theme interference */
.entry-content .dif-form-group select,
.x-main .dif-form-group select {
  position: absolute !important;
  z-index: 10003 !important;
}
.dif-form-group {
    position: relative; /* Contain absolute positioning */
}

/* Required fields */
.dif-required {
    color: var(--error-color);
    font-weight: 700;
    margin-left: 2px;
}

/* ============ ENHANCED CHECKBOXES ============ */
.dif-checkbox-group,
.dif-radio-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.dif-checkbox-group input[type="checkbox"],
.dif-radio-group input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0 10px 0 0;
    cursor: pointer;
    flex-shrink: 0;
}

.dif-checkbox-label,
.dif-radio-label {
    flex: 1;
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
}

/* Checkbox items with better styling */
.dif-checkbox-item,
.dif-radio-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    background: white;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    min-height: 50px;
    text-align: center;
}

.dif-checkbox-item input[type="checkbox"],
.dif-radio-item input[type="radio"] {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}

.dif-checkbox-item label,
.dif-radio-item label {
    flex: 1;
    text-align: center;
    padding: 0 40px;
    cursor: pointer;
}

.dif-checkbox-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.dif-checkbox-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.dif-checkbox-item:hover::before {
    transform: scaleY(1);
}

.dif-checkbox-item.checked {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    font-weight: 500;
}

.dif-checkbox-item.checked::before {
    transform: scaleY(1);
}

/* Allergies grid layout */
.dif-allergies-section {
    margin: 30px 0;
}

.dif-allergies-grid,
.dif-checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin: 20px 0;
    overflow: visible; /* Allow overflow for dropdowns in lists */
}

.dif-allergies-grid .dif-checkbox-item,
.dif-checkbox-list .dif-checkbox-item {
    margin: 0;
}

/* ============ MEDICAL CONDITIONS ============ */
.dif-medical-conditions,
.dif-medical-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 24px !important;
    padding: 25px !important;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%) !important;
    border-radius: 12px !important;
    margin-top: 20px !important;
    position: relative !important;
    z-index: 102 !important; /* Above sections */
    overflow-x: visible !important;
    -webkit-overflow-scrolling: touch !important; /* Mobile fix */
}
.dif-medical-grid {
    max-height: 500px !important;
    overflow-y: auto !important;
}

.dif-medical-category {
    background: white;
    padding: 18px;
    border-radius: 10px;
    border: 1px solid #e0e6ed;
    box-shadow: var(--shadow-sm);
    height: fit-content;
    transition: var(--transition);
}

.dif-medical-category:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.dif-category-title {
    color: var(--primary-color);
    margin-bottom: 18px;
    font-size: 1.05rem;
    font-weight: 600;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.dif-condition-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dif-condition-list .dif-checkbox-item {
    padding: 11px 14px;
    background: #fafbfc;
    margin: 0;
    border: 1px solid #e8eaed;
    font-size: 0.92rem;
}

.dif-condition-list .dif-checkbox-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.disabled-field {
    opacity: 0.5;
    pointer-events: none;
}

.dif-input.disabled,
.dif-select.disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* ============ CONSENT BLOCKS ============ */
.dif-consent-blocks {
    margin: 25px 0;
}

.dif-consent-block {
    background: linear-gradient(135deg, #f9f9f9 0%, #f5f5f5 100%);
    padding: 24px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #e8eaed;
    transition: var(--transition);
    position: relative;
}

.dif-consent-block:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--bg-hover) 0%, #f5f8ff 100%);
    box-shadow: var(--shadow-sm);
}

.dif-consent-label {
    display: block;
    cursor: pointer;
}

.dif-consent-label strong {
    color: var(--text-dark);
    font-size: 1.08rem;
}

.dif-consent-text {
    margin-top: 12px;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-medium);
}

/* ============ SIGNATURE SECTION ============ */
.dif-signature-section {
    background: linear-gradient(135deg, #e8f4fd 0%, #f0f5ff 100%);
    padding: 35px;
    border-radius: 10px;
    margin-top: 35px;
    border: 2px solid #d0e0ff;
}

.dif-signature-section h4 {
    color: var(--text-dark);
    margin-bottom: 22px;
    font-size: 1.25rem;
}

/* ============ NAVIGATION BUTTONS ============ */
.dif-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 45px;
    padding-top: 35px;
    border-top: 2px solid #f0f0f0;
}

.dif-btn {
    padding: 15px 35px;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dif-btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.dif-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.dif-btn-secondary {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    color: var(--text-dark);
}

.dif-btn-secondary:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    transform: translateY(-2px);
}

.dif-btn-submit {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-light) 100%);
    color: white;
    font-size: 1.15rem;
    padding: 18px 45px;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.dif-btn-submit:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(17, 153, 142, 0.4);
}

.dif-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============ ERROR STATES ============ */
.error {
    border-color: var(--error-color) !important;
    background-color: #fff5f5 !important;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.dif-field-error {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

.dif-field-error:not(:empty) {
    display: block;
    animation: fadeInUp 0.3s ease;
}

/* ============ LOADING & SUCCESS ============ */
.dif-loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.97);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.dif-loading-overlay:not([style*="display: none"]) {
    display: flex;
}

.dif-loading-content {
    text-align: center;
    padding: 50px;
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
}

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

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

.dif-success-message,
.dif-error-message {
    display: none;
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 15px;
    margin: 40px auto;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
}

.dif-success-message.active,
.dif-error-message.active {
    display: block;
}

.dif-success-icon {
    font-size: 80px;
    color: var(--success-color);
    margin-bottom: 25px;
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.dif-error-icon {
    font-size: 80px;
    color: var(--error-color);
    margin-bottom: 25px;
    animation: scaleIn 0.5s ease;
}

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

/* ============ INSURANCE SPECIFICS ============ */
.dif-insurance-fields {
    transition: var(--transition);
}

.dif-policyholder-section,
#dif_policyholder_fields {
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f3f8 100%);
    padding: 25px;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    margin-top: 20px;
}

/* ============ RESPONSIVE DESIGN ============ */
@media (max-width: 768px) {
    .dif-form-container {
        margin: 20px 10px;
        border-radius: 10px;
        padding: 15px; /* Reduced padding */
    }
    .dif-form-header {
        padding: 35px 25px;
    }
    .dif-form-header h2 {
        font-size: 2rem;
    }
    .dif-form-body {
        padding: 30px 20px;
    }
    .dif-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        overflow: visible; /* Allow overflow for dropdowns */
    }
    .dif-col-3, .dif-col-4, .dif-col-6, .dif-col-8, .dif-col-12 {
        grid-column: span 1;
    }
    .dif-medical-grid {
        grid-template-columns: 1fr;
        max-height: none;
    }
    .dif-allergies-grid,
    .dif-checkbox-list {
        grid-template-columns: 1fr;
    }
    .dif-form-navigation {
        flex-direction: column-reverse;
        gap: 15px;
    }
    .dif-btn {
        width: 100%;
        justify-content: center;
    }
}
@media (max-width: 480px) {
    .dif-form-header {
        padding: 25px 15px;
    }
    .dif-form-header h2 {
        font-size: 1.6rem;
    }
    .dif-form-body {
        padding: 20px 10px;
    }
    .dif-section-title {
        font-size: 1.5rem;
    }
    .dif-btn {
        padding: 14px 25px;
        font-size: 0.95rem;
    }
}

/* ============ PRINT STYLES ============ */
@media print {
    .dif-form-navigation,
    .dif-progress-container,
    .dif-btn,
    .dif-loading-overlay {
        display: none !important;
    }
    .dif-form-section {
        display: block !important;
        page-break-inside: avoid;
    }
    .dif-form-container {
        box-shadow: none;
        max-width: 100%;
    }
    .dif-form-header {
        background: none !important;
        color: black !important;
        border-bottom: 2px solid #333;
    }
    .dif-form-header h2 {
        color: black !important;
    }
}

/* ============ FINAL SELECT DROPDOWN FIX - MUST BE LAST ============ */
/* This overrides ALL other select styles to fix text cutoff */

.dif-form-group select,
.dif-form-section select,
select[name*="dif_"],
#dif-intake-form select {
    /* Box model - don't use all: initial */
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    
    /* Height and padding that prevents cutoff */
    min-height: 44px !important;
    height: auto !important;
    padding: 10px 35px 10px 12px !important;
    margin: 0 !important;
    position: static !important;   /* ensure we override earlier absolute rules */
    
    /* Typography - FORCE BLACK TEXT */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 16px !important;
    line-height: 24px !important;
    color: #000000 !important; /* Pure black */
    -webkit-text-fill-color: #000000 !important; /* For Safari */
    
    /* Background - white with custom arrow */
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M2 0l4 4 4-4 2 0-6 6-6-6z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px 8px !important;
    background-origin: content-box !important;
    
    /* Border */
    border: 2px solid #e0e6ed !important;
    border-radius: 8px !important;
    
    /* Remove browser defaults */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    
    /* Text handling */
    text-align: left !important;
    text-indent: 0 !important;
    text-transform: none !important;
    
    /* Cursor */
    cursor: pointer !important;
}

/* Force option text to be black */
.dif-form-group select option,
.dif-form-section select option,
select[name*="dif_"] option,
#dif-intake-form select option {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    background-color: #ffffff !important;
    padding: 8px !important;
}

/* Placeholder option styling */
.dif-form-group select option[value=""],
.dif-form-group select option:first-child {
    color: #666666 !important;
    -webkit-text-fill-color: #666666 !important;
}

/* Focus state */
.dif-form-group select:focus,
.dif-form-section select:focus,
select[name*="dif_"]:focus,
#dif-intake-form select:focus {
    padding: 10px 35px 10px 12px !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    outline: none !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}

/* Disabled field handling */
.dif-form-group.disabled-field {
    opacity: 1 !important;
}

.dif-form-group.disabled-field select {
    opacity: 0.6 !important;
    background-color: #f5f5f5 !important;
    color: #666666 !important;
    -webkit-text-fill-color: #666666 !important;
}

/* Keep selects in normal flow; just ensure ancestor doesn't clip */
.dif-unclip { overflow: visible !important; position: relative !important; }

/* Responsive caret spacing so text never collides with the arrow */
.dif-form-container select {
  /* room for the caret */
  padding-right: 2.75rem !important;
  /* put caret inside the padding box */
  background-origin: content-box !important;
  /* caret position & size */
  background-position: right 0.875rem center !important;
  background-size: 0.75rem auto !important;
  white-space: nowrap;         /* keep single line */
}

/* tablet */
@media (max-width: 768px) {
  .dif-form-container select {
    padding-right: 2.5rem !important;
    background-position: right 0.75rem center !important;
    background-size: 0.7rem auto !important;
  }
}

/* phone */
@media (max-width: 480px) {
  .dif-form-container select {
    padding-right: 2.25rem !important;
    background-position: right 0.5rem center !important;
    background-size: 0.65rem auto !important;
  }
}

/* Prevent logo clipping on mobile */
@media (max-width: 640px) {
  .dif-form-header {
    overflow: visible !important;        /* let logo/drop-shadow show */
    padding: 24px 16px !important;
  }
  /* optionally hide big decorative effects on small screens */
  .dif-form-header::before,
  .dif-form-header::after {
    display: none !important;
  }
  .dif-form-header .practice-logo,
  .dif-form-header img {
    display: block;
    max-width: min(80vw, 320px) !important;
    max-height: 110px !important;
    width: auto !important;
    height: auto !important;
    margin: 0 auto 10px !important;
  }
}
