/**
 * 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;
    margin: 40px auto;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

/* ============ 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;
}

/* ============ FORM SECTIONS ============ */
.dif-form-section {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.dif-form-section.active {
    display: block;
}

@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 */
}

/* ============ 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, 1fr);
    gap: 24px;
}

.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;
}

.dif-form-group input,
.dif-form-group select,
.dif-form-group textarea {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: #fff;
    font-family: inherit;
}

.dif-form-group input:focus,
.dif-form-group select:focus,
.dif-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    background: #fafbff;
}

.dif-form-group input::placeholder,
.dif-form-group textarea::placeholder {
    color: var(--text-light);
}

.dif-form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* 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;
}

.dif-allergies-grid .dif-checkbox-item,
.dif-checkbox-list .dif-checkbox-item {
    margin: 0;
}

/* ============ MEDICAL CONDITIONS ============ */
.dif-medical-conditions,
.dif-medical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-height: 500px;
    overflow-y: auto;
    padding: 25px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    margin-top: 20px;
}

.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);
}

/* ============ 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;
    }
    
    .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;
    }
    
    .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 15px;
    }
    
    .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;
    }
}