/**
 * Event Log Sidebar Component
 * Reusable toggleable sidebar for displaying event logs in JSON format
 */

/* Sidebar Styles */
.event-log-sidebar {
    position: fixed;
    top: 0;
    right: -400px; /* Hidden by default */
    width: 400px;
    height: 100vh;
    background: #1e1e1e;
    color: #e0e0e0;
    border-left: 2px solid #333;
    transition: right 0.3s ease-in-out;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.event-log-sidebar.open {
    right: 0;
}

/* Sidebar Header */
.sidebar-header {
    background: #2d2d2d;
    padding: 15px 20px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 16px;
    color: #fff;
}

.sidebar-close {
    background: none;
    border: none;
    color: #ccc;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.sidebar-close:hover {
    background: #444;
    color: #fff;
}

/* Sidebar Controls */
.sidebar-controls {
    padding: 15px 20px;
    border-bottom: 1px solid #444;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sidebar-controls .btn {
    background: #0066cc;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.sidebar-controls .btn:hover {
    background: #0052a3;
}

.sidebar-controls .btn.secondary {
    background: #666;
}

.sidebar-controls .btn.secondary:hover {
    background: #555;
}

/* Event Log Content */
.event-log {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.event-log-content {
    padding: 20px;
    font-size: 12px;
    line-height: 1.4;
}

/* Event Entry Styles */
.event-entry {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    overflow-x: auto;
}

.event-entry:last-child {
    margin-bottom: 0;
}

.event-timestamp {
    color: #888;
    font-size: 10px;
}

.event-type {
    color: #4fc3f7;
    font-weight: bold;
    font-size: 11px;
}

.event-source {
    color: #81c784;
    font-size: 10px;
    background: #1b5e20;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

/* JSON Syntax Highlighting */
.json-key {
    color: #f8bbd9;
}

.json-string {
    color: #c3e88d;
}

.json-number {
    color: #ff9800;
}

.json-boolean {
    color: #ff5722;
}

.json-null {
    color: #607d8b;
}

/* Mobile Toggle Button */
.event-log-toggle {
    position: fixed;
    bottom: 20px;
    right: 80px; /* Moved left to avoid overlap with tracking status */
    background: #0066cc;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
    display: block; /* Always visible */
}

.event-log-toggle:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.event-log-toggle.active {
    background: #d32f2f;
}

.event-log-toggle.active:hover {
    background: #b71c1c;
}

/* Event Count Badge */
.event-count {
    background: #ff4444;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    min-width: 16px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .event-log-sidebar {
        width: 100%;
        right: -100%;
    }

    .sidebar-controls {
        flex-direction: column;
    }

    .sidebar-controls .btn {
        width: 100%;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .event-log-sidebar {
        width: 100vw;
    }

    .sidebar-header {
        padding: 12px 15px;
    }

    .sidebar-header h2 {
        font-size: 14px;
    }

    .event-log-content {
        padding: 15px;
    }

    .event-entry {
        padding: 10px;
        font-size: 11px;
    }

    .event-log-toggle {
        bottom: 80px; /* Stack vertically on mobile */
        right: 20px;
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* Scrollbar Styling for Webkit browsers */
.event-log::-webkit-scrollbar {
    width: 8px;
}

.event-log::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.event-log::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.event-log::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Animation for new events */
@keyframes newEvent {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.event-entry.new {
    animation: newEvent 0.3s ease-out;
}
