/**
 * POE2 Vote Widget - Styles Frontend
 * Widget de vote intégré aux articles builds
 *
 * @package AutoArticle
 * @since 1.7.0
 */

/* ============================================
   CONTAINER PRINCIPAL - VERSION COMPACTE
   ============================================ */

.poe2-vote-widget-container {
    margin: 20px 0 8px 0;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 12px;
}

.poe2-vote-widget {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   COLONNE GAUCHE - STATISTIQUES
   ============================================ */

.poe2-vote-stats {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.poe2-vote-stats-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.poe2-vote-stats-header .poe2-vote-icon {
    font-size: 14px;
}

.poe2-vote-stats-header .poe2-vote-title {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Critères stats */
.poe2-vote-criteria-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.poe2-vote-criterion-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.poe2-vote-criterion-stat .poe2-criterion-label {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 95px;
    color: #b8b8b8;
    font-size: 10px;
}

.poe2-vote-criterion-stat .poe2-criterion-icon {
    font-size: 12px;
}

.poe2-vote-criterion-stat .poe2-criterion-bar-wrapper {
    flex: 1;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.poe2-vote-criterion-stat .poe2-criterion-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    min-width: 30px;
    transition: width 0.6s ease-out;
}

.poe2-vote-criterion-stat .poe2-criterion-value {
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.poe2-vote-criterion-stat .poe2-criterion-tier {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
    color: #fff;
    line-height: 1;
    text-align: center;
}

/* Tier global */
.poe2-vote-global {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.poe2-vote-tier-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.poe2-tier-label {
    color: #888;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.poe2-tier-badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: 800;
    font-size: 12px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.poe2-vote-count {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.poe2-count-value {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.poe2-count-label {
    font-size: 8px;
    color: #888;
    text-transform: uppercase;
}

/* Message votes restants */
.poe2-votes-remaining {
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(244, 67, 54, 0.15);
    border-radius: 3px;
    text-align: center;
    font-size: 9px;
    color: #f44336;
    font-weight: 500;
}

.poe2-votes-remaining.hidden {
    display: none;
}

/* ============================================
   COLONNE DROITE - INTERFACE DE VOTE
   ============================================ */

.poe2-vote-interface {
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.poe2-vote-interface-header {
    display: none; /* Masquer le header pour économiser de l'espace */
}

/* Critères de vote */
.poe2-vote-criteria {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.poe2-vote-criterion {
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.poe2-criterion-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.poe2-vote-criterion .poe2-criterion-label {
    min-width: 90px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
}

.poe2-vote-buttons {
    display: flex;
    gap: 4px;
}

.poe2-vote-btn {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #fff;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.poe2-vote-btn:hover {
    opacity: 1;
    transform: scale(1.08);
}

.poe2-vote-btn.selected {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 8px currentColor;
}

.poe2-vote-btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.poe2-criterion-hint {
    font-size: 8px;
    color: #555;
    margin-left: auto;
    white-space: nowrap;
}

/* ============================================
   BOUTONS DE TIER (COULEURS)
   ============================================ */

.tier-s, .poe2-vote-btn.tier-s {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000 !important;
}

.tier-a, .poe2-vote-btn.tier-a {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
}

.tier-b, .poe2-vote-btn.tier-b {
    background: linear-gradient(135deg, #2196F3 0%, #1565C0 100%);
}

.tier-c, .poe2-vote-btn.tier-c {
    background: linear-gradient(135deg, #FF9800 0%, #E65100 100%);
}

.tier-d, .poe2-vote-btn.tier-d {
    background: linear-gradient(135deg, #f44336 0%, #c62828 100%);
}

.tier-none, .poe2-tier-badge.tier-none {
    background: rgba(255, 255, 255, 0.2);
    color: #888 !important;
}

/* ============================================
   BOUTON DE VALIDATION - Style Outline Doré
   ============================================ */

.poe2-vote-actions {
    margin-top: 8px;
}

/* Animation glow doré (comme le Hub) */
@keyframes voteLegendaryGlow {
    0%, 100% { box-shadow: 0 0 8px 2px rgba(245, 158, 11, 0.4), inset 0 0 4px rgba(245, 158, 11, 0.1); }
    50% { box-shadow: 0 0 16px 4px rgba(245, 158, 11, 0.7), inset 0 0 8px rgba(245, 158, 11, 0.2); }
}

.poe2-vote-submit {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #f59e0b;
    border-radius: 5px;
    background: linear-gradient(135deg, #1a1a2e, #252540);
    color: #fbbf24;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: voteLegendaryGlow 2s ease-in-out infinite;
}

.poe2-vote-submit:hover:not(:disabled) {
    transform: scale(1.02);
    border-color: #fbbf24;
    color: #fde047;
}

.poe2-vote-submit:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: #666;
    border-color: #444;
    cursor: not-allowed;
    animation: none;
}

.poe2-vote-submit.ready {
    border-color: #4CAF50;
    color: #4CAF50;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 8px 2px rgba(76, 175, 80, 0.4); }
    50% { box-shadow: 0 0 16px 4px rgba(76, 175, 80, 0.7); }
}

/* ============================================
   FEEDBACK
   ============================================ */

.poe2-vote-feedback {
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 500;
}

.poe2-vote-feedback.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.poe2-vote-feedback.error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.poe2-vote-feedback.already-voted {
    background: rgba(255, 152, 0, 0.2);
    color: #FF9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

/* ============================================
   BOUTON GRAPHIQUE
   ============================================ */

.poe2-vote-graph-toggle {
    display: flex;
    justify-content: center;
    margin-top: -1px;
}

.poe2-graph-btn {
    padding: 5px 14px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 6px 6px;
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.poe2-graph-btn:hover {
    background: linear-gradient(135deg, #2a2a4e 0%, #26315e 100%);
}

.poe2-graph-icon {
    font-size: 10px;
}

/* ============================================
   MODAL GRAPHIQUE
   ============================================ */

.poe2-vote-graph-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.poe2-vote-graph-modal.visible {
    opacity: 1;
    visibility: visible;
}

.poe2-graph-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.poe2-vote-graph-modal.visible .poe2-graph-modal-content {
    transform: scale(1);
}

.poe2-graph-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.poe2-graph-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.poe2-graph-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.poe2-graph-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.poe2-graph-modal-body {
    padding: 24px;
}

.poe2-graph-bars {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 200px;
    gap: 20px;
    margin-bottom: 24px;
}

.poe2-graph-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.poe2-graph-bar {
    width: 100%;
    max-width: 80px;
    background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    min-height: 30px;
    height: var(--bar-height, 0%);
    transition: height 0.6s ease-out;
}

.poe2-graph-bar-wrapper[data-criterion="bossing"] .poe2-graph-bar {
    background: linear-gradient(180deg, #f44336 0%, #c62828 100%);
}

.poe2-graph-bar-wrapper[data-criterion="mapping"] .poe2-graph-bar {
    background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
}

.poe2-graph-bar-wrapper[data-criterion="budget"] .poe2-graph-bar {
    background: linear-gradient(180deg, #FFC107 0%, #FF8F00 100%);
}

.poe2-graph-bar-value {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.poe2-graph-bar-label {
    color: #b8b8b8;
    font-size: 12px;
    text-align: center;
}

.poe2-graph-summary {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 540px) {
    .poe2-vote-widget-container {
        max-width: 100%;
    }

    .poe2-vote-widget {
        grid-template-columns: 1fr;
    }

    .poe2-vote-stats {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .poe2-criterion-hint {
        display: none;
    }
}

/* ============================================
   ÉTAT DÉJÀ VOTÉ
   ============================================ */

.poe2-vote-widget-container.already-voted .poe2-vote-interface {
    opacity: 0.6;
    pointer-events: none;
}

.poe2-vote-widget-container.already-voted .poe2-vote-btn.user-voted {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 8px currentColor;
}

/* ============================================
   ANIMATIONS
   ============================================ */

.poe2-vote-widget-container {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.poe2-vote-btn.selected {
    animation: selectPulse 0.3s ease;
}

@keyframes selectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1.15); }
}
