@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Accessibility - Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 6px;
  background: var(--term-info);
  color: var(--term-bg);
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 600;
  z-index: 1000;
  border-radius: 4px;
  transition: top 0.3s;
  opacity: 0;
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.skip-link:focus {
  top: 6px;
  opacity: 1;
  pointer-events: auto;
}

:root {
    /* Terminal Colors - Classic Green */
    --term-bg: #0c0c0c;
    --term-fg: #33ff33;
    --term-fg-dim: #196619;
    --term-prompt: #00ff00;
    --term-path: #88ff88;
    --term-error: #ff3333;
    --term-warning: #ffaa33;
    --term-info: #3399ff;
    --term-success: #33ff33;
    --term-link: #33ddff;
    --term-header: #ffff33;
    
    /* Terminal UI */
    --term-header-bg: #2d2d2d;
    --term-border: #444;
    --control-red: #ff5f56;
    --control-yellow: #ffbd2e;
    --control-green: #27c93f;
    
    /* Sizing */
    --term-font-size: 14px;
    --term-line-height: 1.5;
    --term-padding: 20px;
}

/* Amber Theme */
[data-theme="amber"] {
    --term-fg: #ffb000;
    --term-fg-dim: #cc8800;
    --term-prompt: #ffa000;
    --term-path: #ffcc66;
    --term-success: #ffb000;
    --term-link: #ffd700;
}

/* Matrix Theme */
[data-theme="matrix"] {
    --term-bg: #000000;
    --term-fg: #00ff41;
    --term-fg-dim: #008f11;
    --term-prompt: #00ff41;
    --term-path: #00ff41;
    --term-header: #00ff41;
}

/* Blue Theme */
[data-theme="blue"] {
    --term-fg: #4dd0e1;
    --term-fg-dim: #26a69a;
    --term-prompt: #00bcd4;
    --term-path: #80deea;
    --term-success: #4dd0e1;
    --term-link: #40c4ff;
    --term-header: #84ffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    background-color: var(--term-bg);
    color: var(--term-fg);
    font-size: var(--term-font-size);
    line-height: var(--term-line-height);
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#terminal-container {
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 800px;
    background-color: var(--term-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 255, 0, 0.1),
                0 0 80px rgba(0, 255, 0, 0.05),
                inset 0 0 120px rgba(0, 255, 0, 0.02);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--term-border);
}

#terminal-header {
    background-color: var(--term-header-bg);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--term-border);
    user-select: none;
}

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

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

.control:hover {
    opacity: 0.8;
}

.control.close {
    background-color: var(--control-red);
}

.control.minimize {
    background-color: var(--control-yellow);
}

.control.maximize {
    background-color: var(--control-green);
}

.terminal-title {
    font-size: 13px;
    color: #ccc;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

#terminal-body {
    flex: 1;
    padding: var(--term-padding);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 0, 0.01) 2px,
            rgba(0, 255, 0, 0.01) 4px
        );
}

/* Scrollbar Styling */
#terminal-body::-webkit-scrollbar {
    width: 10px;
}

#terminal-body::-webkit-scrollbar-track {
    background: rgba(0, 255, 0, 0.05);
}

#terminal-body::-webkit-scrollbar-thumb {
    background: var(--term-fg-dim);
    border-radius: 5px;
}

#terminal-body::-webkit-scrollbar-thumb:hover {
    background: var(--term-fg);
}

#output {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 10px;
}

.input-line {
    display: flex;
    align-items: center;
    position: relative;
}

.prompt {
    margin-right: 8px;
    user-select: none;
}

.user {
    color: var(--term-prompt);
    font-weight: 600;
}

.path {
    color: var(--term-path);
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--term-fg);
    font-family: inherit;
    font-size: inherit;
    caret-color: transparent;
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 18px;
    background-color: var(--term-fg);
    animation: blink 1s infinite;
    position: absolute;
    left: 0;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Command Output Styles */
.command-line {
    color: var(--term-fg);
    margin-bottom: 0.5em;
    font-family: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}

.output-line {
    color: var(--term-fg);
    margin-bottom: 0.2em;
    font-family: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}

.error {
    color: var(--term-error);
}

.warning {
    color: var(--term-warning);
}

.info {
    color: var(--term-info);
}

.success {
    color: var(--term-success);
}

.dim {
    color: var(--term-fg-dim);
}

.header {
    color: var(--term-header);
    font-weight: 600;
    margin: 1em 0 0.5em 0;
}

.link {
    color: var(--term-link);
    text-decoration: underline;
    cursor: pointer;
}

.link:hover {
    text-shadow: 0 0 5px currentColor;
}

/* ASCII Art */
.ascii-art {
    color: var(--term-header);
    line-height: 1.2;
    margin: 1em 0;
    font-size: 12px;
}

/* Directory Listing */
.ls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 1em 0;
}

.ls-item {
    color: var(--term-fg);
}

.ls-dir {
    color: var(--term-path);
    font-weight: 600;
}

.ls-file {
    color: var(--term-fg);
}

.ls-executable {
    color: var(--term-success);
}

/* Table Style */
.terminal-table {
    margin: 1em 0;
    border-collapse: collapse;
    font-family: inherit;
    width: 100%;
}

.terminal-table th,
.terminal-table td {
    padding: 0.5em 1em;
    text-align: left;
    border-bottom: 1px solid var(--term-fg-dim);
    font-family: inherit;
}

.terminal-table th {
    color: var(--term-header);
    font-weight: 600;
}

/* Enhanced output formatting */
#output > div {
    font-family: inherit;
    line-height: var(--term-line-height);
}

/* Fix text alignment for project displays */
.project-output {
    margin-left: 0;
    padding-left: 0;
}

.project-output .success {
    display: inline-block;
    min-width: 120px;
}

/* Tag styling in terminal */
.tag {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 3px;
    margin-left: 8px;
    font-family: inherit;
}

.tag.live {
    background-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.tag.coming-soon {
    background-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.tag.vision-pro {
    background-color: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.tag.apps {
    background-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.tag.privacy {
    background-color: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

/* Loading Animation */
.loading {
    display: inline-block;
}

.loading::after {
    content: '';
    animation: loading 1s infinite;
}

@keyframes loading {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* Typewriter Effect */
.typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    animation: typewriter 2s steps(40) 1s 1 normal both;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    :root {
        --term-font-size: 12px;
        --term-padding: 15px;
    }
    
    #terminal-container {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
    
    .terminal-controls {
        display: none;
    }
    
    #terminal-body {
        padding: var(--term-padding);
    }
}

/* CRT Effect (Optional) */
.crt-effect {
    position: relative;
}

.crt-effect::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1;
}

.crt-effect::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 255, 0, 0.05) 0%,
        rgba(0, 0, 0, 0.1) 100%
    );
    pointer-events: none;
    z-index: 2;
}

/* Hidden until JavaScript loads */
.no-js #terminal-input {
    display: none;
}

.no-js .cursor {
    display: none;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    #terminal-container {
        box-shadow: none;
        border: 1px solid black;
    }
    
    #terminal-header {
        display: none;
    }
}