/**
 * ============================================================================
 * 🖥️ CONSOLE VIEWER STYLES - LIVE FRONTEND JS CONSOLE
 * ============================================================================
 * Issue #2034 - Step-07: Navigation & Console Debugging UX
 * Feature: Live JavaScript console viewer in frontend
 *
 * Visual Theme: VS Code Dark
 * - Background: #1e1e1e (dark gray)
 * - Text: #d4d4d4 (light gray)
 * - Type colors: LOG (cyan), ERROR (red), WARN (yellow), INFO (blue)
 *
 * Panel Structure:
 * - Fixed bottom position (z-index 2000)
 * - Collapsible: 400px (expanded) ↔ 40px (collapsed)
 * - Header: Controls, filters, search (40px)
 * - Logs: Scrollable area (360px when expanded)
 * ============================================================================
 */

/* ===========================================================================
   Panel Container - Fixed Bottom Position
   =========================================================================== */

#wcp-console-viewer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: #1e1e1e;
    border-top: 1px solid #3c3c3c;
    z-index: 2000; /* Above floating help (z-index 1000) */
    display: flex;
    flex-direction: column;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: #d4d4d4;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    transition: height 0.3s ease;
}

/* Collapsed State (Header Only) */
#wcp-console-viewer.collapsed {
    height: 40px;
}

/* Hide log list when collapsed */
#wcp-console-viewer.collapsed .wcp-console-logs {
    display: none;
}

/* ===========================================================================
   Header Bar - Controls & Filters (40px fixed height)
   =========================================================================== */

.wcp-console-header {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
}

/* Header title */
.wcp-console-header strong {
    font-size: 13px;
    color: #d4d4d4;
    margin-right: 5px;
}

/* Log count badge */
.wcp-log-count {
    font-size: 11px;
    color: #858585;
    background: #2d2d2d;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 10px;
}

/* ===========================================================================
   Buttons (Toggle, Clear)
   =========================================================================== */

.wcp-toggle-btn,
.wcp-clear-btn {
    background: #2d2d2d;
    border: 1px solid #3c3c3c;
    color: #d4d4d4;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.wcp-toggle-btn:hover,
.wcp-clear-btn:hover {
    background: #3c3c3c;
    border-color: #555;
}

.wcp-toggle-btn i {
    font-size: 10px;
}

/* ===========================================================================
   Filters - Type Selection Buttons
   =========================================================================== */

.wcp-filters {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto; /* Push to right side */
}

.wcp-filter-btn {
    padding: 4px 10px;
    border: 1px solid #3c3c3c;
    background: #2d2d2d;
    color: #d4d4d4;
    cursor: pointer;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.wcp-filter-btn:hover {
    background: #3c3c3c;
    border-color: #555;
}

.wcp-filter-btn.active {
    background: #0e639c;
    border-color: #007acc;
    color: #ffffff;
}

/* Type-specific filter button colors (when active) */
.wcp-filter-btn[data-filter="log"].active {
    background: #4ec9b0;
    border-color: #4ec9b0;
    color: #000;
}

.wcp-filter-btn[data-filter="error"].active {
    background: #f48771;
    border-color: #f48771;
    color: #000;
}

.wcp-filter-btn[data-filter="warn"].active {
    background: #dcdcaa;
    border-color: #dcdcaa;
    color: #000;
}

.wcp-filter-btn[data-filter="info"].active {
    background: #569cd6;
    border-color: #569cd6;
    color: #000;
}

/* ===========================================================================
   Search Input
   =========================================================================== */

.wcp-search-input {
    background: #3c3c3c;
    border: 1px solid #555;
    color: #d4d4d4;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    width: 200px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.wcp-search-input:focus {
    outline: none;
    border-color: #007acc;
    background: #2d2d2d;
}

.wcp-search-input::placeholder {
    color: #858585;
}

/* ===========================================================================
   Auto-Scroll Toggle (Checkbox with Label)
   =========================================================================== */

.wcp-autoscroll-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #d4d4d4;
    cursor: pointer;
    user-select: none;
}

.wcp-autoscroll-toggle input[type="checkbox"] {
    cursor: pointer;
}

/* ===========================================================================
   Log List Container - Scrollable Area (360px when expanded)
   =========================================================================== */

.wcp-console-logs {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 15px;
    background: #1e1e1e;
}

/* ===========================================================================
   Log Entry Row - Emoji, Timestamp, Type, Message
   =========================================================================== */

.wcp-log-entry {
    padding: 4px 0;
    border-bottom: 1px solid #2d2d2d;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11px;
    line-height: 1.5;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.wcp-log-entry:last-child {
    border-bottom: none;
}

/* Emoji (20px fixed width) */
.wcp-log-emoji {
    font-size: 14px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

/* Timestamp (100px fixed width) */
.wcp-log-timestamp {
    color: #858585;
    font-size: 10px;
    flex-shrink: 0;
    width: 100px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Type Badge (LOG, ERROR, WARN, INFO) */
.wcp-log-type {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 50px;
    text-align: center;
}

/* Message (flexible width, wraps) */
.wcp-log-message {
    flex: 1;
    word-break: break-word;
    white-space: pre-wrap;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* ===========================================================================
   Type-Specific Row Colors
   =========================================================================== */

/* LOG - Cyan */
.wcp-log-entry.log {
    color: #4ec9b0;
}

.wcp-log-entry.log .wcp-log-type {
    background: #4ec9b0;
    color: #000;
}

/* ERROR - Red */
.wcp-log-entry.error {
    color: #f48771;
}

.wcp-log-entry.error .wcp-log-type {
    background: #f48771;
    color: #000;
}

/* WARN - Yellow */
.wcp-log-entry.warn {
    color: #dcdcaa;
}

.wcp-log-entry.warn .wcp-log-type {
    background: #dcdcaa;
    color: #000;
}

/* INFO - Blue */
.wcp-log-entry.info {
    color: #569cd6;
}

.wcp-log-entry.info .wcp-log-type {
    background: #569cd6;
    color: #000;
}

/* ===========================================================================
   Scrollbar Styling (Thin Dark Theme)
   =========================================================================== */

.wcp-console-logs::-webkit-scrollbar {
    width: 10px;
}

.wcp-console-logs::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.wcp-console-logs::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 5px;
}

.wcp-console-logs::-webkit-scrollbar-thumb:hover {
    background: #4e4e4e;
}

/* Firefox scrollbar */
.wcp-console-logs {
    scrollbar-width: thin;
    scrollbar-color: #424242 #1e1e1e;
}

/* ===========================================================================
   Empty State (No Logs)
   =========================================================================== */

.wcp-console-logs:empty::before {
    content: "No logs yet. Console will display here when JavaScript runs.";
    display: block;
    padding: 20px;
    text-align: center;
    color: #858585;
    font-size: 12px;
    font-style: italic;
}

/* ===========================================================================
   Responsive Design - Mobile (< 768px)
   =========================================================================== */

@media (max-width: 768px) {
    /* Smaller height on mobile */
    #wcp-console-viewer {
        height: 300px;
    }

    #wcp-console-viewer.collapsed {
        height: 40px;
    }

    /* Narrower search input */
    .wcp-search-input {
        width: 120px;
    }

    /* Smaller header padding */
    .wcp-console-header {
        padding: 0 10px;
        gap: 5px;
    }

    /* Smaller font sizes */
    .wcp-log-entry {
        font-size: 10px;
    }

    .wcp-log-timestamp {
        font-size: 9px;
        width: 80px;
    }

    .wcp-log-emoji {
        font-size: 12px;
        width: 16px;
    }

    /* Hide some labels on mobile */
    .wcp-console-header strong {
        display: none;
    }

    /* Compact buttons */
    .wcp-filter-btn {
        padding: 3px 6px;
        font-size: 10px;
    }
}

/* ===========================================================================
   Print Mode - Hide Console Viewer
   =========================================================================== */

@media print {
    #wcp-console-viewer {
        display: none !important;
    }
}

/* ===========================================================================
   Accessibility - Focus States
   =========================================================================== */

.wcp-toggle-btn:focus,
.wcp-clear-btn:focus,
.wcp-filter-btn:focus,
.wcp-search-input:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

/* ===========================================================================
   Animation - Fade In on Load
   =========================================================================== */

@keyframes wcpFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#wcp-console-viewer {
    animation: wcpFadeIn 0.3s ease-out;
}

/* ===========================================================================
   Log Entry Highlight on Hover
   =========================================================================== */

.wcp-log-entry:hover {
    background: #252526;
    border-radius: 3px;
    margin-left: -5px;
    margin-right: -5px;
    padding-left: 5px;
    padding-right: 5px;
}

/* ===========================================================================
   Utility Classes
   =========================================================================== */

.wcp-hidden {
    display: none !important;
}

.wcp-text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===========================================================================
   END OF FILE
   =========================================================================== */
