/* ===========================
   TOOLTIPS INFORMATIVOS
   =========================== */

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    transition: var(--transition);
    vertical-align: middle;
}

.info-icon:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.info-icon i {
    font-size: 11px;
}

/* Tooltip Container */
.tooltip-help {
    display: none;
    position: absolute;
    z-index: 1000;
    background: white;
    border: 2px solid #3b82f6;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 350px;
    width: 90vw;
    margin-top: 8px;
    animation: tooltipFadeIn 0.2s ease;
}

.tooltip-help.active {
    display: block;
}

/* Tooltip posicionamento relativo ao campo */
.form-group {
    position: relative;
}

/* Tooltip Header */
.tooltip-header {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-close {
    cursor: pointer;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    opacity: 0.8;
    transition: var(--transition);
}

.tooltip-close:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Tooltip Body */
.tooltip-body {
    padding: 16px;
    color: var(--text-primary);
    line-height: 1.6;
}

.tooltip-body > p {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
}

/* Tooltip Section */
.tooltip-section {
    background: #f0f9ff;
    padding: 12px;
    border-radius: var(--radius-md);
    margin: 12px 0;
    border-left: 3px solid #3b82f6;
}

.tooltip-section strong {
    display: block;
    margin-bottom: 8px;
    color: #1e40af;
    font-size: 14px;
}

.tooltip-section ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.tooltip-section li {
    margin: 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Tooltip Example */
.tooltip-example {
    background: #fef3c7;
    padding: 12px;
    border-radius: var(--radius-md);
    margin-top: 12px;
    border-left: 3px solid #f59e0b;
}

.tooltip-example strong {
    display: block;
    margin-bottom: 6px;
    color: #92400e;
    font-size: 14px;
}

.tooltip-example code {
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #92400e;
    font-weight: 600;
}

/* Animation */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tooltip Arrow (opcional - aponta para o campo) */
.tooltip-help::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #3b82f6;
}

/* Tooltip para campos inline (ticket médio, etc) */
.tooltip-inline {
    position: relative;
    display: inline-block;
}

/* Ajuste para mobile */
@media (max-width: 768px) {
    .tooltip-help {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90vw;
        width: 90vw;
        margin-top: 0;
    }
    
    .tooltip-help.active {
        display: block;
    }
    
    .tooltip-help::before {
        display: none;
    }
    
    /* Overlay escuro atrás do tooltip em mobile */
    .tooltip-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .tooltip-overlay.active {
        display: block;
    }
}

/* Variação de cores para diferentes contextos */
.tooltip-help.success .tooltip-header {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.tooltip-help.success .tooltip-section {
    background: #d1fae5;
    border-left-color: var(--success-color);
}

.tooltip-help.warning .tooltip-header {
    background: linear-gradient(135deg, var(--warning-color), #f59e0b);
}

.tooltip-help.warning .tooltip-section {
    background: #fef3c7;
    border-left-color: var(--warning-color);
}

/* Tooltip compacto (para campos simples) */
.tooltip-help.compact .tooltip-body {
    padding: 12px;
}

.tooltip-help.compact .tooltip-section {
    padding: 8px;
    margin: 8px 0;
}

/* Tooltip com imagem/exemplo visual */
.tooltip-visual {
    margin: 12px 0;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    text-align: center;
}

.tooltip-visual img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

/* Link de ajuda adicional */
.tooltip-link {
    display: block;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.tooltip-link a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.tooltip-link a:hover {
    text-decoration: underline;
}

/* Indicador de tooltip disponível */
.has-tooltip {
    position: relative;
}

.has-tooltip::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
    opacity: 0.6;
}

/* Tooltip permanente (sempre visível) - para casos especiais */
.tooltip-permanent {
    display: block;
    position: static;
    max-width: 100%;
    margin-top: 8px;
    border: 2px solid #e5e7eb;
}

.tooltip-permanent .tooltip-header {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Animação de pulso para chamar atenção */
@keyframes tooltipPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
    }
}

.info-icon.pulse {
    animation: tooltipPulse 2s infinite;
}

/* Estado de carregamento */
.tooltip-loading {
    text-align: center;
    padding: 20px;
}

.tooltip-loading::after {
    content: '...';
    animation: tooltipLoading 1.5s infinite;
}

@keyframes tooltipLoading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}
