/**
 * Public styles for the Student Exam Results plugin - Modern Design
 */

/* CSS Variables for consistent theming - Light Theme */
:root {
    --primary-color: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #1d4ed8;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border-color: #d1d5db;
    --border-light: #e5e7eb;
    --background-white: #ffffff;
    --background-gray: #f8fafc;
    --background-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Main container */
.ser-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
}

.ser-header {
    margin-bottom: 32px;
    text-align: center;
}

.ser-header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.ser-section {
    margin-bottom: 32px;
    background: var(--background-white);
    padding: 24px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: box-shadow 0.2s ease;
}

.ser-section:hover {
    box-shadow: var(--shadow-lg);
}

.ser-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.ser-section-title h3 {
    margin: 0;
    color: #23282d;
}

.ser-section-toggle {
    cursor: pointer;
    color: #0073aa;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.ser-section-toggle:hover {
    color: #00a0d2;
}

.ser-section-toggle .dashicons {
    font-size: 20px;
    margin-left: 5px;
}

/* Modern Table Styles */
.ser-results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 24px;
    background: var(--background-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ser-results-table th, 
.ser-results-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.ser-results-table th {
    background: linear-gradient(135deg, var(--background-gray) 0%, #f1f5f9 100%);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ser-results-table tbody tr {
    transition: all 0.2s ease;
}

.ser-results-table tbody tr:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.ser-results-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table cell specific styles */
.ser-results-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.ser-results-table td:nth-child(2) {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.ser-results-table td:nth-child(3),
.ser-results-table td:nth-child(4),
.ser-results-table td:nth-child(5) {
    text-align: center;
    font-weight: 500;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.ser-results-table td:nth-child(6) {
    text-align: center;
}

.ser-results-table td:nth-child(7) {
    text-align: center;
    font-weight: 600;
}

/* For responsive tables */
@media screen and (max-width: 767px) {
    .ser-results-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Modern Chart Container - Light Theme */
.ser-chart-container {
    margin: 24px 0;
    height: 720px;
    max-width: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: visible;
}

.ser-chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #22c55e, #f59e0b);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* Chart Header */
.ser-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.ser-chart-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.ser-chart-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
}

/* Chart Controls */
.ser-chart-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ser-chart-control-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--background-white);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 14px;
}

.ser-chart-control-btn:hover {
    background: var(--background-gray);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.ser-chart-control-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Chart Legend */
.ser-chart-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.ser-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.ser-chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ser-chart-legend-color.total {
    background: #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.ser-chart-legend-color.mcq {
    background: #22c55e;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.ser-chart-legend-color.essay {
    background: #f59e0b;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Chart Error Display */
.ser-chart-error {
    padding: 20px;
    background-color: #fff9fa;
    border: 1px solid #ffcdd2;
    color: #d32f2f;
    margin: 15px 0;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    line-height: 1.5;
}

.ser-chart-error p {
    margin: 0 0 10px 0;
    font-weight: 500;
}

.ser-chart-error button {
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #1976d2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.ser-chart-error button:hover {
    background-color: #1565c0;
}

/* Modern Statistics Boxes */
.ser-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ser-stat-box {
    padding: 24px;
    background: var(--background-white);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ser-stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
}

.ser-stat-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.ser-stat-box-title {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ser-stat-box-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1;
}

.ser-stat-box-info {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 8px;
    font-weight: 500;
}

.ser-stat-box.primary::before {
    background: var(--primary-color);
}

.ser-stat-box.success::before {
    background: var(--success-color);
}

.ser-stat-box.warning::before {
    background: var(--warning-color);
}

.ser-stat-box.primary {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.ser-stat-box.success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.ser-stat-box.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Modern Percentage Badges */
.ser-percentage {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

.ser-percentage::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
    background: currentColor;
}

.ser-percentage.excellent {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.3);
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.1);
}

.ser-percentage.good {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.ser-percentage.average {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
}

.ser-percentage.poor {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
}

/* Modern DataTables Styling */
.dataTables_wrapper {
    margin-top: 16px;
}

.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 20px;
}

.dataTables_wrapper .dataTables_length select, 
.dataTables_wrapper .dataTables_filter input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-white);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: 200px;
}

.dataTables_wrapper .dataTables_length select:focus, 
.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dataTables_wrapper .dataTables_paginate {
    margin-top: 20px;
    text-align: center;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-white);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
    min-width: 40px;
    text-align: center;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-color);
    color: white !important;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color);
    color: white !important;
    border-color: var(--primary-color);
    font-weight: 600;
}

.dataTables_wrapper .dataTables_info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 16px;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .ser-container {
        margin: 16px 0;
    }
    
    .ser-header h2 {
        font-size: 1.5rem;
    }
    
    .ser-section {
        padding: 16px;
        margin-bottom: 20px;
    }
    
    .ser-stats-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .ser-stat-box {
        padding: 20px;
    }
    
    .ser-stat-box-value {
        font-size: 2rem;
    }
    
    .ser-chart-container {
        height: 670px;
        padding: 16px;
        overflow: visible;
    }
    
    .ser-chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .ser-chart-controls {
        align-self: flex-end;
    }
    
    .ser-chart-legend {
        gap: 16px;
        margin-top: 20px;
        justify-content: center;
    }
    
    .ser-results-table th, 
    .ser-results-table td {
        padding: 12px 16px;
        font-size: 0.8rem;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        min-width: 150px;
    }
}

@media screen and (max-width: 480px) {
    .ser-header h2 {
        font-size: 1.25rem;
    }
    
    .ser-section {
        padding: 12px;
    }
    
    .ser-stat-box {
        padding: 16px;
    }
    
    .ser-stat-box-value {
        font-size: 1.75rem;
    }
    
    .ser-chart-container {
        height: 620px;
        padding: 12px;
        overflow: visible;
    }
}

/* Chart scroll container for horizontal scrolling */
.ser-chart-scroll-container {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 #f1f5f9;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.ser-chart-scroll-container::-webkit-scrollbar {
    height: 12px;
}

.ser-chart-scroll-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
    margin: 0 4px;
}

.ser-chart-scroll-container::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}

.ser-chart-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

.ser-chart-scroll-container::-webkit-scrollbar-thumb:active {
    background: #1d4ed8;
}

/* Ensure chart has proper minimum width for scrolling */
#serStudentChart {
    min-width: 100%;
    width: max-content;
    overflow: visible;
}

#serStudentChart svg {
    min-width: 100%;
    width: max-content;
    overflow: visible;
}

/* Force horizontal scrolling when chart is wider than container */
.ser-chart-scroll-container {
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

/* Mobile-specific chart adjustments */
@media (max-width: 768px) {
    #serStudentChart {
        min-width: 100% !important;
    }
    
    .ser-chart-scroll-container {
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
    
    .ser-chart-scroll-container::-webkit-scrollbar {
        height: 10px;
    }
}

@media (max-width: 480px) {
    #serStudentChart {
        min-width: 100% !important;
    }
    
    .ser-chart-scroll-container::-webkit-scrollbar {
        height: 8px;
    }
}

/* Ensure proper responsive behavior for chart */
@media (max-width: 480px) {
    .ser-results-table th, 
    .ser-results-table td {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .ser-chart-legend {
        flex-direction: column;
        gap: 8px;
    }
}

/* Light theme only - no dark mode */
