/* Lunar Corp - Modern Minimalist Redesign */

:root {
    /* Base colors - Light theme */
    --bg-base: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;

    /* Text colors */
    --text-primary: #1a1d1f;
    --text-secondary: #60656a;
    --text-tertiary: #9da3a8;

    /* Borders and dividers */
    --border: #e6e8ea;
    --divider: #f0f1f2;

    /* Accent colors (max 3 + cheese) */
    --accent-primary: #4a5568;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --cheese-accent: #fbbf24;

    /* Spacing system (8px scale) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    padding: var(--space-lg);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header - Clean and minimal */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xl);
    background: var(--bg-surface);
    border-radius: var(--space-sm);
    border: 1px solid var(--border);
    margin-bottom: var(--space-xl);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.logo h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

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

.tagline-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
    font-style: italic;
    margin-top: var(--space-xs);
}

.crisis-level {
    text-align: right;
}

.crisis-level .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.crisis-level .value {
    font-size: 0.875rem;
    font-weight: 600;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--space-xs);
    display: inline-block;
    background: var(--accent-error);
    color: white;
}

.crisis-level .value.critical {
    animation: none; /* Remove pulsing */
}

/* Main Grid - Balanced layout */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

/* Map gets full width at top */
.lunar-map-visual {
    grid-column: 1 / -1;
}

/* Then balanced two-column below */
.content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

/* Card styling - Clean and minimal */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--space-sm);
    padding: var(--space-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--divider);
}

/* Map Container */
.map-visual-container {
    background: var(--bg-surface);
    border-radius: var(--space-sm);
    padding: var(--space-xl);
    position: relative;
}

#lunarBaseSvg {
    width: 100%;
    height: auto;
    display: block;
}

/* SVG Interactive elements */
.sector-node {
    cursor: pointer;
    transition: all 0.2s;
}

.sector-node:hover circle {
    filter: brightness(1.1);
    stroke-width: 3;
}

/* Map Legend */
.map-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--divider);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Stats - Compact and clean */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.stat-item {
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--space-sm);
    transition: border-color 0.2s;
}

.stat-item:hover {
    border-color: var(--accent-primary);
}

.stat-item.critical-stat {
    border-color: var(--accent-error);
    background: rgba(239, 68, 68, 0.02);
}

.stat-item.cheese-stat {
    border-color: var(--cheese-accent);
    background: rgba(251, 191, 36, 0.02);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    display: block;
    animation: bobIcon 3s ease-in-out infinite;
}

@keyframes bobIcon {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Task Board - Simplified */
.task-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.task-column h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.task-list {
    background: var(--bg-base);
    border: 1px dashed var(--border);
    border-radius: var(--space-sm);
    padding: var(--space-sm);
    min-height: 120px;
}

.task-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--space-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    cursor: move;
    transition: all 0.2s;
}

.task-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.task-card p {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.task-priority {
    display: inline-block;
    padding: 2px var(--space-sm);
    border-radius: var(--space-xs);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: var(--space-sm);
}

.task-priority.high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-error);
}

.task-priority.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-warning);
}

.task-priority.low {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-success);
}

.add-task-section {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

#newTaskInput {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--space-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
}

#newTaskInput:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#addTaskBtn {
    padding: var(--space-sm) var(--space-lg);
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

#addTaskBtn:hover {
    background: #3a4555;
}

/* Flight Tracker - Compact */
.flight-route {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-base);
    border-radius: var(--space-sm);
}

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

.route-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, var(--accent-success), var(--accent-primary));
    position: relative;
}

.flight-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.detail {
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--space-sm);
}

.detail-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.detail-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-ok {
    color: var(--accent-success);
}

/* Chat Section */
.chat-section {
    position: sticky;
    top: var(--space-lg);
}

.chat-instructions {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.artifact-container {
    border: 1px solid var(--border);
    border-radius: var(--space-sm);
    overflow: hidden;
    background: var(--bg-surface);
    height: 800px;
    position: relative;
}

.artifact-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Footer */
footer {
    margin-top: var(--space-2xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--divider);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .chat-section {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    body {
        padding: var(--space-md);
    }

    header {
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
    }

    .crisis-level {
        text-align: center;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .task-board {
        grid-template-columns: 1fr;
    }

    .flight-details {
        grid-template-columns: 1fr;
    }
}

/* Floating cheese animations */
.cheese-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-cheese {
    position: absolute;
    font-size: 2rem;
    animation: floatCheese 6s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes floatCheese {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(10deg);
    }
}

/* Spaceship and cargo in flight tracker */
.route-line {
    position: relative;
    height: 2px;
}

.spaceship-container {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem;
    animation: flySpaceship 8s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(251, 191, 36, 0.3));
}

.cargo-emoji {
    font-size: 1.2rem;
    margin-left: -5px;
    animation: spinCheese 2s linear infinite;
}

@keyframes flySpaceship {
    0% {
        left: 0%;
        transform: translateY(-50%) rotate(-15deg);
    }
    50% {
        left: 95%;
        transform: translateY(-50%) rotate(15deg);
    }
    51% {
        transform: translateY(-50%) scaleX(-1) rotate(-15deg);
    }
    100% {
        left: 0%;
        transform: translateY(-50%) scaleX(-1) rotate(15deg);
    }
}

@keyframes spinCheese {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
}

/* Pulse animation for crisis level */
.crisis-level .value.critical {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.robot, .cargo {
    pointer-events: none;
}
