/**
 * Pre-Enrollment Modal Styles
 * Version: 3.0.0
 * 
 * PURPOSE:
 * - Style pre-enrollment button in search results
 * - Style modal popup form
 * - Responsive design for mobile/tablet/desktop
 * - Accessible focus states (WCAG 2.1 AA)
 * 
 * BROWSER SUPPORT:
 * - Chrome 90+
 * - Firefox 88+
 * - Safari 14+
 * - Edge 90+
 */

/* ============================================================================
   PRE-ENROLL BUTTON (In Search Results)
   ============================================================================ */

/**
 * Button container
 * Position at bottom of search result card
 */
.preenroll-button-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/**
 * Pre-enrollment button styling
 * Matches verification badge gradient
 * High contrast for accessibility
 */
.preenroll-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.preenroll-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.preenroll-btn:active {
    transform: translateY(0);
}

.preenroll-btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/**
 * Button icon and text
 */
.preenroll-btn .btn-icon {
    font-size: 18px;
}

.preenroll-btn .btn-text {
    font-weight: 600;
}

/* ============================================================================
   MODAL OVERLAY
   ============================================================================ */

/**
 * Full-screen modal overlay
 * Dark semi-transparent background
 * Centers modal content
 */
.preenroll-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

/**
 * Modal content container
 * Responsive width with max constraint
 */
.preenroll-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/**
 * Close button (X)
 * Top-right corner position
 */
.preenroll-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 20px;
}

.preenroll-close:hover,
.preenroll-close:focus {
    color: #000;
}

/**
 * Modal headings
 */
.preenroll-modal-content h2 {
    margin-bottom: 10px;
    color: #333;
    font-size: 24px;
}

.preenroll-modal-content h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 18px;
}

/* ============================================================================
   FORM STYLING
   ============================================================================ */

/**
 * Form group spacing
 * Standard vertical rhythm
 */
.preenroll-form-group {
    margin-bottom: 20px;
}

/**
 * Form labels
 * Bold with required field indicator
 */
.preenroll-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.preenroll-form-group label.required::after {
    content: ' *';
    color: #f44336;
}

/**
 * Helper text
 * Subtle color, smaller size
 */
.preenroll-form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/**
 * Text inputs, selects, textareas
 * Consistent styling across form elements
 */
.preenroll-form-group input[type="text"],
.preenroll-form-group input[type="email"],
.preenroll-form-group input[type="tel"],
.preenroll-form-group select,
.preenroll-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

/**
 * Focus states for accessibility
 * High contrast border and shadow
 */
.preenroll-form-group input:focus,
.preenroll-form-group select:focus,
.preenroll-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/**
 * Textarea specific styling
 */
.preenroll-form-group textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/**
 * Read-only inputs
 * Distinct background color
 */
.preenroll-form-group input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* ============================================================================
   RADIO AND CHECKBOX GROUPS
   ============================================================================ */

/**
 * Radio and checkbox group layout
 * Vertical stacking with spacing
 */
.preenroll-radio-group,
.preenroll-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/**
 * Radio and checkbox labels
 * Inline with input, clickable
 */
.preenroll-radio-group label,
.preenroll-checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.preenroll-radio-group label:hover,
.preenroll-checkbox-group label:hover {
    background-color: #f5f5f5;
}

/**
 * Radio and checkbox inputs
 * Spacing from label text
 */
.preenroll-radio-group input[type="radio"],
.preenroll-checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
    cursor: pointer;
}

/* ============================================================================
   SUBMIT BUTTON
   ============================================================================ */

/**
 * Form submit button
 * Full width, prominent gradient
 */
.preenroll-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 32px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.preenroll-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.preenroll-submit-btn:active {
    transform: translateY(0);
}

.preenroll-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.preenroll-submit-btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* ============================================================================
   ALERT NOTIFICATIONS
   ============================================================================ */

/**
 * Toast notification animations
 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/**
 * Base alert styling
 */
.preenroll-alert {
    font-size: 14px;
    font-weight: 500;
    min-width: min(300px, calc(100vw - 20px));
    max-width: min(500px, calc(100vw - 20px));
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/**
 * Tablet (iPad, small laptops)
 * Reduce modal padding slightly
 */
@media (max-width: 768px) {
    .preenroll-modal-content {
        width: 95%;
        padding: 20px;
        margin: 10% auto;
    }
    
    .preenroll-form-group input,
    .preenroll-form-group select,
    .preenroll-form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/**
 * Mobile phones
 * Full-width modal, larger touch targets
 */
@media (max-width: 480px) {
    .preenroll-modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        padding: 15px;
    }
    
    .preenroll-btn,
    .preenroll-submit-btn {
        padding: 15px 20px;
        font-size: 16px;
    }
    
    .preenroll-close {
        font-size: 32px;
    }
    
    .preenroll-alert {
        left: 10px;
        right: 10px;
        min-width: auto;
    }
}

/* ============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

/**
 * High contrast mode support
 */
@media (prefers-contrast: high) {
    .preenroll-btn,
    .preenroll-submit-btn {
        border: 2px solid white;
    }
    
    .preenroll-form-group input:focus,
    .preenroll-form-group select:focus,
    .preenroll-form-group textarea:focus {
        outline: 3px solid #000;
    }
}

/**
 * Reduced motion support
 * Disable animations for users with motion sensitivity
 */
@media (prefers-reduced-motion: reduce) {
    .preenroll-modal-content {
        animation: none;
    }
    
    .preenroll-btn,
    .preenroll-submit-btn {
        transition: none;
    }
    
    .preenroll-alert {
        animation: none;
    }
}

/**
 * Print styles
 * Hide modal and buttons when printing
 */
@media print {
    .preenroll-modal,
    .preenroll-button-container {
        display: none !important;
    }
}