/* Root Variables */
:root {
    --bg-dark: #0a0e14;
    --bg-darker: #050810;
    --bg-panel: #0f1419;
    --bg-input: #1a1f29;
    --text-primary: #e6e6e6;
    --text-secondary: #8a8a8a;
    --text-muted: #4a4a4a;
    --accent-primary: #00d9ff;
    --accent-secondary: #00ff88;
    --accent-warn: #ffaa00;
    --accent-error: #ff4444;
    --accent-purple: #bb86fc;
    --border-color: #1e2530;
    --glow-color: rgba(0, 217, 255, 0.5);
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-mono);
    background: var(--bg-darker);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* ======================== */
/* STARTUP ANIMATION SCREEN */
/* ======================== */

.startup-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0e14 0%, #1a1f29 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-in;
}

.startup-content {
    text-align: center;
    animation: slideUp 1s ease-out;
}

.logo-container {
    position: relative;
    margin-bottom: 2rem;
    animation: logoAppear 1.5s ease-out;
}

.startup-logo {
    width: 180px;
    height: 180px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 217, 255, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow 2s ease-in-out infinite;
    z-index: -1;
}

.startup-text .company-name {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    animation: textGlow 2s ease-in-out infinite;
}

.startup-text .tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.loading-bar {
    width: 400px;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    margin: 2rem auto;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    animation: loading 3s ease-in-out forwards;
}

.system-status {
    margin-top: 2rem;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.status-line {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    opacity: 0;
    animation: fadeInLine 0.5s ease-out forwards;
}

.status-line:nth-child(1) { animation-delay: 0.5s; }
.status-line:nth-child(2) { animation-delay: 1.5s; }
.status-line:nth-child(3) { animation-delay: 2.5s; }
.status-line:nth-child(4) { animation-delay: 3.5s; }

.status-line.ready {
    color: var(--accent-secondary);
    font-weight: 600;
}

.status-line::before {
    content: '▸ ';
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

/* ======================== */
/* MAIN APPLICATION         */
/* ======================== */

.main-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

.main-app:not(.hidden) {
    opacity: 1;
}

.hidden {
    display: none !important;
}

/* Header */
.terminal-header {
    background: var(--bg-panel);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-center {
    flex: 1;
    text-align: center;
}

.session-id {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-secondary);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.busy .status-dot {
    background: var(--accent-warn);
}

.status-indicator.error .status-dot {
    background: var(--accent-error);
}

.btn-new-session {
    background: var(--accent-primary);
    color: var(--bg-dark);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-new-session:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.4);
}

/* Content Wrapper */
.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Terminal Panel */
.terminal-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-right: 2px solid var(--border-color);
}

.terminal-controls {
    background: var(--bg-dark);
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.terminal-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.control-buttons {
    display: flex;
    gap: 0.5rem;
}

.control-buttons button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-buttons button:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-clear {
    font-size: 0.8rem !important;
    padding: 0 0.5rem;
    width: auto !important;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    background: var(--bg-darker);
}

.terminal-output::-webkit-scrollbar {
    width: 8px;
}

.terminal-output::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.terminal-output::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.welcome-message {
    color: var(--accent-primary);
}

.ascii-art {
    font-size: 0.5rem;
    line-height: 1.2;
    color: var(--accent-secondary);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.welcome-message p {
    margin: 0.5rem 0;
}

.hint {
    color: var(--text-secondary);
    font-style: italic;
}

.terminal-line {
    margin: 0.5rem 0;
    animation: fadeIn 0.3s ease-in;
}

.command-line {
    color: var(--accent-primary);
    margin-bottom: 0.3rem;
}

.output-line {
    color: var(--text-primary);
    margin-left: 1rem;
}

.error-line {
    color: var(--accent-error);
    margin-left: 1rem;
}

.success-line {
    color: var(--accent-secondary);
}

.terminal-input-line {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-input);
    border-top: 1px solid var(--border-color);
}

.prompt {
    color: var(--accent-primary);
    font-weight: 600;
    margin-right: 0.8rem;
    flex-shrink: 0;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    outline: none;
}

.terminal-input::placeholder {
    color: var(--text-muted);
}

.terminal-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Agent Panel */
.agent-panel {
    width: 420px;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
}

.agent-header {
    background: var(--bg-dark);
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.agent-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-secondary);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.agent-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-darker);
}

.agent-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.idle-animation {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 2rem;
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    opacity: 0.3;
}

.ring-1 {
    width: 180px;
    height: 180px;
    animation: rotate 10s linear infinite;
}

.ring-2 {
    width: 140px;
    height: 140px;
    animation: rotate 7s linear infinite reverse;
    border-color: var(--accent-secondary);
}

.ring-3 {
    width: 100px;
    height: 100px;
    animation: rotate 5s linear infinite;
    border-color: var(--accent-purple);
}

.agent-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, var(--accent-primary), transparent);
    border-radius: 50%;
    animation: corePulse 2s ease-in-out infinite;
}

.idle-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.agent-coding {
    display: none;
}

.agent-coding.active {
    display: block;
}

.code-stream {
    font-size: 0.85rem;
    line-height: 1.8;
}

.code-line {
    opacity: 0;
    animation: streamIn 0.5s ease-out forwards;
}

.code-line:nth-child(1) { animation-delay: 0.1s; }
.code-line:nth-child(2) { animation-delay: 0.2s; }
.code-line:nth-child(3) { animation-delay: 0.3s; }

.code-keyword { color: var(--accent-purple); }
.code-string { color: var(--accent-secondary); }
.code-function { color: var(--accent-primary); }
.code-comment { color: var(--text-muted); font-style: italic; }

/* Quick Actions */
.quick-actions {
    background: var(--bg-panel);
    border-top: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.quick-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-btn:hover {
    background: var(--accent-primary);
    color: var(--bg-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

.btn-icon {
    font-size: 1rem;
}

/* ======================== */
/* ANIMATIONS               */
/* ======================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes logoAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) rotateY(180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes glow {
    0%, 100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

@keyframes textGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3);
    }
}

@keyframes loading {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes fadeInLine {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes corePulse {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

@keyframes streamIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .agent-panel {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .agent-panel {
        width: 100%;
        height: 300px;
        border-right: none;
        border-top: 2px solid var(--border-color);
    }
    
    .quick-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}
