/* ============================================
   POLISH.CSS - FASE 5 FINAL POLISH
   ============================================ */

/* ===== STATS PANEL ===== */
.stats-panel {
    padding: 1rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.stat-card--fire {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), transparent);
}

.stat-card i {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.stat-card--fire i {
    color: var(--warning);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.25rem 0;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 8px;
}

.stats-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.top-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.top-shortcut {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.top-rank {
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.top-shortcut-info {
    flex: 1;
}

.top-shortcut-info strong {
    display: block;
    color: var(--text-primary);
}

.top-shortcut-info small {
    color: var(--text-secondary);
}

.top-count {
    font-weight: 600;
    color: var(--accent);
}

.quiz-history-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 120px;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.quiz-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.quiz-bar {
    width: 100%;
    min-height: 4px;
    background: linear-gradient(180deg, var(--accent), var(--accent-hover));
    border-radius: 4px 4px 0 0;
    transition: all 0.2s;
    cursor: pointer;
}

.quiz-bar:hover {
    opacity: 0.8;
}

.quiz-bar-wrapper small {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.stats-summary {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

/* ===== SETTINGS PANEL ===== */
.settings-panel {
    padding: 1rem 0;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.theme-selector,
.toggle-group {
    display: flex;
    gap: 0.5rem;
}

.theme-option,
.toggle-option {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.theme-option:hover,
.toggle-option:hover {
    border-color: var(--accent);
}

.theme-option.active,
.toggle-option.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.settings-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: var(--bg-hover);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label span {
    color: var(--text-primary);
}

.settings-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* ===== TOOLTIPS ===== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.85rem;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    z-index: 10000;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
}

/* ===== LOADING STATES ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-line {
    height: 16px;
    margin-bottom: 0.5rem;
}

.skeleton-line.short {
    width: 60%;
}

/* ===== KEYBOARD SHORTCUTS HINT ===== */
.kbd-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background: var(--bg-primary);
    border-radius: 4px;
}

.kbd-hint kbd {
    padding: 0.1rem 0.3rem;
    font-size: 0.7rem;
}

/* ===== FOCUS INDICATORS ===== */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

button:focus-visible,
a:focus-visible {
    outline-offset: 4px;
}

/* ===== SKIP LINK ===== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* ===== SCREEN READER ONLY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== ANIMATIONS POLISH ===== */
@keyframes heartPop {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

.star-btn.active {
    animation: heartPop 0.3s ease-out;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .theme-selector {
        flex-direction: column;
    }

    .settings-actions {
        flex-direction: column;
    }

    .settings-actions button {
        width: 100%;
    }

    .quiz-history-chart {
        height: 80px;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}