/* Component-specific styles for workbench */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 300px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-color: var(--success-color);
    background: rgb(5, 150, 105, 0.1);
}

.toast.error {
    border-color: var(--error-color);
    background: rgb(220, 38, 38, 0.1);
}

.toast.warning {
    border-color: var(--warning-color);
    background: rgb(217, 119, 6, 0.1);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast-message {
    flex: 1;
    line-height: var(--line-height-tight);
}

.toast-close {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    margin-left: var(--space-sm);
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Results Display Components */
.result-item {
    padding: var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    margin-bottom: var(--space-md);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.result-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    font-size: 1rem;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-content {
    color: var(--text-primary);
    line-height: var(--line-height-normal);
    margin-bottom: var(--space-md);
}

.result-content p:first-child {
    margin-top: 0;
}

.result-content p:last-child {
    margin-bottom: 0;
}

.result-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.result-action {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: calc(var(--border-radius) / 2);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.result-action:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Concept Display */
.concept-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.concept-tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--primary-color);
    color: white;
    border-radius: calc(var(--border-radius) / 2);
    font-size: 0.75rem;
    font-weight: 500;
}

.concept-tag.secondary {
    background: var(--secondary-color);
}

/* Performance Indicators */
.performance-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: calc(var(--border-radius) / 2);
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.performance-icon {
    font-size: 0.75rem;
}

/* Status Indicators */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: calc(var(--border-radius) / 2);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.success {
    background: rgb(5, 150, 105, 0.1);
    color: var(--success-color);
}

.status-badge.error {
    background: rgb(220, 38, 38, 0.1);
    color: var(--error-color);
}

.status-badge.warning {
    background: rgb(217, 119, 6, 0.1);
    color: var(--warning-color);
}

.status-badge.info {
    background: rgb(37, 99, 235, 0.1);
    color: var(--primary-color);
}

/* Code Display */
.code-block {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: var(--line-height-normal);
    overflow-x: auto;
    white-space: pre;
    color: var(--text-primary);
}

.inline-code {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) / 2);
    padding: 2px var(--space-xs);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Expandable Content */
.expandable-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.expandable-content.collapsed {
    max-height: 0;
}

.expandable-content.expanded {
    max-height: 1000px; /* Adjust based on content */
}

/* Interactive Elements */
.interactive-element {
    cursor: pointer;
    transition: all 0.2s;
}

.interactive-element:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.interactive-element:active {
    transform: translateY(0);
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.2);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.2), 0 4px 6px -4px rgb(0 0 0 / 0.2);
    }
}

/* Console Components */
.console-controls {
    margin-bottom: var(--space-md);
}

.console-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.console-button {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: calc(var(--border-radius) / 2);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.console-button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.console-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.console-filter {
    margin-left: auto;
}

.console-filter .form-select {
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
}

.console-logs {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    height: 400px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    position: relative;
}

.console-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.console-placeholder .placeholder-icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.console-placeholder .placeholder-text {
    font-size: 0.875rem;
    font-family: var(--font-family);
}

.console-log-entry {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    line-height: var(--line-height-tight);
}

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

.console-log-entry.info {
    background: rgba(37, 99, 235, 0.05);
    border-left: 3px solid var(--primary-color);
}

.console-log-entry.success {
    background: rgba(5, 150, 105, 0.05);
    border-left: 3px solid var(--success-color);
}

.console-log-entry.warning {
    background: rgba(217, 119, 6, 0.05);
    border-left: 3px solid var(--warning-color);
}

.console-log-entry.error {
    background: rgba(220, 38, 38, 0.05);
    border-left: 3px solid var(--error-color);
}

.console-log-timestamp {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    min-width: 60px;
}

.console-log-level {
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 50px;
}

.console-log-level.info {
    color: var(--primary-color);
}

.console-log-level.success {
    color: var(--success-color);
}

.console-log-level.warning {
    color: var(--warning-color);
}

.console-log-level.error {
    color: var(--error-color);
}

.console-log-message {
    flex: 1;
    color: var(--text-primary);
    word-break: break-word;
}

.console-log-details {
    margin-top: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(0, 0, 0, 0.05);
    border-radius: calc(var(--border-radius) / 2);
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* Console scrollbar styling */
.console-logs::-webkit-scrollbar {
    width: 6px;
}

.console-logs::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.console-logs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.console-logs::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Print styles */
@media print {
    .loading-overlay,
    .toast-container,
    .verb-button,
    .panel-toggle,
    .console-controls {
        display: none !important;
    }
    
    .workbench-app {
        box-shadow: none;
    }
    
    .verb-column,
    .verb-panel {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .console-logs {
        height: auto;
        max-height: 300px;
        overflow: visible;
    }
}

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