/* word_stats.css — Styles for the Word Statistics page */

/* ── Page Layout ─────────────────────────────────────────────────────────── */
body {
    background-color: #fff5ec;
}

.stats-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #888;
    text-decoration: none;
    margin-bottom: 20px;
    font-weight: bold;
}
.back-link:hover { color: #333; }

/* ── Metric Cards ─────────────────────────────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    text-align: center;
    border: 2px solid transparent;
}

.metric-value {
    font-size: 2.2em;
    font-weight: 800;
    display: block;
    margin: 10px 0;
    color: #333;
}

.metric-label {
    font-size: 0.9em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-coverage { border-color: lightgreen; }
.card-imw      { border-color: #5d9cec; }
.card-today    { border-color: var(--color-primary); }
.card-total    { border-color: #ddd; }

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

.chart-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
}

.chart-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1em;
    color: #555;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Chart Toggle ─────────────────────────────────────────────────────────── */
.chart-toggle-group {
    display: flex;
    background: #f1f3f5;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.toggle-btn {
    border: none;
    background: transparent;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: white;
    color: #2c3e50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* ── Word Lists ───────────────────────────────────────────────────────────── */
.details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.data-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.data-card h3 { margin-top: 0; color: #333; }

.top-words-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.word-tag {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #eee;
}

.word-tag-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.word-tag strong      { color: #333; font-size: 1em; }
.word-tag-langs       { font-size: 0.8em; color: #888; display: flex; gap: 8px; flex-wrap: wrap; }
.word-tag-langs span  { white-space: nowrap; }

.word-count {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #666;
    white-space: nowrap;
}

/* ── Progress Bar ─────────────────────────────────────────────────────────── */
.progress-bar-container {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-bar {
    height: 100%;
    transition: width 0.5s ease-out;
}

/* ── Local Modal (word_stats only) ────────────────────────────────────────── */
/* Removed */

/* ── Edit Button ──────────────────────────────────────────────────────────── */
.edit-btn {
    cursor: pointer;
    font-size: 0.6em;
    vertical-align: middle;
    margin-left: 10px;
    color: #9b59b6;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.edit-btn:hover { opacity: 1; }

/* ── Help Tooltip ─────────────────────────────────────────────────────────── */
.card-relative { position: relative; }

.metric-card .help-trigger,
.chart-card .help-trigger,
.data-card .help-trigger {
    position: absolute;
    top: 10px; right: 10px;
    width: 18px; height: 18px;
    background: #eee;
    color: #999;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
    font-weight: bold;
    border: 1px solid #ddd;
}

.metric-card:hover .help-trigger,
.chart-card:hover  .help-trigger,
.data-card:hover   .help-trigger { opacity: 1; }

.metric-card .help-trigger:hover,
.chart-card  .help-trigger:hover,
.data-card   .help-trigger:hover { background: #9b59b6; color: white; border-color: #8e44ad; }

#help-popup {
    display: none;
    position: absolute;
    z-index: 999999;
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85em;
    max-width: 250px;
    line-height: 1.4;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#help-popup::after {
    content: "";
    position: absolute;
    bottom: -6px; left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(44, 62, 80, 0.95) transparent transparent transparent;
}

#help-popup.popup-below::after {
    bottom: auto; top: -6px;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent rgba(44, 62, 80, 0.95) transparent;
}
