/* Dashboard Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header-content h1 {
    font-size: 2rem;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-refresh, .btn-export {
    padding: 10px 20px;
    border: 2px solid white;
    background: transparent;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh:hover, .btn-export:hover {
    background: white;
    color: #667eea;
}

.last-updated {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    color: #2d3748;
    margin-bottom: 5px;
}

.stat-content p {
    font-size: 0.9rem;
    color: #718096;
}

.low-entropy {
    border-left: 4px solid #10b981;
}

.medium-entropy {
    border-left: 4px solid #f59e0b;
}

.high-entropy {
    border-left: 4px solid #ef4444;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-card h3 {
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 1.3rem;
}

.chart-container {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dimension Bars */
.dimensions-bars {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dim-bar-item {
    display: grid;
    grid-template-columns: 180px 1fr 60px;
    align-items: center;
    gap: 15px;
}

.dim-label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.dim-bar {
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.dim-fill {
    height: 100%;
    width: var(--width, 0%);
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.8s ease;
    border-radius: 10px;
}

.dim-value {
    text-align: right;
    font-weight: 600;
    color: #667eea;
}

/* Table Section */
.table-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-header h3 {
    font-size: 1.3rem;
    color: #2d3748;
}

.table-filters {
    display: flex;
    gap: 10px;
}

.table-filters select,
.table-filters input {
    padding: 8px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}

.table-filters select:focus,
.table-filters input:focus {
    border-color: #667eea;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f7fafc;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #f7fafc;
}

.score-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-block;
}

.score-low {
    background: #d1fae5;
    color: #065f46;
}

.score-medium {
    background: #fef3c7;
    color: #92400e;
}

.score-high {
    background: #fee2e2;
    color: #991b1b;
}

.category-badge {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-view {
    padding: 6px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.btn-view:hover {
    background: #5568d3;
}

/* Loading State */
.loading-row td {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
}

.page-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: #5568d3;
}

.page-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.page-info {
    color: #4a5568;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #718096;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #2d3748;
}

.modal-body {
    margin-top: 20px;
}

.detail-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.detail-label {
    font-weight: 600;
    color: #4a5568;
}

.detail-value {
    color: #2d3748;
}

.answers-grid {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.answer-item {
    background: #f7fafc;
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
}

/* Responsive */
@media (max-width: 1024px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dim-bar-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .dim-value {
        text-align: left;
    }

    .table-filters {
        flex-direction: column;
        width: 100%;
    }

    .table-filters select,
    .table-filters input {
        width: 100%;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 10px;
    }
}