/* 5 Whys Analysis Specific Styles - Clean Tailwind-Compatible Version */

/* Tabbed Interface Styles - New Flow */
.five-whys-results-overlay .analysis-tabs {
    display: flex;
    border-bottom: 1px solid #e0e6ed;
    margin-bottom: 1.5rem;
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
}

.five-whys-results-overlay .tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.five-whys-results-overlay .tab-btn:hover:not(.disabled) {
    color: #1e293b;
    background: rgba(59, 130, 246, 0.05);
}

.five-whys-results-overlay .tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: white;
}

.five-whys-results-overlay .tab-btn.disabled {
    color: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.6;
}

.five-whys-results-overlay .tab-btn.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #cbd5e1;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.five-whys-results-overlay .tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.five-whys-results-overlay .tab-content.active {
    display: block;
}

.five-whys-results-overlay .tab-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: #64748b;
}

.five-whys-results-overlay .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* Toast Notification Styles */
.five-whys-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.five-whys-toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    margin-bottom: 0.5rem;
    min-width: 320px;
    max-width: 450px;
    border-left: 4px solid;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    overflow: hidden;
}

.five-whys-toast.toast-success {
    border-left-color: #10b981;
}

.five-whys-toast.toast-info {
    border-left-color: #3b82f6;
}

.five-whys-toast.toast-warning {
    border-left-color: #f59e0b;
}

.five-whys-toast.toast-error {
    border-left-color: #ef4444;
}

.five-whys-toast .toast-content {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
}

.five-whys-toast .toast-message {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #374151;
    margin-right: 0.5rem;
}

.five-whys-toast .toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.five-whys-toast .toast-close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

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

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

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Tab Content Specific Styles */
.five-whys-results-overlay .solutions-content,
.five-whys-results-overlay .visuals-content {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-top: 1rem;
}

/* Enhanced Header for Tabbed Interface */
.five-whys-results-overlay .analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid #e0e6ed;
    margin-bottom: 0;
}

.five-whys-results-overlay .analysis-header h2 {
    margin: 0;
    color: #1e293b;
    font-size: 1.5rem;
    font-weight: 600;
}

.five-whys-results-overlay .header-actions {
    display: flex;
    gap: 0.5rem;
}

.five-whys-results-overlay .close-btn {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.25rem;
    transition: all 0.2s ease;
}

.five-whys-results-overlay .close-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

/* React Components Additional Styles */
.mermaid-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mermaid-diagram {
    width: 100%;
    height: auto;
}

.mermaid-diagram svg {
    max-width: 100%;
    height: auto;
}

/* Toast animation */
@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slide-in-right {
    animation: slide-in-right 0.3s ease-out;
}

/* React-specific overrides for better integration */
.five-whys-results-overlay .five-whys-results-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Ensure proper scrolling for React components */
.five-whys-results-overlay .overflow-y-auto {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.five-whys-results-overlay .overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.five-whys-results-overlay .overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

.five-whys-results-overlay .overflow-y-auto::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.five-whys-results-overlay .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

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

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    .five-whys-results-overlay .analysis-tabs {
        flex-wrap: wrap;
        padding: 0 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .five-whys-results-overlay .tab-btn {
        font-size: 0.8rem;
        padding: 0.75rem 0.75rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .five-whys-results-overlay .analysis-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .five-whys-results-overlay .analysis-header h2 {
        font-size: 1.25rem;
    }
    
    .five-whys-results-overlay .header-actions {
        order: -1;
        justify-content: flex-end;
        width: 100%;
    }
    
    .five-whys-results-overlay .solutions-content,
    .five-whys-results-overlay .visuals-content {
        padding: 0.75rem;
    }
    
    .five-whys-results-overlay .tab-loading {
        padding: 2rem 1rem;
    }
}

/* Medium Mobile Devices (481px - 768px) */
@media (max-width: 768px) {
    .five-whys-results-overlay .analysis-tabs {
        padding: 0 1rem;
    }
    
    .five-whys-results-overlay .tab-btn {
        font-size: 0.85rem;
        padding: 0.875rem 1rem;
    }
    
    .five-whys-results-overlay .analysis-header {
        padding: 1.25rem 1rem 1rem;
    }
    
    .five-whys-results-overlay .analysis-header h2 {
        font-size: 1.375rem;
    }
}

/* Large Mobile Devices (769px - 1024px) */
@media (max-width: 1024px) {
    .five-whys-results-overlay .analysis-tabs {
        padding: 0 1.5rem;
    }
    
    .five-whys-results-overlay .tab-btn {
        padding: 1rem 1.25rem;
    }
    
    .five-whys-results-overlay .analysis-header {
        padding: 1.5rem 1.5rem 1rem;
    }
}
