/* Theme - Colors, gradients, visual styling */

/* Command Explanation Panel */
.command-explanation {
    margin-top: 8px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
}

.explanation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.explanation-header h3 {
    margin: 0 0 2px 0;
    font-size: 0.85rem;
    color: #2d3748;
}

.explanation-hint {
    margin: 0 0 6px 0;
    font-size: 0.7rem;
    color: #718096;
}

.explanation-width-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #718096;
}

.explanation-width-control label {
    margin: 0;
    white-space: nowrap;
}

.explanation-width-control input[type="range"] {
    width: 120px;
    height: 4px;
    cursor: pointer;
}

.explanation-width-control span {
    margin: 0;
    min-width: 35px;
    text-align: right;
}

/* Tokenized Command Display */
.tokenized-command {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: block;
    overflow: hidden;
    max-width: 100%;
    width: 100%;
}

/* Explanation line highlighting */
.explain-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    padding: 2px 0;
    margin: 1px 0;
    border-radius: 3px;
}

.explain-highlighted {
    background: rgba(72, 187, 120, 0.2);
    border-left: 3px solid #48bb78;
    padding-left: 8px;
}

.explain-dimmed {
    opacity: 0.4;
}

/* When hovering a token in a dimmed line, make the line fully opaque */
.explain-dimmed:has(.command-token:hover) {
    opacity: 1;
}

.command-token {
    display: inline-block;
    padding: 1px 3px;
    margin: 1px 0;
    border-radius: 3px;
    cursor: help;
    transition: all 0.15s ease;
    position: relative;
    white-space: nowrap;
}

.command-token:hover {
    transform: none;
    z-index: 10000;
}

.token-newline {
    display: block;
    height: 0;
}

.token-whitespace {
    white-space: pre;
}

/* Token Categories - Colors */
.token-command {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

.token-flag {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.token-flag-high-risk {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

.token-flag-medium-risk {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fdba74;
}

.token-value {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.token-string {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

.token-punctuation {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

/* Install script tokens */
.token-comment {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    font-style: italic;
}

.token-install-keyword {
    background: #fdf4ff;
    color: #86198f;
    border: 1px solid #e879f9;
    font-weight: 500;
}

/* Custom function name - special highlight */
.token-func-name {
    background: #dbeafe;
    color: #1e40af;
    border: 2px solid #3b82f6;
    font-weight: 600;
}

.token-install-line {
    background: #fefce8;
    color: #854d0e;
    border: 1px solid #fde047;
}

/* Token Tooltip */
.token-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 32, 44, 1);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'Segoe UI', sans-serif;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    min-width: 200px;
    max-width: 350px;
    width: max-content;
    white-space: normal;
    text-align: left;
    line-height: 1.5;
}

.token-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(26, 32, 44, 1);
}

.command-token:hover .token-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Smart tooltip positioning for left-aligned */
.token-tooltip.tooltip-left {
    left: 0;
    transform: translateX(0);
}

.token-tooltip.tooltip-left::after {
    left: 20px;
    transform: translateX(0);
}

/* Smart tooltip positioning for right-aligned */
.token-tooltip.tooltip-right {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.token-tooltip.tooltip-right::after {
    left: auto;
    right: 20px;
    transform: translateX(0);
}

/* Smart tooltip positioning for bottom (when near top of screen) */
.token-tooltip.tooltip-bottom {
    bottom: auto;
    top: calc(100% + 8px);
}

.token-tooltip.tooltip-bottom::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: rgba(26, 32, 44, 1);
}

/* Tooltip description */
.tooltip-description {
    margin-bottom: 8px;
    font-weight: 500;
}

/* Risk indicator container */
.tooltip-risk-container {
    margin: 8px 0;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Risk indicator badge */
.tooltip-risk {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: help;
}

.tooltip-risk.high {
    background: #ef4444;
    color: white;
}

.tooltip-risk.medium {
    background: #f59e0b;
    color: white;
}

.tooltip-risk.low {
    background: #10b981;
    color: white;
}

/* Risk explanation text */
.tooltip-risk-explanation {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #a0aec0;
    font-style: italic;
    line-height: 1.4;
}

/* Documentation link container */
.tooltip-docs {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Documentation link in tooltip */
.tooltip-docs-link {
    display: inline-block;
    padding: 6px 12px;
    background: #3b82f6;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.tooltip-docs-link:hover {
    background: #2563eb;
}

/* Platform Configuration */
.os-info-box {
    margin-top: 8px;
    padding: 8px 10px;
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #0369a1;
    line-height: 1.4;
}

.os-info-box.hidden {
    display: none;
}

.platform-warnings {
    margin-top: 12px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
}

.platform-warnings.warning {
    display: block;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.platform-warnings.error {
    display: block;
    background: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

.platform-warnings.info {
    display: block;
    background: #dbeafe;
    border: 1px solid #3b82f6;
    color: #1e40af;
}

.tool-info-message {
    margin-top: 12px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.tool-info-message.info {
    background: #dbeafe;
    border: 1px solid #3b82f6;
    color: #1e40af;
}

#tool-agent-label {
    font-weight: 400;
    font-size: 0.9rem;
    color: #718096;
}

/* Tool Redundancy Warning */
.tool-redundancy-warning {
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #38bdf8;
    border-radius: 8px;
    font-size: 0.9rem;
}

.redundancy-header {
    font-weight: 600;
    color: #0369a1;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.redundancy-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid rgba(56, 189, 248, 0.3);
}

.redundancy-item:first-of-type {
    border-top: none;
}

.redundancy-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.redundancy-text {
    color: #0c4a6e;
    line-height: 1.5;
}

/* Alpha Agent Warning */
.alpha-agent-warning {
    margin-bottom: 16px;
    padding: 16px 20px;
    background: #dc2626;
    border: 3px solid #991b1b;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #ffffff;
}

.alpha-agent-warning p {
    margin: 8px 0;
}

.alpha-warning-header {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.alpha-warning-caps {
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    margin: 12px 0;
}

.alpha-agent-warning a {
    color: #fef08a;
    font-weight: 600;
    text-decoration: underline;
}

.alpha-agent-warning a:hover {
    color: #fde047;
}

/* Beginner Hints */
.beginner-hint {
    font-size: 0.8rem;
    color: #4a5568;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
    border-radius: 4px;
    padding: 6px 10px;
    margin: 0;
}

.beginner-hint strong {
    color: #166534;
}

.beginner-hint code {
    background: rgba(22, 101, 52, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.75rem;
}

/* Expertise-based visibility classes */
.beginner-only {
    display: block;
}

.intermediate-hide .beginner-only,
.expert-hide .beginner-only {
    display: none;
}

.expert-hide .intermediate-only {
    display: none;
}

/* Hide beginner content when not in beginner mode */
.container.intermediate-mode .beginner-only,
.container.expert-mode .beginner-only {
    display: none !important;
}

/* Expert Mode - Retro 90s Theme */
.container.expert-mode {
    background: #c0c0c0;
    border-radius: 0;
    border: 2px outset #dfdfdf;
    box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #808080;
    font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, sans-serif;
}

.container.expert-mode .compact-header {
    background: linear-gradient(90deg, #000080, #1084d0);
    color: white;
    padding: 2px 4px;
    border-bottom: none;
}

.container.expert-mode .quick-start-inline {
    color: white;
}

.container.expert-mode .header-left h1 {
    color: white;
    font-size: 1rem;
    font-weight: normal;
}

.container.expert-mode .tagline {
    color: #ccc;
}

.container.expert-mode .top-row,
.container.expert-mode main section {
    background: #c0c0c0;
    border: 2px inset #dfdfdf;
    border-radius: 0;
}

.container.expert-mode .preset-btn,
.container.expert-mode button {
    background: #c0c0c0;
    border: 2px outset #dfdfdf;
    border-radius: 0;
    font-family: 'MS Sans Serif', sans-serif;
}

.container.expert-mode .preset-btn:active,
.container.expert-mode button:active {
    border: 2px inset #dfdfdf;
}

.container.expert-mode select,
.container.expert-mode input {
    background: white;
    border: 2px inset #dfdfdf;
    border-radius: 0;
}

.container.expert-mode .code-container {
    background: #000;
    border: 2px inset #dfdfdf;
    border-radius: 0;
}

.container.expert-mode .category {
    background: #c0c0c0;
    border: 1px solid #808080;
    border-radius: 0;
}

.container.expert-mode footer {
    border-top: 2px groove #dfdfdf;
}

/* Expertise level - tooltip visibility */
/* Beginner: always show tooltips */
.container.beginner-mode .token-tooltip {
    display: block;
}

/* Standard: show tooltips only on hover */
.container.intermediate-mode .token-tooltip {
    display: none;
}

.container.intermediate-mode .command-token:hover .token-tooltip {
    display: block;
}

/* Expert: never show tooltips */
.container.expert-mode .token-tooltip {
    display: none !important;
}

.container.expert-mode .command-token:hover .token-tooltip {
    display: none !important;
}

/* Enhanced hover effects */
.level-btn:hover .tooltip::after {
    opacity: 1;
}
