/* ===== Base Container Styles ===== */
:root {
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 10px;
    --border-color: #e2e8f0;
    --border-color-dark: #4a5568;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --bg-dark-primary: #2d3748;
    --bg-dark-secondary: #1e293b;
    --bg-dark-tertiary: #334155;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-dark-primary: #f8fafc;
    --text-dark-secondary: #e2e8f0;
    --text-dark-muted: #94a3b8;
    --accent-color: #4a2aec;
    --accent-hover: #3d1fd9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ===== Cluster Card ===== */
.cluster-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    overflow: hidden;
}

.dark-theme .cluster-card {
    background: var(--bg-dark-primary);
    border-color: var(--border-color-dark);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cluster-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark-theme .cluster-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
}

.cluster-header {
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

.dark-theme .cluster-header {
    background: linear-gradient(135deg, var(--bg-dark-primary) 0%, var(--bg-dark-secondary) 100%);
    border-bottom-color: var(--border-color-dark);
}

.cluster-header:hover {
    background: #f1f3f5;
}

.cluster-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cluster-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
}

.cluster-count {
    display: flex;
    gap: 0.5rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    white-space: nowrap;
}

.badge-buckets {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.badge-tests {
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.dark-theme .badge-buckets {
    background-color: #1e3a8a;
    color: #bfdbfe;
    border-color: #3b82f6;
}

.dark-theme .badge-tests {
    background-color: #14532d;
    color: #bbf7d0;
    border-color: #22c55e;
}

/* Material Icons Base */
.material-icons-round {
    font-family: 'Material Icons Round';
    font-weight: normal;
    font-style: normal;
    font-size: 1.5rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-flex;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    vertical-align: middle;
}

/* Group Toggle */
.cluster-toggle {
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 0.5rem;
    cursor: pointer;
    border-radius: 50%;
}

.dark-theme .cluster-toggle {
    color: var(--text-dark-muted);
}

.cluster-toggle:hover {
    color: var(--accent-color);
    background-color: rgba(74, 42, 236, 0.1);
}

.dark-theme .cluster-toggle:hover {
    color: #818cf8;
    background-color: rgba(129, 140, 248, 0.1);
}

/* Collapse/Expand Animations */
.cluster-header.collapsed .cluster-toggle {
    transform: rotate(-90deg);
}

/* Bucket Toggle */
.cluster-item-toggle {
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease, background-color 0.2s ease;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}

.dark-theme .cluster-item-toggle {
    color: var(--text-dark-muted);
}

.cluster-item-toggle:hover {
    color: var(--accent-color);
    background-color: rgba(74, 42, 236, 0.1);
}

.dark-theme .cluster-item-toggle:hover {
    color: #818cf8;
    background-color: rgba(129, 140, 248, 0.1);
}

.cluster-item-header.collapsed .cluster-item-toggle {
    transform: rotate(-90deg);
}

.cluster-toggle::before {
    display: inline-block;
    transition: transform 0.3s ease;
}

.cluster-header.collapsed .cluster-toggle::before {
    transform: rotate(-90deg);
}

.cluster-header.collapsed .cluster-toggle {
    transform: rotate(-90deg);
}

.cluster-content {
    max-height: 50000px; /* Large enough to contain all content */
    overflow: hidden; /* Hide overflow when collapsing */
    transition: all 0.3s ease;
    padding: 1rem 1.75rem 1.5rem; /* Added top padding for spacing */
    opacity: 1;
    transform: translateY(0);
}

.cluster-content.collapsed {
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0;
    transform: translateY(-10px);
    border: none !important;
    overflow: hidden;
    min-height: 0 !important;
}

/* Cluster Item Styles */
.cluster-item {
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    overflow: hidden;
}

.dark-theme .cluster-item {
    background: var(--bg-dark-primary);
    border-color: var(--border-color-dark);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cluster-item:last-child {
    border-bottom: none;
}

.cluster-item-header {
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.dark-theme .cluster-item-header {
    background: var(--bg-dark-tertiary);
    border-bottom-color: var(--border-color-dark);
}

.cluster-item-header:hover {
    background: #f1f3f5;
}

.cluster-item-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #343a40;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Icons */
.cluster-icon {
    font-size: 1.25rem;
    color: var(--accent-color);
    margin-right: 0.5rem;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
}

.dark-theme .cluster-icon {
    color: #818cf8;
}

.path-icon {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-right: 0.5rem;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
}

.dark-theme .path-icon {
    color: var(--text-dark-muted);
}

.cluster-item-toggle {
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: transform 0.3s ease, color 0.2s ease;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 0.5rem;
    cursor: pointer;
}

.dark-theme .cluster-item-toggle {
    color: var(--text-dark-muted);
}

.cluster-item-toggle:hover {
    color: var(--accent-color);
}

.dark-theme .cluster-item-toggle:hover {
    color: #818cf8;
}

.cluster-item-header.collapsed .cluster-item-toggle {
    transform: rotate(0deg);
}

.cluster-header.collapsed .cluster-toggle {
    transform: rotate(-90deg);
}

.cluster-item-toggle::before {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.cluster-item-header.collapsed .cluster-item-toggle::before {
    transform: rotate(-90deg);
}

.cluster-item-header.collapsed .cluster-item-toggle {
    transform: rotate(-90deg);
}

.cluster-item-content {
    padding: 1.25rem;
    background: var(--bg-primary);
    transition: all 0.3s ease;
    max-height: 50000px; /* Large enough to contain content */
    overflow: hidden; /* Hide overflow when collapsing */
    border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
    opacity: 1;
    transform: translateY(0);
}

.dark-theme .cluster-item-content {
    background: var(--bg-dark-primary);
}

.cluster-item-content.collapsed {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0;
    transform: translateY(-5px);
    margin: 0;
    border: none;
    overflow: hidden;
}

/* Results Section */
.results-section {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.dark-theme .section-header h2 {
    color: var(--dark-text);
}

.search-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.dark-theme .search-input {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

.search-input:focus {
    outline: none;
    border-color: var(--dochia-purple);
    box-shadow: 0 0 0 2px rgba(74, 42, 236, 0.1);
}

.search-clear {
    padding: 0.5rem 0.75rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark-theme .search-clear {
    background: var(--dark-surface);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

.search-clear:hover {
    background: var(--gray-200);
}

.dark-theme .search-clear:hover {
    background: var(--dark-surface-light);
}

.results-table-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0; /* Allow container to shrink below content size */
    flex: 1 1 auto; /* Allow container to grow and shrink */
    overflow: visible; /* Ensure no content is clipped */
    background: none;
    box-shadow: none;
    border: none;
}

body.dark-theme .results-table-container {
      background: none;
       box-shadow: none;
       border: none;
}

/* Custom scrollbar */
.results-table-container::-webkit-scrollbar {
    width: 8px;
}

.results-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.results-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.results-table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.dark-theme .results-table-container::-webkit-scrollbar-track {
    background: #2d3748;
}

.dark-theme .results-table-container::-webkit-scrollbar-thumb {
    background: #4a5568;
}

.dark-theme .results-table-container::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Path and Test Case Styles */
.path-group {
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.dark-theme .path-group {
    background: var(--bg-dark-secondary);
    border-color: var(--border-color-dark);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.path-group:hover {
    background: #f1f3f5;
}

.path-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.path-icon {
    color: #4a2aec;
    font-size: 1.1em;
}

.path-value {
    font-size: 0.875rem;
    color: #343a40;
    font-weight: 800;
    word-break: break-all;
    max-width: 500px;
}

.test-cases {
    margin-top: 0.75rem;
    padding-left: 1.5rem;
}

.test-cases-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.test-cases-list {
    font-size: 0.8125rem;
    color: #495057;
    line-height: 1.6;
}

.test-cases-list a {
    color: #4a2aec;
    text-decoration: none;
    transition: color 0.2s ease;
}

.test-cases-list a:hover {
    color: #3d1fd9;
    text-decoration: underline;
}

/* Dark Mode Styles */
.dark-theme .cluster-card,
.dark-theme .cluster-item-content {
    background: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.dark-theme .cluster-header {
    border-bottom: 1px solid var(--border-color-dark);
    margin-bottom: 0;
}
.dark-theme .cluster-item-header {
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.dark-theme .cluster-header:hover,
.dark-theme .cluster-item-header:hover {
    background: #2d3748;
}

.dark-theme .cluster-title,
.dark-theme .cluster-item-title {
    color: #f1f5f9;
}

.dark-theme .cluster-count {
    background: #334155;
    color: #e2e8f0;
}

.dark-theme .path-group {
    background: #1e293b;
}

.dark-theme .path-group:hover {
    background: #2d3748;
}

.dark-theme .path-value,
.dark-theme .test-cases-list {
    color: #e2e8f0;
}

.dark-theme .test-cases-label {
    color: #94a3b8;
}

.dark-theme .test-cases-list a {
    color: #818cf8;
}

.dark-theme .test-cases-list a:hover {
    color: #a5b4fc;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .cluster-header,
    .cluster-item-header {
        padding: 0.875rem 1rem;
    }

    .cluster-item-content {
        padding: 0.875rem 1rem;
    }

    .path-group {
        padding: 0.875rem;
    }

    .test-cases {
        padding-left: 1rem;
    }
}

/* Utility Classes */
.detail-label {
    font-weight: 500;
    color: #6c757d;
    margin-right: 0.5rem;
}

.cluster-detail {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.dark-theme .cluster-detail {
    background: #1e293b;
    border-color: #334155;
}

.dark-theme .cluster-detail:hover {
    background: #2d3748;
}

.detail-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark-theme .detail-label {
    color: #cbd5e0;
}

.detail-value {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #2d3748;
    word-break: break-word;
    white-space: pre-wrap;
    background: rgba(255, 255, 255, 0.7);
    padding: 0.75rem;
    border-radius: 4px;
    display: block;
    margin-top: 0.5rem;
}

.dark-theme .detail-value {
    color: #e2e8f0;
    background: var(--bg-dark-secondary);
}

.dark-theme .detail-value {
    color: #e2e8f0;
}

.dark-theme .detail-label {
    color: #94a3b8;
}

/* Animation for expanding/collapsing */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cluster-content:not(.collapsed) .cluster-item {
    animation: fadeIn 0.3s ease-out forwards;
}

.cluster-title.error {
    color: var(--error);
}


.cluster-title.warning {
    color: var(--warning);
}


.cluster-title.success {
    color: var(--success);
}
