/* ================================
   Reports & Visualization Styles
   ================================ */

/* Common Report Styles */
.reports-dashboard,
.detailed-report,
.comparison-report {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}

.page-header .header-content h1 {
    margin: 0 0 5px 0;
    font-size: 2rem;
    color: #212529;
}

.page-header .subtitle {
    margin: 0;
    font-size: 1.1rem;
    color: #6c757d;
}

.page-header .assessment-date {
    margin: 5px 0 0 0;
    font-size: 0.95rem;
    color: #6c757d;
}

.page-header .header-actions {
    display: flex;
    gap: 10px;
}

/* Summary Cards Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.summary-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: flex-start;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.summary-card .card-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.summary-card.overall-score .card-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.summary-card.completion .card-icon {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.summary-card.gaps .card-icon {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    color: white;
}

.summary-card.actions .card-icon {
    background: linear-gradient(135deg, #007bff 0%, #17a2b8 100%);
    color: white;
}

.summary-card .card-content {
    flex: 1;
}

.summary-card .card-content h3 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card .score-value {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
}

.summary-card .gap-breakdown,
.summary-card .action-breakdown {
    margin-top: 5px;
    font-size: 0.85rem;
    display: flex;
    gap: 10px;
}

.summary-card .gap-breakdown .critical {
    color: #dc3545;
    font-weight: 600;
}

.summary-card .gap-breakdown .important {
    color: #ffc107;
    font-weight: 600;
}

/* Info Tooltips */
.info-tooltip {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.tooltip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: help;
    transition: all 0.2s;
}

.tooltip-icon:hover {
    background: #495057;
    transform: scale(1.1);
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 30px;
    right: 0;
    width: 280px;
    background: #212529;
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s;
    z-index: 100;
    pointer-events: none;
}

.tooltip-text::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 8px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #212529;
}

.info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.3rem;
    color: #212529;
}

.chart-description {
    margin: 0 0 20px 0;
    font-size: 0.9rem;
    color: #6c757d;
}

.chart-wrapper {
    position: relative;
    height: 350px;
}

.chart-wrapper canvas {
    max-height: 100%;
}

/* Dimension Scores Section */
.dimension-scores-section {
    margin-bottom: 40px;
}

.dimension-scores-section h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    color: #212529;
}

.dimension-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.dimension-score-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.dimension-score-card .dimension-code {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 8px;
    flex-shrink: 0;
}

.dimension-score-card .dimension-info {
    flex: 1;
}

.dimension-score-card h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #212529;
}

.dimension-score-card .score-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dimension-score-card .score-bar-wrapper {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.dimension-score-card .score-bar {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    transition: width 0.3s ease;
}

.dimension-score-card .score-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: #212529;
    min-width: 55px;
    text-align: right;
}

/* Assessment History */
.history-section {
    margin-bottom: 40px;
}

.history-section h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    color: #212529;
}

.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: 150px 100px 120px auto;
    align-items: center;
    gap: 20px;
}

.history-item.current {
    border: 2px solid #007bff;
}

.history-date {
    font-weight: 600;
    color: #212529;
}

.history-score {
    font-weight: 600;
}

/* Detailed Report Styles */
.report-header {
    text-align: center;
    margin-bottom: 40px;
}

.executive-summary {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.executive-summary h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    color: #212529;
}

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

.metric {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.metric label {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #212529;
}

.metric-value.high {
    color: #28a745;
}

.metric-value.medium {
    color: #ffc107;
}

.metric-value.low {
    color: #dc3545;
}

.metric-value.critical {
    color: #dc3545;
}

.metric-value.important {
    color: #ffc107;
}

.summary-text {
    font-size: 1rem;
    line-height: 1.6;
    color: #495057;
}

.critical-alert {
    background: #fff3cd;
    border-left: 4px solid #dc3545;
    padding: 15px;
    margin-top: 15px;
    border-radius: 4px;
}

/* Dimension Breakdown */
.dimension-breakdown {
    margin-bottom: 40px;
}

.dimension-report-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dimension-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.dimension-title-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dimension-title-row .dimension-code {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
}

.dimension-title-row h3 {
    flex: 1;
    margin: 0;
    font-size: 1.3rem;
    color: #212529;
}

.dimension-title-row .dimension-score {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 6px;
    background: #f8f9fa;
}

.dimension-title-row .dimension-score.high {
    color: #28a745;
    background: #d4edda;
}

.dimension-title-row .dimension-score.medium {
    color: #856404;
    background: #fff3cd;
}

.dimension-title-row .dimension-score.low {
    color: #dc3545;
    background: #f8d7da;
}

.dimension-description {
    margin: 10px 0 0 0;
    color: #6c757d;
    font-size: 0.95rem;
}

.category-section {
    margin-bottom: 30px;
}

.category-section h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #495057;
    padding-left: 10px;
    border-left: 3px solid #007bff;
}

/* Responses Table */
.responses-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.responses-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.responses-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.responses-table .item-text {
    font-size: 0.95rem;
    color: #212529;
}

.responses-table .status-cell,
.responses-table .priority-cell {
    text-align: center;
    white-space: nowrap;
}

.responses-table .notes-cell {
    font-size: 0.9rem;
    color: #6c757d;
    max-width: 300px;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.status-complete {
    background: #d4edda;
    color: #155724;
}

.badge.status-in_progress {
    background: #cce5ff;
    color: #004085;
}

.badge.status-not_started {
    background: #e2e3e5;
    color: #383d41;
}

.badge.status-not_applicable {
    background: #f8f9fa;
    color: #6c757d;
}

.badge.priority-critical {
    background: #f8d7da;
    color: #721c24;
}

.badge.priority-important {
    background: #fff3cd;
    color: #856404;
}

.badge.priority-beneficial {
    background: #d4edda;
    color: #155724;
}

.badge.pending,
.badge.status-pending {
    background: #e2e3e5;
    color: #383d41;
}

.badge.in_progress,
.badge.status-in_progress {
    background: #cce5ff;
    color: #004085;
}

.badge.completed,
.badge.status-completed {
    background: #d4edda;
    color: #155724;
}

/* Gaps Summary */
.gaps-summary {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.gaps-summary h2 {
    margin: 0 0 10px 0;
    font-size: 1.4rem;
    color: #212529;
}

.gaps-summary .section-intro {
    margin: 0 0 20px 0;
    color: #6c757d;
    font-size: 0.95rem;
}

.gaps-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gap-item {
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid;
}

.gap-item.critical {
    background: #fff5f5;
    border-left-color: #dc3545;
}

.gap-item.important {
    background: #fffef5;
    border-left-color: #ffc107;
}

.gap-item.beneficial {
    background: #f0fdf4;
    border-left-color: #28a745;
}

.gap-header {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.gap-dimension {
    color: #6c757d;
    font-weight: 600;
}

.gap-category {
    color: #6c757d;
}

.gap-text {
    font-size: 1rem;
    color: #212529;
    margin-bottom: 8px;
}

.gap-notes {
    font-size: 0.9rem;
    color: #495057;
}

/* Action Items Section */
.action-items-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.action-items-section h2 {
    margin: 0 0 10px 0;
    font-size: 1.4rem;
    color: #212529;
}

.action-items-section .section-intro {
    margin: 0 0 20px 0;
    color: #6c757d;
    font-size: 0.95rem;
}

.action-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.action-item {
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid;
    background: #f8f9fa;
}

.action-item.critical {
    border-left-color: #dc3545;
}

.action-item.important {
    border-left-color: #ffc107;
}

.action-item.beneficial {
    border-left-color: #28a745;
}

.action-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.action-timeline {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 600;
}

.action-description {
    font-size: 1rem;
    color: #212529;
    margin-bottom: 8px;
}

.action-service {
    font-size: 0.9rem;
    color: #495057;
}

/* Report Footer */
.report-footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 2px solid #dee2e6;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.report-footer p {
    margin: 5px 0;
}

/* Comparison Report Styles */
.comparison-summary {
    margin-bottom: 40px;
}

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

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #212529;
}

.chart-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Comparison Table */
.comparison-table-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.comparison-table-section h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    color: #212529;
}

.table-responsive {
    overflow-x: auto;
}

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

.comparison-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.85rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.comparison-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

.comparison-table .client-name {
    font-weight: 600;
    color: #212529;
}

.comparison-table .overall-score {
    text-align: center;
}

.comparison-table .dimension-score {
    text-align: center;
}

.comparison-table .score-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 700;
}

.comparison-table .score-badge.high {
    background: #d4edda;
    color: #155724;
}

.comparison-table .score-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.comparison-table .score-badge.low {
    background: #f8d7da;
    color: #721c24;
}

.comparison-table .score-mini {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
}

.comparison-table .score-mini.high {
    background: #d4edda;
    color: #155724;
}

.comparison-table .score-mini.medium {
    background: #fff3cd;
    color: #856404;
}

.comparison-table .score-mini.low {
    background: #f8d7da;
    color: #721c24;
}

/* Dimension Comparison Cards */
.dimension-comparison-section {
    margin-bottom: 40px;
}

.dimension-comparison-section h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    color: #212529;
}

.dimension-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.dimension-comparison-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dimension-comparison-card h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #212529;
}

.client-scores-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.client-score-row {
    display: grid;
    grid-template-columns: 120px 1fr 60px;
    align-items: center;
    gap: 10px;
}

.client-name-short {
    font-size: 0.9rem;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-bar-container {
    height: 20px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-container .score-bar {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.client-score-row .score-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    text-align: right;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.empty-state p {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    color: #6c757d;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .dimension-scores-grid {
        grid-template-columns: 1fr;
    }

    .history-item {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .summary-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .chart-section {
        grid-template-columns: 1fr;
    }

    .dimension-cards-grid {
        grid-template-columns: 1fr;
    }

    .comparison-table {
        font-size: 0.85rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px 6px;
    }
}

/* Print Styles */
@media print {
    @page {
        margin: 1cm;
    }

    body {
        font-size: 11pt;
        line-height: 1.4;
    }

    .no-print,
    .header-actions,
    .btn {
        display: none !important;
    }

    .page-header {
        page-break-after: avoid;
    }

    .summary-card,
    .dimension-report-card,
    .gap-item,
    .action-item {
        page-break-inside: avoid;
    }

    .chart-wrapper {
        height: auto !important;
    }

    a[href]:after {
        content: none !important;
    }
}
