/* ── ENHANCED CONSOLE STYLES ───────────────────────────────────── */
/* High contrast, larger text, comprehensive tooltips */

:root {
    --console-bg: rgba(0, 4, 8, 0.98);
    --console-border: #00d4ff;
    --console-text: #ffffff;
    --console-dim: #6a8ca8;
    --console-accent: #39ff14;
    --console-warning: #ffb347;
    --console-error: #ff3b3b;
    --console-success: #00ff88;
}

/* Base terminal enhancements */
#terminal {
    background: var(--console-bg);
    border: 2px solid var(--console-border);
    box-shadow: 
        0 -20px 60px rgba(0, 212, 255, 0.3),
        inset 0 0 20px rgba(0, 212, 255, 0.1);
    backdrop-filter: blur(10px);
}

#terminal::before {
    height: 3px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--console-border), 
        var(--console-warning), 
        var(--console-border), 
        transparent);
    opacity: 0.8;
    animation: consoleScan 4s linear infinite;
}

@keyframes consoleScan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Enhanced header */
#term-header {
    border-bottom: 2px solid rgba(0, 212, 255, 0.5);
    background: rgba(0, 20, 40, 0.8);
    min-height: 60px;
}

#term-identity {
    padding: 12px 20px;
    border-right: 2px solid rgba(0, 212, 255, 0.3);
    position: relative;
}

#term-identity::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    background: var(--console-accent);
    box-shadow: 0 0 10px var(--console-accent);
}

.agent-icon {
    font-size: 24px !important;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(57, 255, 20, 0.1);
    border: 2px solid var(--console-accent);
    border-radius: 50%;
    margin-right: 12px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 10px var(--console-accent); }
    50% { box-shadow: 0 0 20px var(--console-accent), 0 0 30px rgba(57, 255, 20, 0.5); }
}

.agent-name {
    font-size: 14px !important;
    font-weight: bold;
    color: var(--console-border);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    margin-bottom: 2px;
}

.agent-role {
    font-size: 10px !important;
    color: var(--console-dim);
    font-weight: 500;
}

/* Enhanced tabs */
#term-tabs {
    background: rgba(0, 10, 20, 0.6);
    padding: 8px 0;
}

.term-tab {
    font-size: 12px !important;
    font-weight: 600;
    padding: 10px 16px !important;
    border-bottom: 3px solid transparent !important;
    position: relative;
    transition: all 0.3s;
    cursor: pointer;
}

.term-tab::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--console-border);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.term-tab.active::before {
    transform: scaleX(1);
}

.term-tab.active {
    color: var(--console-accent) !important;
    background: rgba(57, 255, 20, 0.1);
    border-bottom-color: var(--console-accent) !important;
}

.term-tab:hover:not(.active) {
    color: var(--console-border) !important;
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

/* Enhanced thinking indicator */
#thinking-indicator {
    padding: 8px 12px;
    background: rgba(57, 255, 20, 0.1);
    border: 1px solid var(--console-accent);
    border-radius: 20px;
}

.thinking-dot {
    width: 8px !important;
    height: 8px !important;
    background: var(--console-accent);
    box-shadow: 0 0 10px var(--console-accent);
    animation: thinkingPulse 1.5s infinite;
}

.thinking-dot:nth-child(2) { animation-delay: 0.5s; }
.thinking-dot:nth-child(3) { animation-delay: 1s; }

@keyframes thinkingPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

#thinking-label {
    font-size: 10px !important;
    font-weight: bold;
    color: var(--console-accent);
    text-shadow: 0 0 5px rgba(57, 255, 20, 0.5);
}

/* Enhanced log area */
#term-log {
    font-size: 14px !important;
    line-height: 1.6;
    padding: 16px;
    background: rgba(0, 8, 16, 0.6);
}

.log-entry {
    padding: 8px 16px !important;
    margin: 4px 0;
    border-radius: 8px;
    border-left: 4px solid transparent;
    transition: all 0.3s;
    position: relative;
}

.log-entry:hover {
    background: rgba(0, 212, 255, 0.05);
    border-left-color: var(--console-border);
    transform: translateX(4px);
}

.log-time {
    font-size: 12px !important;
    font-weight: bold;
    color: var(--console-border);
    min-width: 80px;
}

.log-source {
    font-size: 12px !important;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(0, 212, 255, 0.2);
    color: var(--console-border);
    min-width: 100px;
    text-align: center;
}

.log-text {
    font-size: 14px !important;
    color: var(--console-text);
    flex: 1;
}

.log-entry.success .log-source {
    background: rgba(57, 255, 20, 0.2);
    color: var(--console-success);
    border-left-color: var(--console-success);
}

.log-entry.warning .log-source {
    background: rgba(255, 179, 71, 0.2);
    color: var(--console-warning);
    border-left-color: var(--console-warning);
}

.log-entry.error .log-source {
    background: rgba(255, 59, 59, 0.2);
    color: var(--console-error);
    border-left-color: var(--console-error);
}

/* Enhanced quick commands */
#quick-cmds {
    padding: 16px;
    background: rgba(0, 15, 30, 0.8);
    border-top: 1px solid rgba(0, 212, 255, 0.3);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.qcmd {
    font-size: 12px !important;
    font-weight: bold;
    padding: 12px 16px !important;
    border: 2px solid !important;
    border-radius: 8px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.qcmd::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.qcmd:hover::before {
    left: 100%;
}

.qcmd:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.qcmd.c-red {
    border-color: var(--console-error) !important;
    color: var(--console-error) !important;
    background: rgba(255, 59, 59, 0.1) !important;
}

.qcmd.c-red:hover {
    background: rgba(255, 59, 59, 0.2) !important;
    box-shadow: 0 8px 25px rgba(255, 59, 59, 0.3);
}

.qcmd.c-green {
    border-color: var(--console-accent) !important;
    color: var(--console-accent) !important;
    background: rgba(57, 255, 20, 0.1) !important;
}

.qcmd.c-green:hover {
    background: rgba(57, 255, 20, 0.2) !important;
    box-shadow: 0 8px 25px rgba(57, 255, 20, 0.3);
}

.qcmd.c-amber {
    border-color: var(--console-warning) !important;
    color: var(--console-warning) !important;
    background: rgba(255, 179, 71, 0.1) !important;
}

.qcmd.c-amber:hover {
    background: rgba(255, 179, 71, 0.2) !important;
    box-shadow: 0 8px 25px rgba(255, 179, 71, 0.3);
}

.qcmd.c-glow {
    border-color: var(--console-border) !important;
    color: var(--console-border) !important;
    background: rgba(0, 212, 255, 0.1) !important;
}

.qcmd.c-glow:hover {
    background: rgba(0, 212, 255, 0.2) !important;
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
}

.qcmd.c-purple {
    border-color: #c084fc !important;
    color: #c084fc !important;
    background: rgba(192, 132, 252, 0.1) !important;
}

.qcmd.c-purple:hover {
    background: rgba(192, 132, 252, 0.2) !important;
    box-shadow: 0 8px 25px rgba(192, 132, 252, 0.3);
}

/* Enhanced input area */
#term-input-row {
    border-top: 2px solid rgba(0, 212, 255, 0.5);
    background: rgba(0, 20, 40, 0.8);
    padding: 12px 0;
    min-height: 60px;
}

#term-prompt {
    font-size: 16px !important;
    font-weight: bold;
    color: var(--console-accent);
    padding: 0 16px 0 20px;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

#term-prompt::before {
    width: 8px !important;
    height: 8px !important;
    background: var(--console-accent);
    box-shadow: 0 0 15px var(--console-accent);
    animation: promptPulse 2s infinite;
}

@keyframes promptPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

#term-input {
    font-size: 16px !important;
    font-weight: 500;
    color: var(--console-text);
    padding: 8px 12px;
    background: rgba(0, 10, 20, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    transition: all 0.3s;
}

#term-input:focus {
    background: rgba(0, 20, 40, 0.8);
    border-color: var(--console-border);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    outline: none;
}

#term-input::placeholder {
    color: var(--console-dim);
    font-style: italic;
}

#term-send {
    font-size: 14px !important;
    font-weight: bold;
    padding: 12px 20px !important;
    background: linear-gradient(135deg, var(--console-accent), #00cc70);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#term-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(57, 255, 20, 0.4);
    background: linear-gradient(135deg, #00ff88, var(--console-accent));
}

#term-send:active {
    transform: translateY(0);
}

/* ── COMPREHENSIVE TOOLTIPS ───────────────────────────────────── */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 4, 8, 0.95);
    color: var(--console-text);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--console-border);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    max-width: 300px;
    white-space: normal;
    text-align: center;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--console-border);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    bottom: 115%;
}

/* Tooltip positioning variations */
[data-tooltip-position="top"]::before {
    bottom: 125%;
}

[data-tooltip-position="top"]::after {
    bottom: -2px;
}

[data-tooltip-position="bottom"]::before {
    top: 125%;
    bottom: auto;
}

[data-tooltip-position="bottom"]::after {
    top: -2px;
    bottom: auto;
    border-top-color: transparent;
    border-bottom-color: var(--console-border);
}

[data-tooltip-position="left"]::before {
    top: 50%;
    right: 105%;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
}

[data-tooltip-position="left"]::after {
    top: 50%;
    right: -2px;
    bottom: auto;
    left: auto;
    transform: translateY(-50%) rotate(90deg);
}

[data-tooltip-position="right"]::before {
    top: 50%;
    left: 105%;
    bottom: auto;
    right: auto;
    transform: translateY(-50%);
}

[data-tooltip-position="right"]::after {
    top: 50%;
    left: -2px;
    bottom: auto;
    right: auto;
    transform: translateY(-50%) rotate(-90deg);
}

/* Enhanced scrollbar */
#term-log::-webkit-scrollbar {
    width: 8px;
}

#term-log::-webkit-scrollbar-track {
    background: rgba(0, 20, 40, 0.6);
    border-radius: 4px;
}

#term-log::-webkit-scrollbar-thumb {
    background: var(--console-border);
    border-radius: 4px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

#term-log::-webkit-scrollbar-thumb:hover {
    background: var(--console-accent);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #term-tabs {
        flex-wrap: wrap;
    }
    
    .term-tab {
        font-size: 10px !important;
        padding: 8px 12px !important;
    }
    
    #quick-cmds {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 6px;
    }
    
    .qcmd {
        font-size: 10px !important;
        padding: 10px 12px !important;
    }
    
    #term-input {
        font-size: 14px !important;
    }
    
    #term-prompt {
        font-size: 14px !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --console-bg: #000000;
        --console-text: #ffffff;
        --console-dim: #cccccc;
    }
    
    #terminal {
        border-width: 3px;
    }
    
    .qcmd {
        border-width: 3px !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
