/**
 * puzzle-stats.css - גרסה מעודכנת עם אנימציית מונה
 * עיצוב למודול סטטיסטיקות חידות שחמט - עם סלקטורים ספציפיים למניעת השפעה גלובלית
 */

/* === אנימציות === */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes bounceIn {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.3); 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.05); 
    }
    100% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
    }
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateX(100%); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes slideOut {
    from { 
        opacity: 1; 
        transform: translateX(0); 
    }
    to { 
        opacity: 0; 
        transform: translateX(100%); 
    }
}

/* === אנימציית מונה מהלכים חדשה === */
@keyframes moveCounterPulse {
    0% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.2);
    }
    25% {
        transform: scale(1.4);
        background: rgba(255, 255, 255, 0.35);
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    50% {
        transform: scale(1.1);
        background: rgba(255, 255, 255, 0.3);
    }
    100% {
        transform: scale(1);
        background: rgba(0, 0, 0, 0.2);
    }
}

/* === תצוגת סטטיסטיקות בכותרת === */
.puzzle-author.stats-display-mode {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    font-size: 16px;
    width: 100%;
}

.puzzle-author .stats-timer, 
.puzzle-author .stats-moves {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    transition: transform 0.3s ease, background 0.3s ease;
}

/* מצב אנימציה למונה המהלכים */
.puzzle-author .stats-moves.move-updated {
    animation: moveCounterPulse 1.3s ease;
}

.puzzle-author .stats-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    color: white;
    font-family: inherit; /* השתמש בפונט של ההורה ולא כפה פונט */
}

.puzzle-author .stats-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* === Tooltip בסיסי - ספציפי למודול === */
.stats-tooltip {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px 12px 3px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 350px;
    animation: fadeIn 0.3s ease;
    /* פונט ספציפי רק לtooltip */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    color: #333;
    font-size: 14px; /* גודל פונט בסיסי */
}

.stats-tooltip.success {
    background: linear-gradient(135deg, #fff 0%, #f0fff0 100%);
    border: 2px solid #28a745;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    animation: bounceIn 0.5s ease;
}

/* === תוכן הסטטיסטיקות - עם סלקטורים ספציפיים === */
.stats-tooltip .stats-content {
    color: #333 !important;
    line-height: 1.6;
    font-family: inherit !important;
}

.stats-tooltip .stats-content * {
    color: inherit !important;
    font-family: inherit !important;
}

.stats-tooltip .stats-content h4 {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50 !important;
    border-bottom: 2px solid #e1e4e8;
    padding-bottom: 5px;
}

.stats-tooltip .personal-stats,
.stats-tooltip .puzzle-stats {
    margin-bottom: 16px;
    color: #333 !important;
}

.stats-tooltip .personal-stats:last-child,
.stats-tooltip .puzzle-stats:last-child {
    margin-bottom: 0;
}

.stats-tooltip .personal-stats div,
.stats-tooltip .puzzle-stats div {
    padding: 3px 0;
    color: #333 !important;
}

.stats-tooltip .personal-stats small,
.stats-tooltip .puzzle-stats small {
    display: block;
    margin-top: 2px;
    color: #666 !important;
    font-size: 12px;
    margin-left: 9px;
}

.stats-tooltip .achievement-item {
    background: rgba(40, 167, 69, 0.1);
    padding: 1px 5px !important;
    border-radius: 4px;
    margin: 4px 0;
    border-left: 3px solid #28a745;
    color: #333 !important;
}

/* === הודעת הצלחה === */
.stats-tooltip .success-title {
    font-size: 20px;
    font-weight: bold;
    color: #28a745 !important;
    margin-bottom: 16px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.stats-tooltip .stats-details {
    font-size: 15px;
    line-height: 1.8;
    color: #333 !important;
}

.stats-tooltip .stats-details > div {
    margin: 6px 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    color: #333 !important;
}

.stats-tooltip .comparison {
    margin-top: 12px;
    padding: 12px;
    border-radius: 6px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1 !important;
    font-weight: 500;
    border: 1px solid #bae6fd;
    line-height: 1.6;
}

/* === התראות - עם סלקטור ספציפי === */
.stats-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white !important;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}


/* === Responsive === */
@media (max-width: 640px) {
  /* טולטיפ רגיל ליד הכפתור */
  .stats-tooltip:not(.success) {
    max-width: 90vw;
    left: 5vw !important;
    right: 5vw !important;
  }

  /* פופ-אפ הצלחה במובייל — מיושר למרכז המסך ללא גלישה */
  .stats-tooltip.success {
    width: 92vw;
    max-width: 92vw;
    left: 50% !important;
    right: auto !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-height: 80vh;
    overflow-y: auto;
  }

  .puzzle-author.stats-display-mode {
    font-size: 14px;
    gap: 8px;
  }

  .puzzle-author .stats-timer, 
  .puzzle-author .stats-moves, 
  .puzzle-author .stats-button {
    padding: 1px 6px;
    font-size: 14px;
  }
  
  /* אנימציה קטנה יותר במובייל */
  @keyframes moveCounterPulse {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.4);
    }
  }
}


/* === תצוגת השלמת החידה === */
.puzzle-author.completed-display-mode {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    font-size: 16px;
    width: 100%;
}

.puzzle-completed-icon {
    font-size: 18px;
    animation: fadeIn 0.5s ease;
}

.puzzle-author-text {
    color: inherit;
    font-weight: normal;
}

/* === אינדיקטור רמז נצפה === */
.hint-viewed-indicator {
    font-size: 16px;
    opacity: 0.7;
    margin-right: 8px;
    cursor: help;
    animation: fadeIn 0.3s ease;
}

.hint-viewed-indicator:hover {
    opacity: 1;
}

/* הודעה על רמז בתוך tooltip */
.stats-tooltip .hint-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 10px 0;
    color: #856404;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-tooltip .hint-notice::before {
    content: "📋";
    font-size: 16px;
}

/* === הודעות בconsole (לdebug) === */
@media print {
    .hint-viewed-indicator,
    .stats-notification {
        display: none;
    }
}