:root{
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e1e8ed;
  --accent: #0084ff;
  --accent-hover: #0073e6;
  --accent-soft: rgba(0, 132, 255, 0.08);
  --user-bg: linear-gradient(135deg, #0084ff, #00c6ff);
  --bot-bg: #f0f2f5;
  --bot-text: #1c1e21;
  --error-bg: #fee;
  --error-text: #c00;
  --text: #1c1e21;
  --text-light: #65676b;
  --muted: #8a8d91;
  --code-bg: #282c34;
  --code-border: #3e4451;
  --image-gen: #00c853;
  --image-gen-soft: rgba(0, 200, 83, 0.08);
  --search-active: #ff9500;
  --search-soft: rgba(255, 149, 0, 0.12);
  --sonnet-purple: #9b59b6;
  --sonnet-purple-soft: rgba(155, 89, 182, 0.12);
  --gpt-green: #10a37f;
  --gpt-green-soft: rgba(16, 163, 127, 0.12);
  --gemini-blue: #4285f4;
  --gemini-blue-soft: rgba(66, 133, 244, 0.12);
  --nanobanana-orange: #ff6b35;
  --nanobanana-orange-soft: rgba(255, 107, 53, 0.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.16);
  --shadow-xl: 0 8px 24px rgba(0,0,0,0.2);
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
  -webkit-tap-highlight-color: transparent;
}

body{
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.app{
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header{
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.header-left{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title{
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.subtitle{
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.header-right{
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn{
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover{
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-btn:active{
  transform: scale(0.95);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.drawer{
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 300px;
  background: var(--card);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.drawer.open{
  transform: translateX(0);
}

.drawer-header{
  padding: 20px;
  font-weight: 700;
  font-size: 20px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.5px;
  background: var(--bg);
}

.chat-list{
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-item{
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.chat-item:hover{
  background: var(--bg);
}

.chat-item.active{
  background: var(--accent-soft);
  border-color: var(--accent);
}

.chat-name{
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}

.chat-last{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-footer{
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}

.btn{
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active{
  transform: scale(0.98);
}

.btn-primary{
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover{
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-danger{
  background: #ff3b30;
  color: #fff;
}

.btn-danger:hover{
  background: #ff2d20;
  box-shadow: var(--shadow-md);
}

.chat-body{
  flex: 1;
  padding: 20px 20px 140px;
  overflow-y: auto;
}

.msg-row{
  display: flex;
  margin-bottom: 16px;
  flex-direction: column;
}

.msg-row.user{
  align-items: flex-end;
}

.msg{
  max-width: 75%;
  border-radius: 18px;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.5;
  position: relative;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
}

.msg.user{
  background: var(--user-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.bot{
  background: var(--bot-bg);
  color: var(--bot-text);
  border-bottom-left-radius: 4px;
}

.msg.error{
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #fcc;
}

.related-cards-container{
  margin-top: 12px;
  width: 100%;
  max-width: 100%;
}

.related-cards-scroll{
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.related-cards-scroll::-webkit-scrollbar{
  height: 6px;
}

.related-cards-scroll::-webkit-scrollbar-track{
  background: var(--bg);
  border-radius: 10px;
}

.related-cards-scroll::-webkit-scrollbar-thumb{
  background: var(--border);
  border-radius: 10px;
}

.related-cards-scroll::-webkit-scrollbar-thumb:hover{
  background: var(--muted);
}

.related-card{
  min-width: 280px;
  max-width: 280px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.related-card:hover{
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.related-card-icon{
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--accent-soft);
}

.related-card-title{
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-description{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-url{
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-block-wrapper{
  margin: 10px 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  box-shadow: var(--shadow-md);
}

.code-block-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid var(--code-border);
}

.code-block-lang{
  font-size: 11px;
  font-weight: 700;
  color: #61afef;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.code-copy-btn{
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: #abb2bf;
  cursor: pointer;
  transition: all 0.2s ease;
}

.code-copy-btn:hover{
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.code-copy-btn.copied{
  background: var(--image-gen);
  color: #fff;
}

.code-block-content{
  padding: 0;
  overflow-x: auto;
}

.code-block-content pre{
  margin: 0;
  padding: 14px;
}

.code-block-content pre code{
  font-family: 'SF Mono','Monaco','Inconsolata','Fira Code',monospace;
  font-size: 13px;
  line-height: 1.6;
}

.paste-indicator{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 132, 255, 0.1);
  border: 1px solid rgba(0, 132, 255, 0.3);
  border-radius: 8px;
  font-size: 12px;
  color: var(--accent);
  margin: 4px 0;
  font-weight: 500;
}

.paste-indicator svg{
  width: 14px;
  height: 14px;
}

.msg-img-wrapper{
  position: relative;
  margin-bottom: 8px;
}

.msg img{
  max-width: 100%;
  border-radius: 12px;
  display: block;
}

.msg-img-actions{
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.msg-img-wrapper:hover .msg-img-actions{
  opacity: 1;
}

.msg-img-btn{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.msg-img-btn:hover{
  background: rgba(0,0,0,0.85);
  transform: scale(1.08);
}

.msg-img-btn svg{
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.msg-meta{
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 500;
  text-align: right;
}

.msg.user .msg-meta{
  color: rgba(255,255,255,0.75);
}

.typing{
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing span{
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.3s infinite;
}

.typing span:nth-child(2){ animation-delay: 0.2s; }
.typing span:nth-child(3){ animation-delay: 0.4s; }

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

/* AI Model Selector Dialog */
.ai-model-selector-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.3s;
}

.ai-model-selector-overlay.show{ display: flex; }

.ai-model-selector{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 90%;
  max-width: 480px;
  padding: 20px;
  animation: slideUpModal 0.4s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-xl);
}

@keyframes slideUpModal{
  from{ opacity: 0; transform: translateY(30px) scale(0.95); }
  to{ opacity: 1; transform: translateY(0) scale(1); }
}

.ai-model-selector-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ai-model-selector-title{
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}

.mode-close-btn{
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.mode-close-btn:hover{ background: var(--border); color: var(--text); }

.ai-model-options{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-model-item{
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-model-item:hover{
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ai-model-item.active{
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
}

.ai-model-icon{
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.ai-model-item.chat .ai-model-icon{ background: var(--accent-soft); }
.ai-model-item.sonnet .ai-model-icon{ background: var(--sonnet-purple-soft); }
.ai-model-item.gpt .ai-model-icon{ background: var(--gpt-green-soft); }
.ai-model-item.gemini .ai-model-icon{ background: var(--gemini-blue-soft); }
.ai-model-item.nanobanana .ai-model-icon{ background: var(--nanobanana-orange-soft); }

.ai-model-info{
  flex: 1;
}

.ai-model-name{
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.header-right {
  position: relative;
}

/* menu titik tiga */
.header-menu {
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 0;
  min-width: 200px;
  box-shadow: var(--shadow-xl);
  display: none;
  z-index: 40;
}

.header-menu.show {
  display: block;
}

.header-menu-item {
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.header-menu-item:hover {
  background: var(--bg);
  color: var(--accent);
}

.header-menu-item .menu-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-menu-item .menu-icon svg {
  width: 18px;
  height: 18px;
}

.ai-model-desc{
  font-size: 12px;
  color: var(--muted);
}

/* Ratio Selector for Nano Banana */
.ratio-selector-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.3s;
}

.ratio-selector-overlay.show{ display: flex; }

.ratio-selector{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 90%;
  max-width: 380px;
  padding: 20px;
  animation: slideUpModal 0.4s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-xl);
}

.ratio-selector-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ratio-selector-title{
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}

.ratio-options{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ratio-option{
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.ratio-option:hover{
  border-color: var(--nanobanana-orange);
  background: var(--nanobanana-orange-soft);
}

.ratio-option.active{
  border-color: var(--nanobanana-orange);
  background: var(--nanobanana-orange-soft);
  box-shadow: var(--shadow-sm);
}

.ratio-option-title{
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.ratio-option-desc{
  font-size: 12px;
  color: var(--muted);
}

.composer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  background: linear-gradient(to top, var(--bg), transparent);
  backdrop-filter: blur(10px);
}

.composer-inner{
  max-width: 900px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 8px 8px 8px 16px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  gap: 8px;
}

.composer-inner:focus-within{
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0, 132, 255, 0.2);
}

.composer-inner.search-active{
  border-color: var(--search-active);
  box-shadow: 0 4px 20px rgba(255, 149, 0, 0.25);
}

.composer-inner.sonnet-active{
  border-color: var(--sonnet-purple);
  box-shadow: 0 4px 20px rgba(155, 89, 182, 0.25);
}

.composer-inner.gpt-active{
  border-color: var(--gpt-green);
  box-shadow: 0 4px 20px rgba(16, 163, 127, 0.25);
}

.composer-inner.gemini-active{
  border-color: var(--gemini-blue);
  box-shadow: 0 4px 20px rgba(66, 133, 244, 0.25);
}

.composer-inner.nanobanana-active{
  border-color: var(--nanobanana-orange);
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.25);
}

.composer-search{
  flex-shrink: 0;
  position: relative;
}

.composer-search-btn{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.composer-search-btn:hover{
  background: var(--bg);
  color: var(--accent);
}

.composer-search-btn.active{
  background: var(--search-soft);
  color: var(--search-active);
  animation: pulse 2s infinite;
}

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

.composer-search-btn svg{
  width: 20px;
  height: 20px;
}

.composer-main{
  flex: 1;
  padding: 0 4px;
}

.composer-main textarea{
  width: 100%;
  border: none;
  resize: none;
  background: transparent;
  color: var(--text);
  min-height: 24px;
  max-height: 120px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
}
.composer-main textarea::placeholder{
  color: var(--muted);
  font-weight: 400;
}

.composer-actions{
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
}

.plus-menu{
  position: absolute;
  bottom: 50px;
  right: 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-xl);
  animation: slideUpMenu 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 220px;
}

.plus-menu.show{
  display: flex;
}

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

.plus-menu-item{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}

.plus-menu-item:hover{
  background: var(--bg);
  color: var(--accent);
}

.plus-menu-item svg{
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.plus-menu-item.has-image::after{
  content: '';
  width: 8px;
  height: 8px;
  background: var(--image-gen);
  border-radius: 50%;
  margin-left: auto;
}

.composer-icon-btn{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.composer-icon-btn:hover{
  background: var(--bg);
  color: var(--accent);
}

.composer-icon-btn svg{
  width: 20px;
  height: 20px;
}

.composer-icon-btn.active{
  background: var(--accent-soft);
  color: var(--accent);
}

.send-btn{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 4px;
}

.send-btn svg{
  width: 20px;
  height: 20px;
}

.send-btn:hover{
  background: var(--accent-hover);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.send-btn:disabled{
  opacity: 0.4;
  cursor: not-allowed;
  transform: scale(1);
  background: var(--muted);
}

.toast{
  position: fixed;
  top: 70px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  display: none;
  box-shadow: var(--shadow-lg);
  z-index: 110;
  max-width: 300px;
}

.toast.show{ display: block; animation: toastSlideIn 3s forwards; }

@keyframes toastSlideIn{
  0%{ opacity: 0; transform: translateX(20px); }
  10%, 80%{ opacity: 1; transform: translateX(0); }
  100%{ opacity: 0; transform: translateX(20px); }
}

.dialog-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s;
}

.dialog-overlay.show{ display: flex; }

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

.dialog-box{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  max-width: 90%;
  width: 360px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1);
}

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

.dialog-header{
  padding: 20px 20px 8px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.3px;
}

.dialog-body{
  padding: 8px 20px 20px;
  color: var(--text-light);
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
}

.dialog-input{
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  margin-top: 10px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.dialog-input:focus{
  border-color: var(--accent);
  background: var(--card);
}

.dialog-footer{
  display: flex;
  border-top: 1px solid var(--border);
}

.dialog-btn{
  flex: 1;
  padding: 14px;
  border: none;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-weight: 600;
}

.dialog-btn:first-child{
  border-right: 1px solid var(--border);
  border-radius: 0 0 0 16px;
  color: var(--muted);
}

.dialog-btn:last-child{
  border-radius: 0 0 16px 0;
  color: var(--accent);
}

.dialog-btn:hover{ background: var(--bg); }
.dialog-btn:active{ background: var(--border); }

.mode-badge {
  padding: 4px 10px;
  border-radius: 10px;
  font-weight: 500;
  border: 2px solid transparent;
  transition: all 0.25s ease;
  display: inline-block;
  font-size: 12px;
}

.mode-blue {
  border-color: #0a84ff;
  background: rgba(10, 132, 255, 0.08);
}

.mode-purple {
  border-color: var(--sonnet-purple);
  background: var(--sonnet-purple-soft);
}

.mode-teal {
  border-color: var(--gpt-green);
  background: var(--gpt-green-soft);
}

.mode-sky {
  border-color: var(--gemini-blue);
  background: var(--gemini-blue-soft);
}

.mode-orange {
  border-color: var(--nanobanana-orange);
  background: var(--nanobanana-orange-soft);
}

.mode-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Search Mode Selector */
.search-mode-selector-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.3s;
}

.search-mode-selector-overlay.show{ display: flex; }

.search-mode-selector{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 90%;
  max-width: 480px;
  padding: 20px;
  animation: slideUpModal 0.4s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-xl);
}

.search-mode-selector-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.search-mode-selector-title{
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}

.search-mode-options{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-mode-item{
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-mode-item:hover{
  border-color: var(--accent);
  background: var(--accent-soft);
}

.search-mode-item.active{
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
}

.search-mode-icon{
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.search-mode-item.default .search-mode-icon{ background: var(--accent-soft); }
.search-mode-item.youtube .search-mode-icon{ background: var(--search-soft); }

.search-mode-info{
  flex: 1;
}

.search-mode-name{
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.search-mode-desc{
  font-size: 12px;
  color: var(--muted);
}

@media (max-width:768px){
  .app{ max-width: 100%; }
  .msg{ max-width: 85%; }
  .toast{ right: 16px; max-width: calc(100% - 32px); }
  .header{ padding: 10px 16px; }
  .chat-body{ padding: 16px 12px 130px; }
  .composer{ padding: 12px; }
  .composer-inner{ padding: 6px 6px 6px 12px; }
  .related-card{ min-width: 240px; max-width: 240px; }
}

@media (min-width:960px){
  .app{ max-width: 100%; }
  .drawer{
    transform: translateX(0) !important;
    box-shadow: none;
  }
  #drawerToggle{ display: none; }
  .header, .chat-body, .composer {
    margin-left: 300px;
  }
  .composer-inner {
      max-width: calc(900px - 300px);
  }
}
