/**
 * Debug Console Styles
 * Floating popup for displaying console messages
 */

/* Container */
.debug-console-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease-out;
}

.debug-console-container.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Window */
.debug-console-window {
    width: 500px;
    max-width: calc(100vw - 40px);
    height: 450px;
    max-height: calc(100vh - 100px);
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--card-border, #313244);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.debug-console-container.minimized .debug-console-window {
    height: 48px;
}

.debug-console-container.minimized .debug-console-filters,
.debug-console-container.minimized .debug-console-search,
.debug-console-container.minimized .debug-console-body {
    display: none;
}

/* Header */
.debug-console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.debug-console-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.debug-console-title i {
    font-size: 14px;
    opacity: 0.9;
}

.debug-console-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.debug-console-actions {
    display: flex;
    gap: 4px;
}

.debug-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.debug-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.debug-action-btn:active {
    transform: scale(0.95);
}

.debug-action-btn i {
    font-size: 12px;
}

/* Filters */
.debug-console-filters {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    background: var(--bg-secondary, #181825);
    border-bottom: 1px solid var(--card-border, #313244);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.debug-filter-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border-color, #45475a);
    border-radius: 6px;
    color: var(--text-muted, #6c7086);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.debug-filter-btn:hover {
    background: var(--bg-tertiary, #11111b);
    border-color: var(--text-muted, #6c7086);
}

.debug-filter-btn.active {
    color: white;
    border-color: transparent;
}

.debug-filter-btn[data-filter="log"].active {
    background: #6c7086;
}

.debug-filter-btn[data-filter="info"].active {
    background: #89b4fa;
    color: #11111b;
}

.debug-filter-btn[data-filter="warn"].active {
    background: #f9e2af;
    color: #11111b;
}

.debug-filter-btn[data-filter="error"].active {
    background: #f38ba8;
    color: #11111b;
}

.debug-filter-btn[data-filter="debug"].active {
    background: #a6e3a1;
    color: #11111b;
}

.debug-filter-btn i {
    font-size: 10px;
}

/* Search */
.debug-console-search {
    position: relative;
    padding: 8px 10px;
    background: var(--bg-secondary, #181825);
    border-bottom: 1px solid var(--card-border, #313244);
    flex-shrink: 0;
}

.debug-search-input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    background: var(--bg-tertiary, #11111b);
    border: 1px solid var(--border-color, #45475a);
    border-radius: 6px;
    color: var(--text-primary, #cdd6f4);
    font-size: 12px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.debug-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.debug-search-input::placeholder {
    color: var(--text-muted, #6c7086);
}

.debug-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #6c7086);
    font-size: 12px;
    pointer-events: none;
}

/* Body */
.debug-console-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    background: var(--bg-tertiary, #11111b);
}

.debug-console-body::-webkit-scrollbar {
    width: 8px;
}

.debug-console-body::-webkit-scrollbar-track {
    background: transparent;
}

.debug-console-body::-webkit-scrollbar-thumb {
    background: var(--border-color, #45475a);
    border-radius: 4px;
}

.debug-console-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #6c7086);
}

/* Empty State */
.debug-console-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--text-muted, #6c7086);
}

.debug-console-empty i {
    font-size: 36px;
    opacity: 0.3;
}

.debug-console-empty p {
    font-size: 13px;
    margin: 0;
}

/* Messages */
.debug-message {
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: var(--card-bg, #1e1e2e);
    border-left: 3px solid transparent;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.debug-message.visible {
    opacity: 1;
    transform: translateX(0);
}

.debug-message.filtered-out,
.debug-message.search-filtered {
    display: none;
}

.debug-message-log {
    border-left-color: #6c7086;
}

.debug-message-info {
    border-left-color: #89b4fa;
    background: rgba(137, 180, 250, 0.05);
}

.debug-message-warn {
    border-left-color: #f9e2af;
    background: rgba(249, 226, 175, 0.05);
}

.debug-message-error {
    border-left-color: #f38ba8;
    background: rgba(243, 139, 168, 0.08);
}

.debug-message-debug {
    border-left-color: #a6e3a1;
    background: rgba(166, 227, 161, 0.05);
}

.debug-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.debug-message-type {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.debug-message-type i {
    font-size: 11px;
}

.debug-message-log .debug-message-type i {
    color: #6c7086;
}

.debug-message-info .debug-message-type i {
    color: #89b4fa;
}

.debug-message-warn .debug-message-type i {
    color: #f9e2af;
}

.debug-message-error .debug-message-type i {
    color: #f38ba8;
}

.debug-message-debug .debug-message-type i {
    color: #a6e3a1;
}

.debug-message-time {
    font-size: 10px;
    color: var(--text-muted, #6c7086);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.debug-message-content {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-primary, #cdd6f4);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    padding-left: 26px;
}

.debug-message-error .debug-message-content {
    color: #f38ba8;
}

.debug-message-warn .debug-message-content {
    color: #f9e2af;
}

/* Toggle Button (optional - can be placed elsewhere in the UI) */
.debug-console-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 99998;
}

.debug-console-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.debug-console-toggle i {
    font-size: 20px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .debug-console-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .debug-console-window {
        width: 100%;
        max-width: none;
        height: 350px;
    }

    .debug-console-filters {
        gap: 3px;
        padding: 6px 8px;
    }

    .debug-filter-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .debug-filter-btn span {
        display: none;
    }
}

/* Dark mode overrides (already using dark colors as default) */
[data-theme="light"] .debug-console-window {
    background: var(--bg-primary, #edf3fb);
    border-color: var(--border-color, rgba(100, 140, 200, 0.22));
}

[data-theme="light"] .debug-console-filters,
[data-theme="light"] .debug-console-search {
    background: var(--bg-secondary, #e2ecf7);
    border-color: var(--border-color, rgba(100, 140, 200, 0.22));
}

[data-theme="light"] .debug-console-body {
    background: var(--bg-tertiary, #d5e3f2);
}

[data-theme="light"] .debug-message {
    background: var(--bg-primary, #edf3fb);
}

[data-theme="light"] .debug-search-input {
    background: var(--bg-primary, #edf3fb);
    border-color: var(--border-color, rgba(100, 140, 200, 0.22));
    color: var(--text-primary, #0f172a);
}

[data-theme="light"] .debug-message-content {
    color: var(--text-primary, #0f172a);
}
