/* public/analysis-history.css */
/* 🕐 Sistema de Histórico de Análises - Estilos */

/* ═══════════════════════════════════════════════════════════════════
   🎨 PAINEL LATERAL DE HISTÓRICO
   ═══════════════════════════════════════════════════════════════════ */

.history-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.history-panel.active {
    pointer-events: all;
    opacity: 1;
    visibility: visible;
}

.history-panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.history-panel-content {
    position: absolute;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 90vw;
    height: 100%;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border-left: 1px solid rgba(139, 92, 246, 0.3);
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.history-panel.active .history-panel-content {
    right: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   📋 HEADER DO PAINEL
   ═══════════════════════════════════════════════════════════════════ */

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    background: rgba(139, 92, 246, 0.1);
}

.history-panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #e0e0ff;
    font-family: 'Rajdhani', 'Orbitron', sans-serif;
}

.history-panel-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-panel-close:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

/* ═══════════════════════════════════════════════════════════════════
   📦 BODY DO PAINEL
   ═══════════════════════════════════════════════════════════════════ */

.history-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Loading */
.history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #a0a0ff;
}

.history-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: historySpin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes historySpin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #888;
}

.history-empty p {
    margin: 0;
    font-size: 1rem;
}

.history-empty-hint {
    font-size: 0.85rem !important;
    margin-top: 8px !important;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════
   📋 LISTA DE ANÁLISES
   ═══════════════════════════════════════════════════════════════════ */

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    transition: background 0.2s ease;
}

.history-item:hover {
    background: rgba(139, 92, 246, 0.1);
}

.history-item-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    min-width: 0;
}

.history-item-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    flex-shrink: 0;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e0e0ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.history-item-meta {
    display: flex;
    gap: 8px;
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.history-item-type {
    color: #8b5cf6;
    font-weight: 500;
}

.history-item-genre {
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-date {
    font-size: 0.75rem;
    color: #666;
}

.history-item-delete {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 1rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ═══════════════════════════════════════════════════════════════════
   📋 FOOTER DO PAINEL
   ═══════════════════════════════════════════════════════════════════ */

.history-panel-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    background: rgba(0, 0, 0, 0.2);
}

.history-limit-info {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════
   ⏳ LOADING OVERLAY GLOBAL
   ═══════════════════════════════════════════════════════════════════ */

.history-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-loading-content {
    text-align: center;
    color: #e0e0ff;
}

.history-loading-content p {
    margin-top: 16px;
    font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════
   🔐 MENU LATERAL - ITEM DE HISTÓRICO
   ═══════════════════════════════════════════════════════════════════ */

.side-panel-item[data-action="history"] {
    position: relative;
}

.side-panel-item.history-locked {
    opacity: 0.6;
}

.history-pro-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════════════
   📱 RESPONSIVO
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .history-panel-content {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }
    
    .history-panel.active .history-panel-content {
        right: 0;
    }
    
    .history-item {
        padding: 14px 16px;
    }
    
    .history-item-icon {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    
    .history-item-name {
        font-size: 0.9rem;
    }
    
    .history-item-delete {
        opacity: 1;
    }
}
