/* Student Enrollment Widget Styles */
.sew-enrollment-widget {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 400px; /* Prevent layout jump */
    position: relative;
}

/* Smooth transitions for steps */
.sew-selection-step,
.sew-forms-step {
    transition: opacity 0.2s ease-in-out;
}

.sew-selection-step h3,
.sew-forms-step h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.sew-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.sew-option-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sew-option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.sew-option-card.selected {
    border-color: #0073aa;
    background: #f0f8ff;
    transform: scale(1.05);
}

.sew-option-number {
    font-size: 36px;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 5px;
}

.sew-option-label {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
}

.sew-option-price {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.sew-option-price small {
    font-size: 12px;
    font-weight: normal;
    color: #666;
    display: block;
}

.sew-option-total {
    font-size: 14px;
    color: #0073aa;
    font-weight: 600;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.sew-option-price .woocommerce-Price-amount {
    color: #333;
}

.sew-student-forms {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.sew-student-form {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sew-student-form h4 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.sew-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.sew-form-group {
    display: flex;
    flex-direction: column;
}

/* Full width for medical info field */
.sew-form-group-full {
    grid-column: 1 / -1;
}

.sew-form-group label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.sew-form-group input,
.sew-form-group select,
.sew-form-group textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    width: 100%;
}

.sew-form-group textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.sew-form-group input:focus,
.sew-form-group select:focus,
.sew-form-group textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.sew-total-price {
    font-size: 20px;
    font-weight: bold;
    text-align: right;
    margin-bottom: 20px;
    color: #333;
}

.sew-price-breakdown {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.sew-price-line {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
}

.sew-price-total {
    font-size: 20px;
    color: #333;
    font-weight: bold;
    padding-top: 10px;
    border-top: 2px solid #0073aa;
}

.sew-form-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.sew-back-btn,
.sew-submit-btn {
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.sew-back-btn {
    background: #6c757d;
    color: white;
}

.sew-back-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.sew-submit-btn {
    background: #0073aa;
    color: white;
    flex: 1;
}

.sew-submit-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.sew-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.sew-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.sew-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Styles */
.sew-error {
    border-color: #dc3545 !important;
}

.sew-error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Success Message */
.sew-success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sew-enrollment-widget {
        padding: 10px;
        min-height: 300px;
    }
    
    .sew-options-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .sew-option-card {
        padding: 15px;
    }
    
    .sew-option-number {
        font-size: 28px;
    }
    
    .sew-option-label {
        font-size: 14px;
    }
    
    .sew-option-price {
        font-size: 16px;
    }
    
    .sew-form-grid {
        grid-template-columns: 1fr;
    }
    
    .sew-student-form {
        padding: 15px;
    }
    
    .sew-form-actions {
        flex-direction: column;
    }
    
    .sew-back-btn,
    .sew-submit-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sew-selection-step h3,
    .sew-forms-step h3 {
        font-size: 20px;
    }
    
    .sew-options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Elementor Editor Compatibility */
.elementor-editor-active .sew-enrollment-widget {
    min-height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.elementor-editor-active .sew-enrollment-widget:empty::before {
    content: 'Student Enrollment Widget - Select a product in the widget settings';
    color: #666;
    font-style: italic;
}

.sew-editor-notice {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    padding: 40px 20px;
    text-align: center;
    border-radius: 8px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sew-editor-notice p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Gender and Medical Info Styling */
.sew-form-group select[name*="gender"] {
    min-width: 150px;
}

.sew-form-group textarea[name*="medical"] {
    background-color: #fffbf0;
    border-color: #f0ad4e;
}

.sew-form-group textarea[name*="medical"]:focus {
    border-color: #ec971f;
    box-shadow: 0 0 0 2px rgba(240, 173, 78, 0.2);
}

/* Medical info icon */
.sew-form-group label:has(+ textarea[name*="medical"])::before {
    content: "⚕️ ";
    font-size: 16px;
}

/* Medical info callout on the student profile listing */
.sew-student-medical {
    background: #fcf8e3;
    border: 1px solid #faebcc;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.sew-student-medical .dashicons {
    flex-shrink: 0;
    margin-top: 2px;
}