/* ===========================
   Gemini Chat - Modern UI Styles
   =========================== */

/* CSS Variables */
:root {
  --primary: #4285f4;
  --primary-dark: #1967d2;
  --primary-light: #e8f0fe;
  --secondary: #34a853;
  --danger: #ea4335;
  --warning: #fbbc04;
  
  --bg-main: #f8f9fa;
  --bg-elevated: #ffffff;
  --bg-hover: #f1f3f4;
  
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  
  --border: #e8eaed;
  --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.1);
  --shadow-md: 0 1px 3px 0 rgba(60, 64, 67, 0.15);
  --shadow-lg: 0 2px 6px 2px rgba(60, 64, 67, 0.15);
  --shadow-xl: 0 8px 16px 0 rgba(60, 64, 67, 0.15);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --sidebar-width: 280px;
  --header-height: 64px;
  --input-height: auto;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Shell */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===========================
   Sidebar
   =========================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
  z-index: 1000;
}

.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-md);
}

.logo svg {
  width: 24px;
  height: 24px;
}

.brand-text {
  flex: 1;
}

.title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Navigation */
.side-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-btn.primary {
  background: var(--primary);
  color: white;
}

.nav-btn.primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.nav-btn i {
  font-size: 18px;
}

/* Model Selector */
.model-selector {
  margin-top: 8px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
}

.model-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.model-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.model-select:hover {
  border-color: var(--primary);
}

.model-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.info-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  font-size: 12px;
}

.info-card i {
  font-size: 16px;
  color: var(--primary);
  flex-shrink: 0;
}

.info-title {
  font-weight: 600;
  color: var(--text-primary);
}

.info-text {
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Sidebar Toggle */
.sidebar-toggle {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
}

.overlay.active {
  opacity: 1;
}

/* ===========================
   Main Content
   =========================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
}

/* Header */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--primary-light);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-dark);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--secondary);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===========================
   Chat Container
   =========================== */
.chat-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 40px 20px;
}

.welcome-content {
  max-width: 800px;
  text-align: center;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 40px;
  box-shadow: var(--shadow-lg);
}

.welcome-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 32px;
}

.prompt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.prompt-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.prompt-card i {
  font-size: 20px;
  color: var(--primary);
  flex-shrink: 0;
}

/* Messages */
.messages-wrapper {
  display: none;
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.messages-wrapper.active {
  display: block;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  flex-direction: row-reverse;
}

.msg-content {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  word-wrap: break-word;
  line-height: 1.6;
}

.msg.assistant .msg-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.msg.user .msg-content {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-md);
}

.msg.typing .msg-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

/* ===========================
   Input Area
   =========================== */
.input-area {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
}

.input-container {
  max-width: 900px;
  margin: 0 auto;
}

.attachment-preview {
  display: none;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
}

.attachment-preview.active {
  display: flex;
  align-items: center;
  gap: 12px;
}

.attachment-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
}

.attachment-info {
  flex: 1;
}

.attachment-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.remove-attachment {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--danger);
  color: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-attachment:hover {
  opacity: 0.8;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.file-input {
  display: none;
}

.attach-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attach-btn:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.prompt-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text-primary);
  resize: none;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
}

.prompt-input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.input-footer {
  margin-top: 12px;
  text-align: center;
}

.disclaimer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.disclaimer i {
  font-size: 14px;
}

/* ===========================
   Responsive Design
   =========================== */

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }
  
  .welcome-title {
    font-size: 28px;
  }
  
  .quick-prompts {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: 280px;
    box-shadow: var(--shadow-xl);
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .sidebar-toggle {
    display: flex;
  }
  
  .overlay {
    display: block;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .header {
    padding: 0 16px;
  }
  
  .page-title {
    font-size: 18px;
  }
  
  .status-badge {
    display: none;
  }
  
  .welcome-screen {
    padding: 24px 16px;
  }
  
  .welcome-icon {
    width: 64px;
    height: 64px;
    font-size: 32px;
  }
  
  .welcome-title {
    font-size: 24px;
  }
  
  .welcome-subtitle {
    font-size: 14px;
  }
  
  .quick-prompts {
    grid-template-columns: 1fr;
  }
  
  .messages-wrapper {
    padding: 16px;
  }
  
  .msg-content {
    max-width: 85%;
  }
  
  .input-area {
    padding: 12px 16px;
  }
  
  .input-wrapper {
    padding: 10px;
  }
  
  .prompt-input {
    font-size: 14px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .sidebar {
    width: 100%;
  }
  
  .page-title {
    font-size: 16px;
  }
  
  .welcome-title {
    font-size: 20px;
  }
  
  .msg-content {
    max-width: 90%;
    font-size: 14px;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}