/* ============================================
   Interactive Terminal Overlay
   ============================================ */

/* Terminal Overlay */
.terminal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.terminal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Terminal Window */
.terminal-window {
    width: min(900px, 92vw);
    height: min(560px, 80vh);
    background: #0d1117;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(139, 92, 246, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

.terminal-overlay.active .terminal-window {
    transform: scale(1) translateY(0);
}

/* Terminal Top Bar */
.terminal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: #161b22;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    user-select: none;
    flex-shrink: 0;
}

.terminal-dots {
    display: flex;
    gap: 8px;
}

.terminal-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.terminal-dots span:hover {
    opacity: 0.8;
}

.terminal-dots .dot-red {
    background: #ff5f57;
}

.terminal-dots .dot-yellow {
    background: #febc2e;
}

.terminal-dots .dot-green {
    background: #28c840;
}

.terminal-title {
    font-size: 0.75rem;
    color: #8b949e;
    letter-spacing: 0.5px;
}

.terminal-close-btn {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.terminal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e6edf3;
}

/* Terminal Body - scrollable output area */
.terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.2rem;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #e6edf3;
    scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar {
    width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
    background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Output Lines */
.terminal-line {
    margin-bottom: 0.15rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.terminal-line.command-line {
    color: #58a6ff;
}

.terminal-line .prompt {
    color: #7ee787;
    margin-right: 0.2rem;
}

.terminal-line .cmd-text {
    color: #e6edf3;
}

.terminal-line.output {
    color: #c9d1d9;
}

.terminal-line.error {
    color: #f85149;
}

.terminal-line.success {
    color: #7ee787;
}

.terminal-line.accent {
    color: #d2a8ff;
}

.terminal-line.muted {
    color: #8b949e;
}

.terminal-line.highlight {
    color: #79c0ff;
}

.terminal-line.warning {
    color: #febc2e;
}

/* ASCII Art Styling */
.terminal-ascii {
    color: #a855f7;
    line-height: 1.2;
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
}

/* Links in terminal */
.terminal-link {
    color: #58a6ff;
    text-decoration: none;
    border-bottom: 1px dashed rgba(88, 166, 255, 0.4);
    transition: all 0.2s ease;
}

.terminal-link:hover {
    color: #79c0ff;
    border-bottom-color: #79c0ff;
}

/* Neofetch-style grid */
.terminal-neofetch {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 1.5rem;
    margin: 0.5rem 0;
}

.terminal-neofetch .nf-ascii {
    color: #a855f7;
    font-size: 0.7rem;
    line-height: 1.25;
    white-space: pre;
}

.terminal-neofetch .nf-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nf-info .nf-row {
    margin-bottom: 0.1rem;
}

.nf-info .nf-label {
    color: #7ee787;
    font-weight: 600;
}

.nf-info .nf-value {
    color: #c9d1d9;
}

.nf-info .nf-separator {
    color: #8b949e;
    margin: 0.2rem 0;
    border: none;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Color palette row for neofetch */
.nf-colors {
    display: flex;
    gap: 4px;
    margin-top: 0.3rem;
}

.nf-colors span {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* Terminal Input Line */
.terminal-input-line {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.2rem;
    background: #0d1117;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.terminal-input-line .prompt {
    color: #7ee787;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    margin-right: 0.5rem;
    white-space: nowrap;
    user-select: none;
}

.terminal-input-line input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e6edf3;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    caret-color: #7ee787;
    padding: 0;
}

.terminal-input-line input::placeholder {
    color: #484f58;
}

/* Tab completion hint */
.terminal-tab-hint {
    color: #484f58;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    font-style: italic;
    white-space: nowrap;
}

/* Hint bar at bottom */
.terminal-hint-bar {
    padding: 0.35rem 1.2rem;
    background: #161b22;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: #484f58;
    flex-shrink: 0;
}

.terminal-hint-bar kbd {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 2px;
}

/* ============================================
   Light Theme Overrides
   ============================================ */
[data-theme="light"] .terminal-overlay {
    background: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .terminal-window {
    background: #1e1e2e;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4), 0 0 40px rgba(139, 92, 246, 0.08);
}

[data-theme="light"] .terminal-topbar {
    background: #262637;
}

[data-theme="light"] .terminal-body {
    color: #cdd6f4;
}

[data-theme="light"] .terminal-input-line {
    background: #1e1e2e;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .terminal-window {
        width: 96vw;
        height: 85vh;
        border-radius: 10px;
    }

    .terminal-body {
        font-size: 0.75rem;
        padding: 0.8rem;
    }

    .terminal-input-line input {
        font-size: 0.78rem;
    }

    .terminal-input-line .prompt {
        font-size: 0.78rem;
    }

    .terminal-neofetch {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .terminal-neofetch .nf-ascii {
        font-size: 0.55rem;
    }

    .terminal-fab {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 12px;
        bottom: 1rem;
        right: 1rem;
        gap: 0;
    }

    .terminal-fab svg {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
        margin: 0;
    }

    .terminal-fab span {
        display: none;
    }
}

/* ============================================
   Floating Terminal Toggle Button (Mobile)
   ============================================ */
.terminal-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    height: 44px;
    padding: 0 1.2rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    /* Darker emerald green */
    border: none;
    color: white;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.terminal-fab:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 28px rgba(16, 185, 129, 0.4);
}

.terminal-fab svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}