/* Floating Scan Console */
.scan-console {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 480px;
    max-width: calc(100vw - 40px);
    height: 320px;
    max-height: calc(100vh - 40px);
    background: rgba(15, 15, 25, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    font-family: var(--font-family, 'Inter', sans-serif);
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
    contain: layout style;
}

.scan-console.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.scan-console.minimized {
    height: 50px;
    overflow: hidden;
}

.scan-console.expanded {
    width: 600px;
    height: 450px;
}

.light-theme .scan-console {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Header */
.scan-console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 50px;
    flex-shrink: 0;
}

.light-theme .scan-console-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.scan-console-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    user-select: none;
}

.scan-console-title i {
    color: var(--accent, #00e0ff);
    font-size: 16px;
}

.scan-console-actions {
    display: flex;
    gap: 4px;
}

.scan-console-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.scan-console-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #ffffff);
    transform: scale(1.05);
}

.light-theme .scan-console-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Content */
.scan-console-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.console-output {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.2);
    margin: 8px;
    border-radius: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    contain: strict;
}

.light-theme .console-output {
    background: rgba(0, 0, 0, 0.05);
}

.console-output::-webkit-scrollbar {
    width: 6px;
}

.console-output::-webkit-scrollbar-track {
    background: transparent;
}

.console-output::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.console-output::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.light-theme .console-output::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
}

.light-theme .console-output::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Log Entries */
.console-log-entry {
    margin-bottom: 4px;
    word-break: break-word;
    white-space: pre-wrap;
    opacity: 0;
    animation: fadeInLog 0.3s ease forwards;
}

@keyframes fadeInLog {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.log-time {
    color: var(--accent, #00e0ff);
    font-weight: 500;
    margin-right: 8px;
    font-size: 11px;
}

.log-message {
    color: var(--text-secondary, rgba(255, 255, 255, 0.9));
}

.log-error .log-message {
    color: #ff6b6b;
}

.log-warning .log-message {
    color: #ffd93d;
}

.log-success .log-message {
    color: #51cf66;
}

/* Footer */
.scan-console-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.light-theme .scan-console-footer {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.scan-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.scan-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.light-theme .scan-progress-bar {
    background: rgba(0, 0, 0, 0.1);
}

.scan-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent, #00e0ff), #0072ff);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
    will-change: width;
}

.scan-status {
    font-size: 11px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .scan-console {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        height: 280px;
    }
    
    .scan-console.expanded {
        width: auto;
        height: 350px;
    }
    
    .scan-console-title span {
        display: none;
    }
}

@media (max-width: 480px) {
    .scan-console {
        height: 240px;
    }
    
    .scan-console.expanded {
        height: 300px;
    }
    
    .console-output {
        font-size: 11px;
    }
}

/* Performance optimizations */
.scan-console * {
    pointer-events: auto;
}

.scan-console.hidden {
    pointer-events: none;
}

/* Minimize animation */
.scan-console-content {
    transition: opacity 0.2s ease;
}

.scan-console.minimized .scan-console-content {
    opacity: 0;
}

/* Draggable cursor hint */
.scan-console-header {
    cursor: move;
}

/* Accessibility */
.scan-console:focus-within {
    outline: 2px solid var(--accent, #00e0ff);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .scan-console,
    .scan-console-btn,
    .console-log-entry,
    .scan-progress-fill {
        transition: none;
        animation: none;
    }
}