/* statistics.css */

/* Shared statistics cards */
.reading-dashboard .stat-box {
    position: relative;
    height: auto;
    margin-bottom: 1.5rem;
    padding: 1.4rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(24, 21, 17, 0.08);
    border-radius: 20px;
    box-shadow: 0 16px 36px rgba(24, 21, 17, 0.07);
}

.reading-dashboard .stat-box.h-100 {
    height: 100% !important;
    margin-bottom: 0;
}

.reading-dashboard .stat-box::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #d9b15f, #77a36a 52%, #6ca7b5);
    content: "";
    opacity: 0.7;
}

.reading-dashboard .stat-box h2,
.reading-dashboard .stat-box h3 {
    margin: 0 0 1rem !important;
    color: var(--ink);
    font-size: clamp(1.18rem, 1.8vw, 1.45rem);
    font-weight: 800;
    line-height: 1.2;
}

.reading-dashboard .stat-box > .text-muted,
.reading-dashboard .stat-box > h3 + p {
    margin: -0.55rem 0 1.2rem;
    color: var(--muted) !important;
    font-size: 0.9rem;
    line-height: 1.5;
}

.reading-dashboard .stat-box .table {
    width: 100%;
    margin: 0;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
    border: 1px solid rgba(24, 21, 17, 0.07);
    border-radius: 14px;
}

.reading-dashboard .stat-box .table > :not(caption) > * > * {
    padding: 0.78rem 0.9rem;
    background: rgba(255, 249, 233, 0.52);
    border-bottom: 1px solid rgba(24, 21, 17, 0.07);
    color: var(--ink);
    vertical-align: middle;
}

.reading-dashboard .stat-box .table > :not(caption) > *:nth-child(even) > * {
    background: rgba(240, 247, 233, 0.55);
}

.reading-dashboard .stat-box .table > :not(caption) > *:last-child > * {
    border-bottom: 0;
}

.reading-dashboard .stat-box .table th {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.reading-dashboard .stat-box .table td:last-child,
.reading-dashboard .stat-box .table th:last-child,
.reading-dashboard .stat-box .table .text-right {
    text-align: right;
}

.reading-dashboard .stat-box .table td:last-child:not(:only-child) {
    color: var(--accent-dark);
    font-weight: 800;
    white-space: nowrap;
}

.reading-dashboard .stat-box .table a {
    color: var(--ink);
    font-weight: 700;
    text-decoration-color: rgba(66, 117, 62, 0.3);
    text-underline-offset: 0.18em;
}

.reading-dashboard .stat-box .table a:hover {
    color: var(--accent-dark);
    text-decoration-color: currentColor;
}

.reading-dashboard .stat-box canvas {
    max-width: 100%;
}

.reading-dashboard > .row + .row {
    margin-top: 0;
}

@media (max-width: 767.98px) {
    .reading-dashboard .stat-box,
    .reading-dashboard .stat-box.h-100 {
        height: auto !important;
        margin-bottom: 0;
        padding: 1.1rem;
    }

    .reading-dashboard .row.g-4 + .row.g-4 {
        margin-top: 0;
    }

    .reading-dashboard .stat-box .table > :not(caption) > * > * {
        padding: 0.7rem 0.75rem;
    }
}

.stats-overview-card {
    height: 100%;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(24, 21, 17, 0.08);
    border-radius: 20px;
    box-shadow: 0 16px 36px rgba(24, 21, 17, 0.08);
}

.stats-overview-header {
    margin-bottom: 1.25rem;
}

.stats-overview-header h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2vw, 1.75rem);
}

.stats-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.stats-metric-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-metric-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-metric-grid--five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stats-metric {
    min-width: 0;
    padding: 1rem;
    background: #fff9e9;
    border: 1px solid #eadbb0;
    border-radius: 15px;
}

.stats-metric:nth-child(4n + 2) {
    background: #f0f7e9;
    border-color: #d4e2c8;
}

.stats-metric:nth-child(4n + 3) {
    background: #faf1e9;
    border-color: #e5d8cc;
}

.stats-metric:nth-child(4n + 4) {
    background: #eaf6f5;
    border-color: #c9e0de;
}

.stats-metric--wide {
    grid-column: 1 / -1;
}

.stats-metric--span-two {
    grid-column: span 2;
}

.stats-metric dt {
    margin-bottom: 0.4rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.3;
    text-transform: uppercase;
}

.stats-metric dd {
    margin: 0;
    color: var(--ink);
    font-family: "DM Serif Display", Georgia, serif;
    font-size: clamp(1.55rem, 3vw, 2.1rem);
    line-height: 1;
}

.stats-metric dd small {
    color: var(--muted);
    font-family: "DM Sans", "Segoe UI", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
}

@media (max-width: 420px) {
    .stats-overview-card {
        padding: 1rem;
    }

    .stats-metric-grid {
        grid-template-columns: 1fr;
    }

    .stats-metric--wide {
        grid-column: auto;
    }

    .stats-metric--span-two {
        grid-column: auto;
    }
}

@media (min-width: 421px) and (max-width: 767.98px) {
    .stats-metric-grid--three,
    .stats-metric-grid--four,
    .stats-metric-grid--five {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .stats-metric-grid--four,
    .stats-metric-grid--five {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.stat-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.3rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

/* Scoped grid for achievements only */
.achievement-section {
    margin-bottom: 2rem;
}

.achievement-section .achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.achievement-section .achievement-card {
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    height: 100%;
    /*box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);*/
    transition: box-shadow 0.2s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.achievement-section .achievement-description {
    flex-grow: 1;
    text-align: center;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.achievement-section .achievement-date {
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 1rem;
}

.stat-card {
    border-radius: 1rem;
    padding: 1.2rem;
    transition: box-shadow 0.2s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-title {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: #495057;
}

.stat-value.emotional {
    color: #c0392b;
}

.stat-value.progress {
    color: #2e86de;
}

.stat-value.highlight {
    color: #16a085;
}

.badge-pastel, .badge-reason, .badge-impression {
    padding: 0.5em 0.75em;
    font-size: 0.85rem;
    border-radius: 0.5rem;
    font-weight: 500;
}
