/* Modern Website CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #dc2626;
    --accent-color: #059669;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-dark: #111827;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation Styles */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 70px;
}

.nav-logo {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-subtitle {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.nav-cta .access-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-cta .access-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Hero Section */
.hero {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.8) 0%, rgba(220, 38, 38, 0.6) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero-text {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    color: white;
    padding: 0 20px;
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.1;
}

.title-main {
    display: block;
    color: white;
}

.title-accent {
    display: block;
    color: #fbbf24;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 40px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #fbbf24;
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: white;
    color: var(--text-primary);
}

/* Mission Section */
.mission {
    padding: 100px 0;
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.mission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.mission-card {
    background: white;
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform 0.3s ease;
}

.mission-card:hover {
    transform: translateY(-5px);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.mission-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.mission-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Technology Section */
.technology {
    padding: 100px 0;
    background: white;
}

.tech-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.tech-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.7;
}

.tech-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.feature-icon {
    font-size: 1.2rem;
}

.tech-preview {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 30px;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.preview-item {
    background: #1f2937;
    border: 2px solid #374151;
    border-radius: 8px;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', monospace;
}

/* Footer */
.footer {
    background: var(--bg-dark);
    color: white;
    padding: 60px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: white;
}

.footer-section p,
.footer-section ul {
    color: #9ca3af;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 30px;
    text-align: center;
    color: #6b7280;
}

/* Control Center Styles */
.control-center {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-dark);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 2000;
}

.control-header {
    background: #1f2937;
    border-bottom: 1px solid #374151;
    padding: 20px 0;
}

.control-nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: #9ca3af;
    border: 1px solid #374151;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.back-btn:hover {
    color: white;
    border-color: #6b7280;
    background: #374151;
}

.control-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #10b981;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.control-main {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
}

/* Video Section */
.video-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.video-section h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
}

.feed-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: #374151;
    color: #9ca3af;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #4b5563;
    color: white;
}

.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    height: calc(100vh - 200px);
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #374151;
    transition: border-color 0.3s ease;
    height: 300px; /* Ensure consistent height */
}

.video-container:hover {
    border-color: var(--primary-color);
}

.video-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.15s ease-in-out;
}

/* Video visibility states for seamless switching */
.video-active {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
}

.video-hidden {
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 12px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    z-index: 3;
}

.video-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
}

.video-status {
    background: var(--secondary-color);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    animation: blink 2s infinite;
    position: absolute;
    top: 12px;
    right: 12px;
}

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

/* Control Panel */
.control-panel {
    background: #1f2937;
    border-radius: 12px;
    border: 1px solid #374151;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}

.assistant-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--accent-color);
}

.ai-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    animation: pulse 2s infinite;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100%;
    min-height: 0; /* Important for flex shrinking */
    overflow: hidden; /* Prevent container overflow */
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 300px); /* Prevent breaking page layout */
    min-height: 200px;
    padding-right: 8px; /* Space for scrollbar */
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.system-message .message-content {
    background: #374151;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    max-width: 280px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: var(--accent-color);
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-right-radius: 4px;
    max-width: 280px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: #374151;
    border: 1px solid #4b5563;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    background: var(--primary-dark);
}

.quick-actions {
    padding: 20px;
    border-top: 1px solid #374151;
}

.quick-actions h4 {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 16px;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-btn {
    background: #374151;
    color: #9ca3af;
    border: 1px solid #4b5563;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-align: center;
}

.action-btn:hover {
    background: #4b5563;
    color: white;
    border-color: var(--primary-color);
}

.action-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #374151;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .control-main {
        grid-template-columns: 1fr;
        grid-template-rows: 2fr 1fr;
        gap: 15px;
    }
    
    .video-grid {
        height: 60vh;
    }
    
    .control-panel {
        height: 35vh;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .tech-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .mission-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .control-nav {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .control-main {
        padding: 15px;
    }
    
    .chat-container {
        padding: 15px;
    }
    
    .chat-messages {
        max-height: calc(100vh - 400px); /* More space for mobile keyboard */
        min-height: 150px;
        gap: 12px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

.container {
    display: flex;
    height: 100vh;
    gap: 20px;
    padding: 20px;
}

.video-section {
    flex: 2;
    display: flex;
    flex-direction: column;
}

.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 350px;
}

.section-title {
    color: #00ff00;
    font-size: 18px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid #00ff00;
    padding-bottom: 5px;
}

/* Video Grid Styles */
.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    height: 100%;
    background-color: #1a1a1a;
    padding: 15px;
    border: 2px solid #333;
    border-radius: 5px;
}

.video-container {
    position: relative;
    background-color: #000;
    border: 2px solid #333;
    border-radius: 3px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.video-container:hover {
    border-color: #00ff00;
}

.video-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
}

.video-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 3px;
    font-weight: bold;
}

/* Chat Interface Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #1a1a1a;
    border: 2px solid #333;
    border-radius: 5px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 300px);
    min-height: 200px;
    padding-right: 23px; /* Space for scrollbar + original padding */
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.system-message .message-content {
    background-color: #2a2a2a;
    color: #00ff00;
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #00ff00;
}

.user-message .message-content {
    background-color: #003300;
    color: #ffffff;
    padding: 10px;
    border-radius: 5px;
    margin-left: 20px;
    border-right: 3px solid #00ff00;
}

.chat-input-container {
    display: flex;
    padding: 15px;
    background-color: #2a2a2a;
    border-top: 1px solid #333;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background-color: #000;
    border: 1px solid #333;
    color: #00ff00;
    padding: 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.chat-input:focus {
    outline: none;
    border-color: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.send-button {
    background-color: #003300;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 10px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
}

.send-button:hover {
    background-color: #00ff00;
    color: #000;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background-color: #2a2a2a;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #00ff00;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }
    
    .video-section {
        flex: 1;
    }
    
    .chat-section {
        flex: 0 0 300px;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
        gap: 10px;
    }
    
    .video-grid {
        padding: 10px;
    }
    
    .section-title {
        font-size: 16px;
    }
}

/* Loading placeholder for videos */
.video-feed::before {
    content: "NO SIGNAL";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff0000;
    font-size: 14px;
    font-weight: bold;
    z-index: 1;
}