/**
 * BULLETPROOF SERVICE FORM STYLES - CORRECTED FOR ACTUAL HTML STRUCTURE
 * OnDemandTechHelp.com - Matches exact class names from HTML block
 * Website Architect v5.0 - Production Ready CSS
 */

/* ========================================
   SERVICE FORM CONTAINER STYLING
   ======================================== */

.odth-service-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* WordPress Custom HTML block compatibility */
.wp-block-html .odth-service-form-container {
    margin: 24px auto !important;
}

/* GeneratePress theme integration */
.entry-content .odth-service-form-container {
    margin: 1.5em auto;
}

/* Form wrapper */
.odth-form-wrapper {
    width: 100%;
}

/* ========================================
   FORM HEADER STYLING
   ======================================== */

.odth-form-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
}

.odth-form-title {
    font-size: 28px;
    font-weight: 700;
    color: #059669;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.odth-form-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* ========================================
   FORM SECTIONS
   ======================================== */

.odth-form-section {
    margin-bottom: 32px;
}

.odth-section-title {
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

/* ========================================
   SERVICE SELECTION GRID
   ======================================== */

.odth-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.odth-service-option {
    cursor: pointer;
    display: block;
    position: relative;
}

.odth-service-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.odth-service-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.odth-service-card:hover {
    border-color: #6b7280;
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.odth-service-option input[type="radio"]:checked + .odth-service-card {
    border-color: #059669;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.15);
}

.odth-service-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.odth-service-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.odth-service-option input[type="radio"]:checked + .odth-service-card h4 {
    color: #059669;
}

.odth-service-card p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* ========================================
   FORM LAYOUT AND INPUT STYLING
   ======================================== */

.odth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.odth-form-group {
    margin-bottom: 24px;
}

/* ✅ CORRECTED: Target actual class names from your HTML */
.odth-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
    font-size: 14px;
}

.odth-input,
.odth-select,
.odth-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    background: #ffffff;
}

.odth-input:focus,
.odth-select:focus,
.odth-textarea:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.odth-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* Select dropdown styling */
.odth-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* ========================================
   EMERGENCY NOTICE STYLING
   ======================================== */

.odth-emergency-notice {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    animation: emergencyPulse 2s ease-in-out infinite;
}

.odth-emergency-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.odth-emergency-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.odth-emergency-text {
    color: #7f1d1d;
    font-weight: 500;
    line-height: 1.5;
}

@keyframes emergencyPulse {
    0%, 100% { 
        border-color: #fecaca; 
        background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    }
    50% { 
        border-color: #f87171; 
        background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    }
}

/* ========================================
   SUBMIT BUTTON STYLING
   ======================================== */

.odth-form-submit {
    text-align: center;
    margin-top: 32px;
}

.odth-submit-btn {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
    position: relative;
    overflow: hidden;
}

.odth-submit-btn:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(5, 150, 105, 0.2);
}

.odth-submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.odth-btn-text,
.odth-btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.odth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.odth-submit-note {
    font-size: 12px;
    color: #6b7280;
    margin-top: 12px;
    font-style: italic;
}

/* ========================================
   SUCCESS AND ERROR MESSAGES
   ======================================== */

.odth-success-message,
.odth-error-message {
    padding: 24px;
    border-radius: 12px;
    margin: 24px 0;
    text-align: center;
}

.odth-success-message {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #bbf7d0;
    color: #166534;
}

.odth-error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fecaca;
    color: #dc2626;
}

.odth-success-icon,
.odth-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.odth-success-content h3,
.odth-error-content h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
}

.odth-success-details {
    background: rgba(255, 255, 255, 0.7);
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    text-align: left;
}

.odth-error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.odth-new-request-btn,
.odth-retry-btn {
    background: #059669;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.odth-new-request-btn:hover,
.odth-retry-btn:hover {
    background: #047857;
}

.odth-emergency-link {
    background: #dc2626;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.odth-emergency-link:hover {
    background: #b91c1c;
    text-decoration: none;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .odth-service-form-container {
        margin: 16px;
        padding: 16px;
    }
    
    .odth-form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .odth-service-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .odth-form-title {
        font-size: 24px;
    }
    
    .odth-section-title {
        font-size: 18px;
    }
    
    .odth-emergency-content {
        flex-direction: column;
        text-align: center;
    }
    
    .odth-error-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .odth-service-form-container {
        margin: 8px;
        padding: 12px;
    }
    
    .odth-service-card {
        padding: 16px;
    }
    
    .odth-service-icon {
        font-size: 28px;
    }
    
    .odth-input,
    .odth-select,
    .odth-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ========================================
   TURNSTILE INTEGRATION STYLING
   ======================================== */

.odth-turnstile-container {
    margin: 24px 0;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    text-align: center;
}

.cf-turnstile {
    display: inline-block;
    margin: 0 auto;
}

.turnstile-status {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border: 1px solid;
}

.turnstile-status.error {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.turnstile-status.success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.turnstile-status.loading {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

/**
 * Enhanced Service Form CSS - Multi-Selection Integration
 * Add to your existing odth-service-form.css file
 * Styles for comprehensive service overview integration
 */

/* ===== SELECTED SERVICES DISPLAY CONTAINER ===== */
.odth-selected-services-container {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
    animation: slideInFromTop 0.4s ease-out;
}

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

/* ===== SELECTED SERVICES HEADER ===== */
.odth-selected-services-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.odth-selected-services-header h4 {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: #047857 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.odth-clear-selections-btn {
    background: #ef4444 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.odth-clear-selections-btn:hover {
    background: #dc2626 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3) !important;
}

/* ===== SELECTED SERVICES LIST ===== */
.odth-selected-services-list {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
}

.odth-selected-service-tag {
    background: #10b981 !important;
    color: white !important;
    padding: 6px 12px 6px 10px !important;
    border-radius: 20px !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    animation: fadeInScale 0.3s ease-out !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2) !important;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.odth-selected-service-tag .service-name {
    line-height: 1.2 !important;
}

.odth-selected-service-tag .remove-service-btn {
    background: rgba(255, 255, 255, 0.3) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    font-weight: bold !important;
}

.odth-selected-service-tag .remove-service-btn:hover {
    background: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.1) !important;
}

/* ===== SELECTED SERVICES SUMMARY ===== */
.odth-selected-services-summary {
    margin-bottom: 16px !important;
}

.service-summary {
    background: rgba(255, 255, 255, 0.7) !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    font-size: 0.9rem !important;
    color: #047857 !important;
    text-align: center !important;
}

.service-summary strong {
    color: #065f46 !important;
}

.price-estimate {
    font-weight: 600 !important;
    color: #065f46 !important;
}

/* ===== AUTO-FILL NOTICE ===== */
.odth-auto-fill-notice {
    background: rgba(59, 130, 246, 0.1) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    border-radius: 6px !important;
    padding: 10px 12px !important;
}

.odth-auto-fill-notice p {
    margin: 0 !important;
    font-size: 0.85rem !important;
    color: #1e40af !important;
    line-height: 1.4 !important;
}

/* ===== ENHANCED FORM FIELD STYLING ===== */

/* Problem description auto-expansion styling */
#odthProblemDescription {
    min-height: 120px !important;
    transition: height 0.3s ease !important;
    resize: vertical !important;
}

#odthProblemDescription:focus {
    min-height: 160px !important;
}

/* Radio button enhancement for auto-selection feedback */
.odth-form-group input[type="radio"]:checked + label {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    border-color: #10b981 !important;
    transform: scale(1.02) !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2) !important;
}

/* Auto-selected service visual indicator */
.odth-form-group input[type="radio"]:checked + label::after {
    content: " ✓ Auto-selected" !important;
    font-size: 0.75rem !important;
    color: #047857 !important;
    font-weight: 500 !important;
    margin-left: 8px !important;
}

/* ===== VALIDATION STYLING ===== */
.odth-form-group input.error,
.odth-form-group textarea.error,
.odth-form-group select.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.odth-form-group input.error:focus,
.odth-form-group textarea.error:focus,
.odth-form-group select.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
    .odth-selected-services-container {
        padding: 16px !important;
        margin-bottom: 20px !important;
    }

    .odth-selected-services-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .odth-selected-services-header h4 {
        font-size: 1rem !important;
        text-align: center !important;
    }

    .odth-clear-selections-btn {
        align-self: center !important;
        width: fit-content !important;
    }

    .odth-selected-services-list {
        justify-content: center !important;
        gap: 6px !important;
    }

    .odth-selected-service-tag {
        font-size: 0.75rem !important;
        padding: 5px 10px 5px 8px !important;
    }

    .service-summary {
        font-size: 0.85rem !important;
        padding: 10px 12px !important;
    }

    .odth-auto-fill-notice p {
        font-size: 0.8rem !important;
        text-align: center !important;
    }

    /* Adjust auto-selected indicator for mobile */
    .odth-form-group input[type="radio"]:checked + label::after {
        display: block !important;
        margin-left: 0 !important;
        margin-top: 4px !important;
        font-size: 0.7rem !important;
    }
}

/* ===== INTEGRATION WITH EXISTING FORM STYLES ===== */

/* Ensure compatibility with existing form container */
.odth-form-container .odth-selected-services-container {
    margin-top: 0 !important;
}

/* Enhanced submit button when services are selected */
.odth-form-container .odth-submit-btn.has-selections {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3) !important;
}

.odth-form-container .odth-submit-btn.has-selections:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4) !important;
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* Focus management for service tags */
.odth-selected-service-tag:focus-within {
    outline: 2px solid #3b82f6 !important;
    outline-offset: 2px !important;
}

.remove-service-btn:focus {
    outline: 2px solid #ffffff !important;
    outline-offset: 1px !important;
}

/* Screen reader text for auto-fill functionality */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ===== ANIMATION PERFORMANCE OPTIMIZATION ===== */
@media (prefers-reduced-motion: reduce) {
    .odth-selected-services-container,
    .odth-selected-service-tag,
    .odth-form-group input[type="radio"]:checked + label {
        animation: none !important;
        transition: none !important;
    }

    .odth-clear-selections-btn:hover,
    .remove-service-btn:hover,
    .odth-submit-btn.has-selections:hover {
        transform: none !important;
    }
}

/* ===== HIGH DPI DISPLAY OPTIMIZATION ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .odth-selected-services-container {
        border-width: 1px !important;
    }

    .odth-selected-service-tag {
        box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2) !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .odth-selected-services-container {
        background: white !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        break-inside: avoid !important;
    }

    .odth-clear-selections-btn,
    .remove-service-btn {
        display: none !important;
    }

    .odth-selected-service-tag {
        background: #f3f4f6 !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    .odth-auto-fill-notice {
        background: #f9fafb !important;
        border: 1px solid #d1d5db !important;
    }
}
