/**
 * Styles for Reporting System - Reports Manager
 * Extracts from reports-manager.js for modularity
 */

/* === MODAL PRINCIPAL === */
.reports-modal {
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reports-modal-content {
    background-color: #fff;
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
    height: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: reportsModalShow 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes reportsModalShow {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* === HEADER === */
.reports-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.reports-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.reports-close {
    cursor: pointer;
    font-size: 28px;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s;
}

.reports-close:hover {
    color: white;
}

/* === BODY AND TABS === */
.reports-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.reports-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.reports-tab-btn {
    padding: 15px 25px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
}

.reports-tab-btn:hover {
    background-color: #e9ecef;
    color: #333;
}

.reports-tab-btn.active {
    background-color: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.reports-content {
    flex: 1;
    overflow-y: auto;
}

.reports-tab-content {
    display: none;
    padding: 30px;
    height: 100%;
    overflow-y: auto;
}

.reports-tab-content.active {
    display: block;
}

/* === CARDURI STATISTICI === */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-icon {
    font-size: 40px;
    margin-right: 20px;
    opacity: 0.8;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* === GRAFICE === */
.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.chart-wrapper {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chart-wrapper h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
}

/* === FILTRE === */
.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-input, .filter-select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.filter-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.filter-btn:hover {
    background: #5a6fd8;
}

.filter-btn.secondary {
    background: #6c757d;
}

.filter-btn.secondary:hover {
    background: #5a6268;
}

/* === TABELE === */
.results-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.results-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
}

.results-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.results-table tr:hover {
    background-color: #f8f9fa;
}

.score-badge {
    padding: 4px 12px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    font-size: 12px;
}

.score-excellent { background: var(--ui-secondary, #28a745); }
.score-good { background: var(--ui-accent, #007bff); }
.score-average { background: #ffc107; color: #333; }
.score-poor { background: var(--ui-danger, #dc3545); }

/* === STATISTICI === */
.statistics-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.stats-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stats-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
}

/* === EXPORT === */
.export-container {
    max-width: 600px;
    margin: 0 auto;
}

.export-options {
    display: grid;
    gap: 25px;
    margin-bottom: 40px;
}

.export-option {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.export-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.export-btn:hover {
    background: #5a6fd8;
}

/* Accessible version: white text needs 4.5:1 (the purple above gives 3.7:1) */
body.a11y-mode .export-btn {
    background: #4451c8;
}
body.a11y-mode .export-btn:hover {
    background: #3742a8;
}

.export-option p {
    color: #666;
    margin: 0;
    font-size: 14px;
}

.clear-data {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 2px solid var(--ui-danger, #dc3545);
}

.clear-btn.danger {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    background: var(--ui-danger, #dc3545);
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.clear-btn.danger:hover {
    background: #c82333;
}

.warning-text {
    color: var(--ui-danger, #dc3545);
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

/* === RAPOARTE EMBEDDED === */
.embedded-reports {
    padding: 0;
}

/* Compact cards: White background, book color only on tape and icon.
   The full blocks, with 24px figures, weighed more than the chart and table. */
.embedded-stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.embedded-stat-card {
    background: #ffffff;
    color: #1f2937;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--auth-accent, #13989d);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.embedded-stat-card .stat-icon {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--auth-accent, #13989d);
    background: #f1f5f9;
    background: color-mix(in srgb, var(--auth-accent, #13989d) 12%, #ffffff);
    margin-right: 0;
    opacity: 1;
}

.embedded-stat-card .stat-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1px;
    color: #111827;
}

.embedded-stat-card .stat-label {
    font-size: 12px;
    color: #6b7280;
    opacity: 1;
    font-weight: 500;
}

.embedded-chart-export-container {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    align-items: flex-start;
}

/* New: main grid with left (cards + graphic) and right (table + export) */
.embedded-main-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr;
    gap: 24px;
    align-items: start;
}

.embedded-left .embedded-chart-section,
.embedded-right .embedded-results-table {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 16px;
}

.embedded-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.embedded-results-header h3 {
    margin: 0;
}

.embedded-chart-section {
    flex: 2;
    min-width: 300px;
}

.embedded-export-section {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}

.embedded-recent-results {
    margin-bottom: 25px;
}

.embedded-chart-section h3,
.embedded-export-section h3,
.embedded-recent-results h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.embedded-results-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.embedded-results-table .dataTables_wrapper {
    overflow-x: auto;
}

/* Games / Evaluations above the results, in a book with evaluations (ReportsUI.generateEmbeddedTables) */
.embedded-results-tabs {
    display: flex;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--skin-auth-color, #13989d);
}

.embedded-results-tab {
    padding: 8px 18px;
    margin-right: 4px;
    border: none;
    border-radius: 8px 8px 0 0;
    background: #f1f3f5;
    color: #444;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.embedded-results-tab:hover {
    background: #e2e6ea;
    color: #222;
}

.embedded-results-tab.active {
    background: var(--skin-auth-color, #13989d);
    color: #ffffff;
}

.embedded-results-tab:focus {
    outline: 3px solid #1e3a8a;
    outline-offset: 2px;
}

.embedded-results-panel {
    display: none;
}

.embedded-results-panel.active {
    display: block;
}

.embedded-export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.embedded-export-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: var(--auth-accent, #13989d);
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
    min-width: fit-content;
    flex-shrink: 0;
}

.embedded-export-btn:hover {
    background: var(--auth-accent-hover, #107a7e);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.embedded-export-btn i {
    font-size: 13px;
}

/* === DATATABLES STYLING === */
#embedded-results-datatable {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 14px;
}

#embedded-results-datatable thead th {
    /* Man2025 → Colours of → Header Table Interface */
    background: var(--ui-table-header, #17a2b8) !important;
    color: white !important;
    font-weight: 600;
    padding: 15px 10px;
    border: none !important;
    text-align: center;
}

#embedded-results-datatable tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

#embedded-results-datatable tbody tr:hover {
    background-color: #f8f9fa !important;
}

.text-center {
    text-align: center !important;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: none !important;
    background: #f8f9fa !important;
    color: #333 !important;
    margin: 0 2px;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    transition: all 0.3s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #667eea !important;
    color: white !important;
    transform: translateY(-1px);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #667eea !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_info {
    color: #666;
    font-size: 14px;
    padding-top: 10px;
}

.dt-buttons {
    margin-bottom: 15px;
}

.dt-buttons .btn {
    margin-right: 10px;
    padding: 8px 15px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.dt-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* === RESPONSIVITATE MOBILE === */
@media screen and (max-width: 768px) {
    .embedded-main-grid {
        grid-template-columns: 1fr;
    }
    .reports-modal-content {
        width: 98%;
        height: 95%;
        margin: 1% auto;
    }
    
    .results-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        border-radius: 0;
    }
    
    .results-table {
        min-width: 600px;
        font-size: 13px;
    }
    
    .results-table th,
    .results-table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    .results-table th {
        font-size: 11px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: linear-gradient(135deg, #667eea, #764ba2) !important;
        color: white;
    }
    
    .filters-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .filter-input, .filter-select, .filter-btn {
        width: 100%;
        margin: 0;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 20px !important;
    }
    
    .stat-label {
        font-size: 11px !important;
    }
    
    .statistics-container {
        grid-template-columns: 1fr;
    }
    
    .embedded-stats-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .embedded-stat-card {
        padding: 10px 12px;
    }
    
    .embedded-chart-export-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .embedded-chart-section,
    .embedded-export-section {
        flex: none;
        min-width: auto;
        max-width: none;
    }
    
    .embedded-export-buttons {
        justify-content: center;
        gap: 8px;
    }
    
    .embedded-export-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    #embedded-results-datatable {
        font-size: 12px;
    }
    
    #embedded-results-datatable thead th,
    #embedded-results-datatable tbody td {
        padding: 8px 6px;
    }
    
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        margin-bottom: 10px;
    }
    
    .dt-buttons .btn {
        margin-right: 5px;
        margin-bottom: 5px;
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media screen and (max-width: 480px) {
    .reports-modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .reports-header {
        padding: 15px 20px;
    }
    
    .reports-header h2 {
        font-size: 18px;
    }
    
    .results-table {
        min-width: 500px;
        font-size: 12px;
    }
    
    .results-table th,
    .results-table td {
        padding: 8px 6px;
    }
    
    .results-table th {
        font-size: 10px;
    }
    
    .results-table td:first-child {
        min-width: 80px;
        font-size: 10px;
    }
    
    .results-table td:nth-child(2) {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 11px;
    }
    
    .results-table td:nth-child(3) {
        min-width: 40px;
        text-align: center;
    }
    
    .score-badge {
        padding: 2px 8px;
        font-size: 10px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .reports-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding-bottom: 5px;
    }
    
    .reports-tab-btn {
        font-size: 12px;
        padding: 8px 12px;
        display: inline-block;
        min-width: 80px;
    }
}
