/**
 * TOPCIFRAS - Estilos dos Tooltips de Acordes
 * Design limpo com fundo branco e bordas verdes
 * Versão: 1.0
 */

/* ===== ESTILO DO ACORDE ===== */
.acorde {
    color: var(--primary, #4CAF50);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    background: rgba(76, 175, 80, 0.08);
}

.acorde:hover {
    background: rgba(76, 175, 80, 0.15);
    transform: translateY(-1px);
}

.acorde.active {
    background: rgba(76, 175, 80, 0.2);
}

/* ===== TOOLTIP DO ACORDE ===== */
.acorde-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: #ffffff;
    padding: 1.2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid #4CAF50;
    min-width: 180px;
}

.acorde-tooltip.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

/* ===== SETA DO TOOLTIP ===== */
.acorde-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: #4CAF50;
}

.acorde-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #ffffff;
    z-index: 1;
    margin-top: -1px;
}

/* ===== HEADER DO TOOLTIP ===== */
.tooltip-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid rgba(76, 175, 80, 0.2);
}

.tooltip-nome {
    font-size: 1.1rem;
    color: #4CAF50;
    font-weight: 700;
    margin: 0;
}

/* ===== CANVAS DO DIAGRAMA ===== */
.tooltip-canvas {
    display: flex;
    justify-content: center;
    margin: 0.8rem 0;
    background: #fafafa;
    padding: 0.8rem;
    border-radius: 8px;
}

.tooltip-canvas canvas {
    display: block;
}

/* ===== INFO DO DEDILHADO ===== */
.tooltip-info {
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.8rem;
    font-family: 'Courier New', 'JetBrains Mono', monospace;
    font-weight: 600;
}

/* ===== BOTÃO FECHAR ===== */
.tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #999;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.tooltip-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.tooltip-close:active {
    transform: scale(0.95);
}

/* ===== RESPONSIVIDADE MOBILE ===== */
@media (max-width: 768px) {
    .acorde-tooltip {
        /* Em mobile, tooltip fica fixo na parte inferior */
        position: fixed;
        bottom: 20px !important;
        left: 50% !important;
        top: auto !important;
        right: auto !important;
        transform: translateX(-50%) scale(0.9);
        max-width: calc(100vw - 40px);
    }
    
    .acorde-tooltip.show {
        transform: translateX(-50%) scale(1);
    }
    
    /* Remove a seta no mobile */
    .acorde-tooltip::after,
    .acorde-tooltip::before {
        display: none;
    }
    
    /* Aumenta área de toque */
    .acorde {
        padding: 6px 10px;
        min-width: 32px;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .tooltip-close {
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
    }
}

/* ===== ANIMAÇÕES ADICIONAIS ===== */
@keyframes tooltipEntrada {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.8) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scale(1) translateY(0);
    }
}

.acorde-tooltip.show {
    animation: tooltipEntrada 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== DARK MODE (OPCIONAL) ===== */
@media (prefers-color-scheme: dark) {
    .acorde-tooltip {
        background: #2a2a2a;
        border-color: #4CAF50;
        color: #e0e0e0;
    }
    
    .acorde-tooltip::before {
        border-top-color: #2a2a2a;
    }
    
    .tooltip-canvas {
        background: #1a1a1a;
    }
    
    .tooltip-info {
        color: #b0b0b0;
    }
    
    .tooltip-close {
        color: #b0b0b0;
    }
    
    .tooltip-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #e0e0e0;
    }
}

/* ===== ACESSIBILIDADE ===== */
.acorde:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

.tooltip-close:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 1px;
}

/* ===== TRANSIÇÃO SUAVE PARA OVERLAY ===== */
@media (max-width: 768px) {
    body.tooltip-aberto {
        overflow: hidden;
    }
    
    .acorde-tooltip.show::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.3);
        z-index: -1;
    }
}

/* ===== PREVENT TEXT SELECTION ===== */
.acorde-tooltip {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ===== LOADING STATE (OPCIONAL) ===== */
.acorde-tooltip.loading .tooltip-canvas {
    position: relative;
}

.acorde-tooltip.loading .tooltip-canvas::before {
    content: 'Carregando...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 0.9rem;
}
