/**
 * Layer 114: Interactive Infographics Engine
 * Modern, clean, and interactive data visualization styles
 */

/* Container */
.infographic-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin: 30px 0;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: transform 0.3s ease;
}

.infographic-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.infographic-header {
    background: #f8fafc;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.infographic-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-view {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.toggle-view:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.show-table .chart-view {
    display: none;
}

.show-table .table-view {
    display: block !important;
    padding: 20px;
}

.show-table .icon-chart {
    display: inline;
}

.show-table .icon-table {
    display: none;
}

.infographic-container:not(.show-table) .icon-chart {
    display: none;
}

.infographic-container:not(.show-table) .icon-table {
    display: inline;
}

.infographic-body {
    padding: 25px;
}

/* ================= BAR CHART ================= */

.ig-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ig-bar-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ig-bar-label {
    width: 120px;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ig-bar-track {
    flex: 1;
    background: #f1f5f9;
    height: 24px;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    /* Only the track clips */
    display: flex;
    align-items: center;
}

.ig-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
}

.ig-bar-value {
    position: absolute;
    right: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    z-index: 2;
    /* If bar is long enough, we could make text white inside bar, 
       but for simplicity keeping it right-aligned works well */
}

/* ================= PIE / DOUGHNUT CHART ================= */

.ig-circular-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.ig-pie-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    /* Background set by JS conic-gradient */
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
    /* Outline */
}

.ig-pie-chart.doughnut .ig-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background: white;
    border-radius: 50%;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ig-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ig-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.ig-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ig-label {
    color: #475569;
    font-weight: 500;
}

.ig-val {
    color: #1e293b;
    font-weight: 700;
    margin-left: auto;
}

/* Responsive */
@media (max-width: 600px) {
    .ig-bar-row {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }

    .ig-bar-label {
        width: 100%;
        text-align: left;
    }

    .ig-circular-layout {
        flex-direction: column;
        gap: 20px;
    }
}

/* Print Handling */
@media print {
    .infographic-container {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .toggle-view {
        display: none;
    }
}