.frequency-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.summary-card h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.summary-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #3498db;
    display: block;
    margin-bottom: 0.5rem;
}

.frequency-summary-stats {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.frequency-summary-stats h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

.summary-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-stat {
    text-align: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.summary-stat .label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.summary-stat .value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.summary-stat .sub-value {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.frequency-table {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.frequency-table h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

.frequency-table-container {
    overflow-x: auto;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    margin-top: 1rem;
}

.frequency-results-table {
    width: 100%;
    border-collapse: collapse;
}

.frequency-results-table th,
.frequency-results-table td {
    padding: 0.75rem 1rem;
    border-right: 1px solid #dee2e6;
    text-align: center;
}

.frequency-results-table th:last-child,
.frequency-results-table td:last-child {
    border-right: none;
}

.frequency-results-table th {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    font-weight: bold;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    border-bottom: 2px solid #1a252f;
}

.frequency-results-table th:hover {
    background: linear-gradient(135deg, #3d566e, #34495e);
}

.frequency-results-table th.sort-asc::after {
    content: " ↑";
    color: #3498db;
    font-weight: bold;
    margin-left: 5px;
}

.frequency-results-table th.sort-desc::after {
    content: " ↓";
    color: #3498db;
    font-weight: bold;
    margin-left: 5px;
}

.frequency-results-table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #dee2e6;
}

.frequency-results-table tbody tr:nth-child(odd) {
    background-color: #f8f9fa;
}

.frequency-results-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

.frequency-results-table tbody tr:hover {
    background-color: #e3f2fd !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.number-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.frequency-number-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #2c3e50;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.count-cell {
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    font-size: 1.05rem;
}

.primary-count {
    color: #e74c3c;
}

.secondary-count {
    color: #3498db;
}

.total-count {
    color: #27ae60;
    font-size: 1.15rem;
    font-weight: 900;
}

/* Frequency Plot Styles */
#frequency-plot {
    margin-top: 2rem;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#frequency-plot h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
}

.plot-controls {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #dee2e6;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.control-group label input[type="checkbox"] {
    margin-right: 0.5rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 0.5rem 1rem;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    transition: all 0.3s ease;
}

.btn-filter:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-filter.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.btn-apply {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.btn-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

#custom-number-filter input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    margin-top: 0.5rem;
}

#zoom-level {
    width: 100%;
    margin-top: 0.5rem;
}

#zoom-value {
    font-weight: bold;
    color: #3498db;
    margin-left: 0.5rem;
}

.plot-container {
    position: relative;
    overflow-x: auto;
    overflow-y: visible; /* Changed from auto */
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: #ffffff;
    max-height: none; /* Remove max-height restriction */
    min-height: 400px; /* Minimum height */
}

#frequency-canvas {
    display: block;
    cursor: grab;
}

#frequency-canvas:active {
    cursor: grabbing;
}

.plot-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.primary {
    background-color: #3498db;
}

.legend-dot.secondary {
    background-color: #95a5a6;
}

.legend-label {
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

@media (max-width: 768px) {
    .summary-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .frequency-results-table th,
    .frequency-results-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .frequency-number-circle {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .count-cell {
        font-size: 0.95rem;
    }
    
    .total-count {
        font-size: 1.05rem;
    }

    .filter-buttons {
        flex-direction: column;
    }
    
    .btn-filter {
        width: 100%;
    }
    
    .plot-container {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .frequency-results-table th,
    .frequency-results-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .frequency-number-circle {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    .count-cell {
        font-size: 0.85rem;
    }
    
    .total-count {
        font-size: 0.95rem;
    }
}