/**
 * Styles frontend pour RRC Achievements & Levels
 * 
 * @package RRC_Achievements
 * @since 1.0.0
 */

/* ============================================
   Variables CSS
   ============================================ */
:root {
    --rrc-primary-color: #0073aa;
    --rrc-secondary-color: #005177;
    --rrc-success-color: #46b450;
    --rrc-warning-color: #ffb900;
    --rrc-danger-color: #dc3232;
    --rrc-text-color: #333;
    --rrc-text-light: #666;
    --rrc-bg-color: #fff;
    --rrc-bg-light: #f5f5f5;
    --rrc-border-color: #ddd;
    --rrc-border-radius: 8px;
    --rrc-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --rrc-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --rrc-transition: all 0.3s ease;
}

/* ============================================
   Niveau du joueur
   ============================================ */
.rrc-level-wrapper {
    background: var(--rrc-bg-color);
    border: 1px solid var(--rrc-border-color);
    border-radius: var(--rrc-border-radius);
    padding: 2rem;
    margin: 0 0 2rem 0;
    box-shadow: var(--rrc-shadow);
    position: relative;
}

.rrc-level-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.rrc-level-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    padding: 1.5rem 2rem;
    border-radius: var(--rrc-border-radius);
    min-width: 120px;
    flex-shrink: 0;
}

/* Niveaux 1-4 : Gris */
.rrc-level-badge-gray {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* Niveaux 5-9 : Bleu */
.rrc-level-badge-blue {
    background: linear-gradient(135deg, var(--rrc-primary-color), var(--rrc-secondary-color));
}

/* Niveaux 10-15 : Rouge */
.rrc-level-badge-red {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Niveaux 16+ : Or */
.rrc-level-badge-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.rrc-level-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.rrc-level-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.rrc-xp-info {
    flex: 1;
    text-align: center;
    min-width: 200px;
    padding: 0 1rem;
}

.rrc-xp-total {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.rrc-xp-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--rrc-primary-color);
    display: block;
    line-height: 1.2;
    margin-bottom: 0;
}

.rrc-xp-label {
    font-size: 0.875rem;
    color: var(--rrc-text-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    white-space: nowrap;
    margin-top: -0.3rem;
}

.rrc-xp-next {
    font-size: 0.875rem;
    color: var(--rrc-text-light);
}

.rrc-xp-max {
    font-size: 1rem;
    color: var(--rrc-success-color);
    font-weight: 600;
}

/* Barre de progression */
.rrc-progress-bar {
    width: 100%;
    height: 30px;
    background: var(--rrc-bg-light);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    border: 2px solid var(--rrc-border-color);
}

.rrc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--rrc-primary-color), var(--rrc-secondary-color));
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease;
    padding-right: 10px;
}

.rrc-progress-text {
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Succès
   ============================================ */
.rrc-achievements-wrapper {
    margin: 2rem 0;
}

.rrc-achievements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.rrc-achievements-title {
    font-size: 1.75rem;
    margin: 0;
    color: var(--rrc-text-color);
}

.rrc-achievements-count {
    font-size: 1rem;
    color: var(--rrc-text-light);
    background: var(--rrc-bg-light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.rrc-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.rrc-achievement-card {
    background: var(--rrc-bg-color);
    border: 2px solid var(--rrc-border-color);
    border-radius: var(--rrc-border-radius);
    padding: 1.5rem;
    transition: var(--rrc-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--rrc-shadow);
}

.rrc-achievement-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--rrc-shadow-md);
}

.rrc-achievement-unlocked {
    border-color: var(--rrc-success-color);
    background: linear-gradient(135deg, #fff 0%, #f0f9f0 100%);
}

.rrc-achievement-locked {
    opacity: 0.6;
    background: var(--rrc-bg-light);
}

.rrc-achievement-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.rrc-achievement-content {
    flex: 1;
    width: 100%;
}

.rrc-achievement-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--rrc-text-color);
}

.rrc-achievement-description {
    font-size: 0.875rem;
    color: var(--rrc-text-light);
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.rrc-achievement-date {
    font-size: 0.75rem;
    color: var(--rrc-success-color);
    font-weight: 600;
    margin-top: auto;
}

.rrc-achievement-locked-badge {
    font-size: 0.75rem;
    color: var(--rrc-text-light);
    margin-top: auto;
}

.rrc-lock-icon {
    margin-right: 0.25rem;
}

/* ============================================
   Messages d'erreur
   ============================================ */
.rrc-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid var(--rrc-warning-color);
    padding: 1rem;
    border-radius: var(--rrc-border-radius);
    color: var(--rrc-text-color);
}

/* ============================================
   Responsive
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .rrc-level-header {
        gap: 1rem;
    }
    
    .rrc-xp-info {
        min-width: 180px;
        padding: 0 0.5rem;
    }
    
    .rrc-xp-value {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .rrc-level-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .rrc-level-badge {
        width: 100%;
    }
    
    .rrc-xp-info {
        width: 100%;
        min-width: auto;
        padding: 0;
    }
    
    .rrc-achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .rrc-achievements-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .rrc-level-wrapper {
        padding: 1rem;
    }
    
    .rrc-level-number {
        font-size: 2rem;
    }
    
    .rrc-xp-value {
        font-size: 1.5rem;
    }
    
    .rrc-xp-label {
        margin-top: -0.3rem;
    }
}

/* ============================================
   Statistiques du joueur
   ============================================ */
.rrc-stats-section {
    margin: 2rem 0;
}

.rrc-stats-title {
    font-size: 1.75rem;
    margin: 0;
    color: var(--rrc-text-color);
    margin-bottom: 0;
}

.rrc-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.rrc-stat-item {
    background: var(--rrc-bg-color);
    padding: 1.5rem 1rem;
    border-radius: var(--rrc-border-radius);
    text-align: center;
    border: 1px solid var(--rrc-border-color);
    transition: var(--rrc-transition);
    box-shadow: var(--rrc-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.rrc-stat-item:hover {
    box-shadow: var(--rrc-shadow-md);
    border-color: var(--rrc-primary-color);
}

.rrc-stat-icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.rrc-stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--rrc-text-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-top: 0.25rem;
}

.rrc-stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--rrc-primary-color);
    margin-top: 0.25rem;
}

/* Responsive pour les statistiques */
@media (max-width: 768px) {
    .rrc-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .rrc-stat-item {
        padding: 1.25rem 0.75rem;
    }
    
    .rrc-stat-icon {
        font-size: 1.75rem;
    }
    
    .rrc-stat-value {
        font-size: 1.75rem;
    }
    
    .rrc-stat-label {
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .rrc-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .rrc-stat-item {
        padding: 1.25rem 1rem;
    }
    
    .rrc-stats-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
}

/* ============================================
   Popup d'aide XP
   ============================================ */
.rrc-xp-help {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background: var(--rrc-primary-color);
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 0.5rem;
    vertical-align: middle;
    transition: all 0.3s ease;
}

.rrc-xp-help:hover {
    background: var(--rrc-secondary-color);
    transform: scale(1.1);
}

.rrc-xp-help-top-right {
    position: absolute;
    top: 1rem;
    right: 1rem;
    margin: 0;
    z-index: 10;
}

.rrc-help-modal {
    display: none;
    position: fixed !important;
    z-index: 999999 !important;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.rrc-help-modal.show {
    display: block !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.rrc-help-modal-content {
    background-color: #fff !important;
    margin: 0;
    padding: 2rem;
    border: 1px solid var(--rrc-border-color);
    border-radius: var(--rrc-border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    animation: slideDown 0.3s;
    z-index: 1000000 !important;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.rrc-help-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
    transition: color 0.3s ease;
}

.rrc-help-modal-close:hover,
.rrc-help-modal-close:focus {
    color: var(--rrc-text-color);
}

.rrc-help-modal-content h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--rrc-text-color);
    font-size: 1.5rem;
    font-weight: 700;
}

.rrc-help-modal-body {
    color: var(--rrc-text-color);
    line-height: 1.6;
}

.rrc-help-modal-body p {
    margin-bottom: 1rem;
}

.rrc-xp-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.rrc-xp-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--rrc-border-color);
}

.rrc-xp-list li:last-child {
    border-bottom: none;
}

.rrc-xp-list strong {
    color: var(--rrc-primary-color);
    min-width: 150px;
    display: inline-block;
}

/* Responsive pour la popup */
@media (max-width: 768px) {
    .rrc-help-modal-content {
        margin: 20% auto;
        padding: 1.5rem;
        width: 95%;
    }
    
    .rrc-help-modal-content h3 {
        font-size: 1.25rem;
    }
}

