/* =====================
   AI AGENT SIDEBAR MENU STYLES
   ===================== */

/* Main sidebar container */
.ai-sidebar-container {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 3499;
    display: flex;
    pointer-events: none;
}

/* Sidebar trigger button (sticky at top-right) */
.ai-sidebar-trigger {
    position: fixed;
    top: 20px;
    right: 0;
    width: 50px;
    height: 140px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: 12px 0 0 12px;
    color: white;
    cursor: pointer;
    box-shadow: -4px 0 20px rgba(108, 92, 231, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3500;
}

.ai-sidebar-trigger:hover {
    width: 55px;
    box-shadow: -6px 0 25px rgba(108, 92, 231, 0.6);
    transform: translateX(-2px);
}

.ai-sidebar-trigger.hidden {
    display: none;
}

.ai-sidebar-trigger i {
    font-size: 1.5rem;
}

.ai-sidebar-trigger span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.9;
}

/* Slide-out panel */
.ai-sidebar-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    z-index: 3499;
}

.ai-sidebar-panel.active {
    transform: translateX(0);
}

/* Panel header */
.ai-sidebar-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    position: relative;
}

.ai-sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.ai-sidebar-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: pulseGlow 2s ease-in-out infinite;
}

.ai-sidebar-info {
    flex: 1;
}

.ai-sidebar-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 3px;
}

.ai-sidebar-status {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-sidebar-status .status-dot {
    width: 8px;
    height: 8px;
    background: #00D2D3;
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

.ai-sidebar-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Panel content area */
.ai-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
}

/* Tab container */
.ai-tab-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 12px;
}

.ai-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ai-tab:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

.ai-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

/* Tab content containers */
.ai-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-right: 5px;
    flex-basis: 0;
    flex-grow: 1;
}

.ai-tab-content::-webkit-scrollbar {
    width: 6px;
}

.ai-tab-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.ai-tab-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.ai-tab-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ai-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Inner content containers */
#aiAnalyticsContent, 
#aiHistoryContent {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

#aiAnalyticsContent > *, 
#aiHistoryContent > * {
    flex-shrink: 0;
}

/* Ensure scrollbar works properly */
#aiAnalyticsContent::-webkit-scrollbar, 
#aiHistoryContent::-webkit-scrollbar {
    width: 6px;
}

#aiAnalyticsContent::-webkit-scrollbar-track, 
#aiHistoryContent::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#aiAnalyticsContent::-webkit-scrollbar-thumb, 
#aiHistoryContent::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#aiAnalyticsContent::-webkit-scrollbar-thumb:hover, 
#aiHistoryContent::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Message display */
.ai-message {
    background: rgba(255, 255, 255, 0.08);
    padding: 15px 18px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 15px;
    border-left: 3px solid var(--primary);
    animation: fadeIn 0.3s ease;
}

/* Empty state */
.ai-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.ai-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    opacity: 0.4;
}

.ai-empty-state p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Analytics section styles */
.ai-analytics-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-analytics-section h4 {
    color: white;
    font-size: 0.9rem;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-analytics-section h4 i {
    color: var(--primary-light);
}

.ai-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.ai-analytics-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.ai-analytics-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin-bottom: 5px;
}

.ai-analytics-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Category list */
.ai-category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.2s;
}

.ai-category-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ai-category-item .cat-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

.ai-category-item .cat-count {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Player performance */
.ai-player-performance {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ai-player-name {
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
}

.ai-player-accuracy {
    background: rgba(0, 200, 83, 0.2);
    color: #00D2D3;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ai-player-details {
    display: flex;
    gap: 10px;
}

.ai-cat-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.ai-cat-badge.strong {
    background: rgba(0, 200, 83, 0.15);
    color: #00D2D3;
}

.ai-cat-badge.weak {
    background: rgba(255, 107, 107, 0.15);
    color: #FF6B6B;
}

/* Summary button */
.ai-summary-btn {
    width: 100%;
    padding: 15px;
    margin-top: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: 12px;
    color: white;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.ai-summary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

/* History section styles */
.ai-history-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-history-total {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
}

.ai-clear-btn {
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #FF6B6B;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.ai-clear-btn:hover {
    background: rgba(255, 107, 107, 0.25);
}

.ai-games-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-bottom: 10px;
}

.ai-game-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-game-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(-3px);
    border-color: rgba(108, 92, 231, 0.3);
}

.ai-game-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ai-game-number {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.ai-game-date {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.ai-game-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ai-game-winner {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-game-winner.tie {
    color: rgba(255, 255, 255, 0.7);
}

.ai-game-players {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

.ai-game-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.ai-game-questions, 
.ai-game-duration {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-game-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-cat-tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    color: white;
}

.ai-game-card-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-game-tap-hint {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-sidebar-trigger {
        width: 45px;
        height: 120px;
    }
    
    .ai-sidebar-panel {
        width: 100vw;
    }
    
    .ai-sidebar-trigger span {
        font-size: 0.6rem;
    }
}
