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

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-dark: #0f0f13;
  --glass-bg: rgba(25, 25, 30, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: #a0a0a5;
  --accent-color: #0071e3;
  --accent-hover: #0077ed;
  --sidebar-width: 80px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Blobs for Glassmorphism Context */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.5;
  pointer-events: none;
}

body::before {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, #4318ff 0%, transparent 70%);
}

body::after {
  bottom: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, #b122e5 0%, transparent 70%);
}

/* Left Sidebar Header */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 0;
  z-index: 100;
}

.brand-logo svg {
  width: 40px;
  height: 40px;
  fill: var(--text-primary);
  margin-bottom: 40px;
  transition: var(--transition);
}

.brand-logo:hover svg {
  transform: scale(1.1);
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  align-items: center;
}

.nav-item {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-primary);
  background: var(--glass-highlight);
}

.nav-item .tooltip {
  position: absolute;
  left: 60px;
  background: var(--text-primary);
  color: var(--bg-dark);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px);
  transition: var(--transition);
  white-space: nowrap;
}

.nav-item:hover .tooltip {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-footer {
  margin-top: auto;
}

/* Layout Core */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 40px;
  display: flex;
  flex-direction: column;
}

/* Glass Panels */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Hero Section (Index) */
.hero-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 1s ease-out forwards;
}

.hero-title {
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 0%, #a0a0a5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 600px;
}

/* Input Area (Shared between Home and Demo) */
.input-container {
  width: 100%;
  max-width: 600px;
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 6px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition);
}

.input-container:focus-within {
  border-color: var(--glass-highlight);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.input-container input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 20px;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-family);
}

.input-container input::placeholder {
  color: #666;
}

.btn-mic {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: var(--transition);
}

.btn-mic:hover {
  color: var(--text-primary);
  background: var(--glass-highlight);
}

.btn-mic.listening {
  color: #ff3b30;
  animation: pulseMic 1.5s infinite;
}

.btn-submit {
  background: var(--text-primary);
  color: var(--bg-dark);
  border: none;
  padding: 0 24px;
  height: 40px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-submit:hover {
  transform: scale(1.02);
  background: #f0f0f0;
}

/* Demo App Container */
.demo-layout {
  display: flex;
  gap: 20px;
  height: calc(100vh - 80px);
  width: 100%;
}

.mobile-tabs {
  display: none;
  width: 100%;
  margin-bottom: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--glass-highlight);
  color: var(--text-primary);
}

/* Chat Panel */
.chat-panel {
  width: 380px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.chat-header {
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.messages::-webkit-scrollbar {
  width: 6px;
}
.messages::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.msg-bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  transform: scale(0.9);
  transform-origin: bottom left;
}

.msg-user {
  align-self: flex-end;
  background: var(--accent-color);
  color: #fff;
  border-bottom-right-radius: 4px;
  transform-origin: bottom right;
}

.msg-ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-input-wrapper {
  padding: 20px;
  border-top: 1px solid var(--glass-border);
}

.chat-input-wrapper .input-container {
  max-width: 100%;
}

/* Typing Indicator */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 6px 4px;
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

/* Preview Panel */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.browser-header {
  height: 40px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.window-dots span:nth-child(1) { background: #ff5f56; }
.window-dots span:nth-child(2) { background: #ffbd2e; }
.window-dots span:nth-child(3) { background: #27c93f; }

.url-bar {
  flex: 1;
  max-width: 300px;
  margin: 0 auto;
  height: 24px;
  background: var(--glass-highlight);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.preview-content {
  flex: 1;
  background: #ffffff; /* White background to look like a real site */
  overflow-y: auto;
  position: relative;
}

.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #999;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Generic Pages (About, Contact, etc.) */
.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
  animation: fadeIn 0.6s ease-out forwards;
}

.page-header {
  margin-bottom: 40px;
}

.page-header h1 {
  font-size: 3rem;
  margin-bottom: 10px;
}

.page-content p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.footer-basic {
  text-align: center;
  padding: 20px 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: auto;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulseMic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 992px) {
  .sidebar {
    width: 100%;
    height: 60px;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 20px;
    bottom: 0;
    top: auto;
    border-right: none;
    border-top: 1px solid var(--glass-border);
  }
  
  .brand-logo svg {
    margin-bottom: 0;
    width: 32px;
    height: 32px;
  }
  
  .nav-links {
    flex-direction: row;
    width: auto;
    gap: 16px;
  }
  
  .sidebar-footer {
    display: none;
  }

  .nav-item .tooltip {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 20px;
    padding-bottom: 100px; /* space for bottom nav */
  }

  .hero-title {
    font-size: 3rem;
  }
}

@media (max-width: 768px) {
  .demo-layout {
    flex-direction: column;
  }

  .mobile-tabs {
    display: flex;
  }

  .chat-panel, .preview-panel {
    width: 100%;
    height: calc(100vh - 180px); /* Adjust for header/nav */
  }

  .chat-panel {
    display: flex; /* Active by default */
  }

  .preview-panel {
    display: none; /* Hidden by default */
  }

  /* When preview tab is active */
  .demo-layout.show-preview .chat-panel {
    display: none;
  }
  
  .demo-layout.show-preview .preview-panel {
    display: flex;
  }
}