/* Fatiha Test - Mobile Responsive Table Fix v2 */

/* Desktop: Normal 3-column layout */
@media (min-width: 1024px) {
    .detailed-results-table {
        table-layout: fixed;
    }
    
    .detailed-results-table th:first-child { width: 40%; }  /* Test column - wider */
    .detailed-results-table th:nth-child(2) { width: 35%; } /* Results column */  
    .detailed-results-table th:nth-child(3) { width: 25%; } /* Status column - narrower */
}

/* Tablet landscape & portrait: Adjust column sizes */
@media (min-width: 768px) and (max-width: 1023px) {
    .detailed-results-table {
        table-layout: fixed;
    }
    
    .detailed-results-table th:first-child { width: 35%; }  /* Test column */
    .detailed-results-table th:nth-child(2) { width: 40%; } /* Results column - more space */  
    .detailed-results-table th:nth-child(3) { width: 25%; } /* Status column */
    
    /* Results column text wrapping */
    .detailed-results-table td:nth-child(2) .break-all {
        word-break: break-word !important;
        white-space: normal !important;
        line-height: 1.4;
        font-size: 0.9rem;
    }
}

/* Mobile portrait & landscape: Major layout changes */
@media (max-width: 767px) {
    
    /* Force card layout instead of table for mobile */
    .detailed-results-table {
        display: block;
        width: 100%;
    }
    
    .detailed-results-table thead {
        display: none; /* Hide headers on mobile */
    }
    
    .detailed-results-table tbody {
        display: block;
        width: 100%;
    }
    
    .detailed-results-table tr {
        display: block;
        margin-bottom: 1rem;
        background: white !important;
        border: 1px solid #e5e7eb;
        border-radius: 0.75rem;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .dark .detailed-results-table tr {
        background: #374151 !important;
        border-color: #4b5563;
    }
    
    .detailed-results-table td {
        display: block !important;
        border: none !important;
        padding: 0.5rem 0 !important;
        text-align: left !important;
    }
    
    /* Mobile card styling - Test section with background like others */
    .detailed-results-table td:first-child {
        background: #f8fafc !important;
        border-radius: 0.5rem;
        padding: 0.75rem !important;
        margin-bottom: 0.75rem;
        width: 100% !important;
        display: block !important;
    }
    
    .dark .detailed-results-table td:first-child {
        background: #1f2937 !important;
    }
    
    /* Add label before test name */
    .detailed-results-table td:first-child::before {
        content: "🧪 Test: ";
        font-weight: bold;
        color: #6b7280;
        display: block;
        margin-bottom: 0.25rem;
        font-size: 0.8rem;
    }
    
    .dark .detailed-results-table td:first-child::before {
        color: #9ca3af;
    }
    
    /* Test name styling - Full width fix */
    .detailed-results-table td:first-child .font-bold {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        color: #1f2937;
        width: 100% !important;
        display: block;
    }
    
    .dark .detailed-results-table td:first-child .font-bold {
        color: #f9fafb;
    }
    
    /* Test description - full width */
    .detailed-results-table td:first-child .text-xs {
        width: 100% !important;
        display: block;
        line-height: 1.4;
        color: #64748b;
    }
    
    .dark .detailed-results-table td:first-child .text-xs {
        color: #94a3b8;
    }
    
    /* Results section - horizontal layout for mobile */
    .detailed-results-table td:nth-child(2) {
        background: #f8fafc;
        border-radius: 0.5rem;
        padding: 0.75rem !important;
        margin-bottom: 0.75rem;
    }
    
    .dark .detailed-results-table td:nth-child(2) {
        background: #1f2937;
    }
    
    .detailed-results-table td:nth-child(2) .break-all {
        word-break: break-word !important;
        white-space: normal !important;
        line-height: 1.3;
        font-size: 0.85rem;
        font-family: 'Monaco', 'Menlo', monospace;
        margin-bottom: 0.5rem;
    }
    
    .detailed-results-table td:nth-child(2)::before {
        content: "📊 Result: ";
        font-weight: bold;
        color: #6b7280;
        display: block;
        margin-bottom: 0.25rem;
        font-size: 0.8rem;
    }
    
    .dark .detailed-results-table td:nth-child(2)::before {
        color: #9ca3af;
    }
    
    /* Status section - compact display */
    .detailed-results-table td:nth-child(3) {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        background: #f1f5f9;
        border-radius: 0.5rem;
        padding: 0.5rem 0.75rem !important;
    }
    
    .dark .detailed-results-table td:nth-child(3) {
        background: #1e293b;
    }
    
    .detailed-results-table td:nth-child(3)::before {
        content: "🔒 Status:";
        font-weight: bold;
        color: #64748b;
        font-size: 0.8rem;
    }
    
    .dark .detailed-results-table td:nth-child(3)::before {
        color: #94a3af;
    }
    
    /* Status icon and text - horizontal */
    .detailed-results-table td:nth-child(3) > div {
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
    }
    
    .detailed-results-table td:nth-child(3) .inline-flex {
        width: 2rem !important;
        height: 2rem !important;
        margin-bottom: 0 !important;
    }
}

/* Specific mobile landscape fixes */
@media (max-width: 767px) and (orientation: landscape) {
    .detailed-results-table td:nth-child(2) .break-all {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .detailed-results-table tr {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 374px) {
    .detailed-results-table td:nth-child(2) .break-all {
        font-size: 0.75rem;
    }
    
    .detailed-results-table tr {
        padding: 0.5rem;
    }
}