/* Darkfoo AI Enhanced Styling - Principal Engineer Implementation */

/* AI Response Containers */
.darkfoo-response-container {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--neon-cyan);
    border-radius: 8px;
    margin: 10px 0;
    overflow: hidden;
    position: relative;
    backdrop-filter: blur(5px);
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.2),
        inset 0 0 20px rgba(0, 255, 255, 0.05);
    animation: materialize 0.5s ease-out;
}

@keyframes materialize {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.darkfoo-response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: linear-gradient(90deg, rgba(0, 255, 255, 0.1) 0%, rgba(240, 0, 204, 0.1) 100%);
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    font-size: 0.85rem;
}

.darkfoo-response-model {
    color: var(--neon-cyan);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.darkfoo-response-time {
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Courier New', monospace;
}

.darkfoo-response-content {
    padding: 15px;
    color: #fff;
    line-height: 1.6;
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

/* Streaming Response Styling */
.darkfoo-streaming {
    border-color: var(--neon-yellow);
    box-shadow:
        0 0 20px rgba(255, 255, 0, 0.3),
        inset 0 0 20px rgba(255, 255, 0, 0.05);
}

.darkfoo-streaming-indicator {
    display: flex;
    align-items: center;
    color: var(--neon-yellow);
    font-size: 0.8rem;
}

.thinking-dots {
    display: inline-flex;
    gap: 2px;
    margin-left: 8px;
}

.thinking-dots span {
    width: 4px;
    height: 4px;
    background: var(--neon-yellow);
    border-radius: 50%;
    animation: thinking 1.4s infinite both;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes thinking {
    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.darkfoo-streaming-content {
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    overflow-y: auto;
    max-height: 300px;
    padding-right: 10px;
}

/* Code Block Styling */
.darkfoo-code-block {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-radius: 6px;
    margin: 15px 0;
    overflow: hidden;
    position: relative;
}

.darkfoo-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 255, 255, 0.1);
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    font-size: 0.8rem;
}

.darkfoo-code-lang {
    color: var(--neon-cyan);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.1em;
}

.darkfoo-code-actions {
    display: flex;
    gap: 8px;
}

.darkfoo-code-copy {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--neon-cyan);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.darkfoo-code-copy:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
    transform: translateY(-1px);
}

.darkfoo-code-content {
    padding: 0;
    overflow-x: auto;
}

.darkfoo-code {
    display: block;
    padding: 15px;
    font-family: 'Fira Code', Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #fff;
    background: transparent;
    overflow-x: auto;
    white-space: pre;
}

/* Inline Code */
.darkfoo-inline-code {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--neon-cyan);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Fira Code', Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.9em;
}

/* Headers */
.darkfoo-header-1 {
    color: var(--neon-pink);
    font-size: 1.5rem;
    font-weight: bold;
    margin: 20px 0 10px;
    text-shadow: 0 0 10px var(--neon-pink);
    border-bottom: 2px solid var(--neon-pink);
    padding-bottom: 5px;
}

.darkfoo-header-2 {
    color: var(--neon-cyan);
    font-size: 1.3rem;
    font-weight: bold;
    margin: 15px 0 8px;
    text-shadow: 0 0 8px var(--neon-cyan);
}

.darkfoo-header-3 {
    color: var(--neon-yellow);
    font-size: 1.1rem;
    font-weight: bold;
    margin: 12px 0 6px;
    text-shadow: 0 0 6px var(--neon-yellow);
}

/* Lists */
.darkfoo-list {
    margin: 10px 0;
    padding-left: 20px;
}

.darkfoo-list-item {
    margin: 5px 0;
    color: #fff;
    position: relative;
}

.darkfoo-list-item::marker {
    color: var(--neon-cyan);
}

/* Links */
.darkfoo-link {
    color: var(--neon-cyan);
    text-decoration: none;
    border-bottom: 1px dotted var(--neon-cyan);
    transition: all 0.2s ease;
}

.darkfoo-link:hover {
    color: var(--neon-pink);
    border-bottom-color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink);
}

/* Emphasis */
.darkfoo-bold {
    color: var(--neon-yellow);
    font-weight: bold;
    text-shadow: 0 0 3px var(--neon-yellow);
}

.darkfoo-italic {
    color: var(--neon-pink);
    font-style: italic;
}

/* Response Actions */
.darkfoo-response-actions {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(0, 255, 255, 0.2);
}

.darkfoo-response-copy,
.darkfoo-response-export {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--neon-cyan);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.darkfoo-response-copy:hover,
.darkfoo-response-export:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* Command Help Styling */
.category-header {
    color: var(--neon-pink);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 0 0 5px var(--neon-pink);
    display: block;
    margin: 15px 0 5px;
}

.command-name {
    color: var(--neon-cyan);
    font-weight: bold;
}

.command-title {
    color: var(--neon-yellow);
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 0 8px var(--neon-yellow);
    display: block;
    margin-bottom: 10px;
}

.section-header {
    color: var(--neon-pink);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 0 0 5px var(--neon-pink);
    display: block;
    margin: 15px 0 5px;
}

.subcommand-name,
.flag-name {
    color: var(--neon-cyan);
    font-weight: bold;
}

.history-number {
    color: var(--neon-yellow);
    font-weight: bold;
    margin-right: 8px;
}

/* Error Styling */
.error {
    color: var(--neon-pink);
    background: rgba(255, 0, 128, 0.1);
    border: 1px solid rgba(255, 0, 128, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    display: inline-block;
    margin: 5px 0;
    text-shadow: 0 0 5px var(--neon-pink);
}

/* Touch feedback for mobile */
.touch-active {
    transform: scale(0.95) !important;
    opacity: 0.8 !important;
    transition: all 0.15s ease !important;
}

/* Mobile body optimizations */
.darkfoo-mobile {
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 255, 255, 0.3);
    touch-action: manipulation;
}

.darkfoo-mobile * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.darkfoo-mobile .terminal-input,
.darkfoo-mobile .darkfoo-response-content {
    -webkit-user-select: text;
    user-select: text;
}

/* Mobile Responsive Enhancements */
@media (width <= 768px) {
    .darkfoo-response-container {
        margin: 8px 0;
        border-radius: 6px;
    }

    .darkfoo-response-header {
        padding: 6px 10px;
        font-size: 0.8rem;
        flex-wrap: wrap;
        gap: 5px;
    }

    .darkfoo-response-content {
        padding: 12px;
        font-size: 0.9rem;
    }

    .darkfoo-code-block {
        margin: 10px 0;
    }

    .darkfoo-code-header {
        padding: 6px 10px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .darkfoo-code {
        padding: 12px;
        font-size: 0.85rem;
    }

    .darkfoo-response-actions {
        padding: 8px 10px;
        flex-wrap: wrap;
    }

    .darkfoo-response-copy,
    .darkfoo-response-export {
        padding: 8px 12px;
        font-size: 0.85rem;
        flex: 1;
        min-width: 120px;
        text-align: center;
    }

    /* Terminal specific mobile adjustments */
    .terminal-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    .terminal-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
    }

    .terminal-input-line {
        padding: 10px;
    }

    .terminal-prompt {
        font-size: 1rem;
    }
}

@media (width <= 480px) {
    .darkfoo-response-header {
        font-size: 0.75rem;
    }

    .darkfoo-response-content {
        font-size: 0.85rem;
        padding: 10px;
    }

    .darkfoo-code {
        font-size: 0.8rem;
        padding: 10px;
    }

    .darkfoo-header-1 {
        font-size: 1.3rem;
    }

    .darkfoo-header-2 {
        font-size: 1.1rem;
    }

    .darkfoo-header-3 {
        font-size: 1rem;
    }

    .darkfoo-code-copy {
        padding: 6px 8px;
        font-size: 0.7rem;
    }

    .copy-icon {
        display: none; /* Hide icon on very small screens */
    }
}

/* Enhanced Terminal Mobile Responsiveness */
@media (width <= 768px) {
    .terminal-toggle {
        padding: 12px 20px;
        font-size: 1rem;
        bottom: 20px;
        right: 20px;
        border-radius: 25px;
        box-shadow: 0 4px 20px rgba(0, 255, 255, 0.4);
    }

    .terminal-container.mobile-active {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
    }

    .terminal-header {
        padding: 15px;
        border-bottom: 2px solid var(--neon-cyan);
    }

    .terminal-title {
        font-size: 1.1rem;
    }

    .terminal-content {
        padding: 15px;
        height: calc(100vh - 120px);
        overflow-y: auto;
    }

    .terminal-input-line {
        position: sticky;
        bottom: 0;
        background: rgba(0, 0, 0, 0.9);
        border-top: 1px solid var(--neon-cyan);
        padding: 15px;
    }

    /* Touch-friendly scrollbars */
    .terminal-content::-webkit-scrollbar {
        width: 8px;
    }

    .terminal-content::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.3);
    }

    .terminal-content::-webkit-scrollbar-thumb {
        background: var(--neon-cyan);
        border-radius: 4px;
    }
}

/* Syntax Highlighting Cyberpunk Theme */
.darkfoo-hljs-keyword {
    color: #ff0080 !important;
    font-weight: bold;
}

.darkfoo-hljs-string {
    color: #00ff80 !important;
}

.darkfoo-hljs-number {
    color: #0080ff !important;
}

.darkfoo-hljs-comment {
    color: #808080 !important;
    font-style: italic;
}

.darkfoo-hljs-function {
    color: #ff8000 !important;
    font-weight: bold;
}

.darkfoo-hljs-variable {
    color: #0ff !important;
}

.darkfoo-hljs-class {
    color: #ff0 !important;
    font-weight: bold;
}

.darkfoo-hljs-tag {
    color: #ff0080 !important;
}

.darkfoo-hljs-attribute {
    color: #00ff80 !important;
}

.darkfoo-hljs-value {
    color: #0080ff !important;
}

.darkfoo-hljs-operator {
    color: #fff !important;
}

.darkfoo-hljs-punctuation {
    color: #ccc !important;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .darkfoo-response-container {
        animation: none;
    }

    .thinking-dots span {
        animation: none;
        opacity: 1;
    }

    .darkfoo-code-copy:hover,
    .darkfoo-response-copy:hover,
    .darkfoo-response-export:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .darkfoo-response-container {
        border-width: 2px;
        background: rgba(0, 0, 0, 0.95);
    }

    .darkfoo-code-block {
        border-width: 2px;
        background: rgba(0, 0, 0, 0.9);
    }

    .darkfoo-inline-code {
        border-width: 2px;
    }
}
