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

:root {
  --bg: #F9FAF9;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #0f172a;
  --muted: #64748b;
  --teal: #1DB3A2;
  --teal-light: #ECF9F8;
  --focus-blue: #38bdf8;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 80px 1fr;
}

/* === Sidebar === */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--teal);
  background: var(--panel);
  margin: 0 0 16px;
  overflow: hidden; 
}
/* ADDED: Style for the SVG logo */
.logo svg {
  width: 26px;
  height: 26px;
}

.new-thread {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-weight: 500;
  border-radius: 10px;
  text-decoration: none;
  background: var(--teal-light);
  color: var(--teal);
  border: 1px solid var(--border);
  font-size: 20px;
}
.new-thread:hover {
  border-color: #d1d5db;
}

.nav { display: flex; flex-direction: column; gap: 8px; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  text-decoration: none; color: var(--muted);
  border-radius: 10px;
}

.nav-item .icon { 
  font-size: 22px;
  line-height: 1;
}

.nav-item .label { 
  font-size: 11px;
  font-weight: 500;
}

.nav-item.active { 
  color: var(--teal);
}
.nav-item:not(.new-thread):hover { 
  background: var(--bg); 
  color: var(--text); 
}

.sidebar-spacer { flex: 1 1 auto; }

.nav.bottom {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  width: 100%;
}

.nav-item.has-notif { 
  position: relative; 
}
.nav-item.has-notif .icon::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -4px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid var(--panel);
}

/* === Main Content === */
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 20px 10vh;
}
.brand {
  font-size: clamp(36px, 7vw, 72px);
  line-height: 1.05;
  margin: 0 0 28px;
  font-weight: 400;
  letter-spacing: normal;
}

/* === Search Box === */
.search { width: min(920px, 92vw); }

.search-container {
  position: relative;
  width: 100%;
}

.search-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: auto; 
  padding: 0;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  transition: all 0.2s ease-out;
}
.search-box:focus-within {
  border-color: var(--focus-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

.search-input-area {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  /* ADDED: For positioning the toggle */
  position: relative;
}

.search-box input {
  flex: 1;
  width: 100%;
  height: 44px;
  border: 0; outline: 0;
  background: transparent;
  font-size: 18px;
  color: var(--text);
  /* ADDED: Padding to avoid text going under the toggle */
  padding: 0 100px 0 0;
}
.search-box input::placeholder {
  font-family: 'Inter', sans-serif;
  color: var(--muted);
  font-size: 18px;
}

/* Bottom toolbar */
.search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tb-icon {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 20px;
  cursor: pointer;
}
.tb-icon:hover {
  background: var(--bg);
  color: var(--text);
}

.search-toolbar-internal {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.tb-internal {
  background: transparent;
  border: 0;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
}
.tb-internal.active {
  background: #f1f5f9;
}
.tb-internal:hover {
  background: #f8fafc;
}

.mic-button {
  background: var(--teal-light);
  color: var(--teal);
}
.mic-button:hover {
  background: #d8f3f0;
  color: var(--teal);
}

/* REMOVED: .external-toggle styles */

/* ADDED: New .input-toggle styles */
.input-toggle {
  position: absolute;
  top: 50%;
  right: 20px; /* Position inside the input area */
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  background: #f8f9f9; /* Light gray bg */
  border-radius: 8px;
  padding: 4px;
}
.toggle-btn {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}
.toggle-btn.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}


/* === Chips === */
.chips {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 18px;
  justify-content: center;
}
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 10px 16px;
  font-size: 14px; cursor: pointer;
  font-weight: 400;
}
.chip i {
  font-size: 14px;
  color: var(--muted);
}
.chip:hover { 
  border-color: #cbd5e1; 
  background: #f8fafc;
}

/* === Responsive === */
@media (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .content {
    padding: 4vh 16px 8vh;
  }
  
  .search-box input,
  .search-box input::placeholder {
    font-size: 16px;
  }
  
  .input-toggle {
    display: none; /* Hide P/G toggle on small screens */
  }
  .search-box input {
    padding-right: 0; /* Remove padding */
  }

  .search-toolbar {
    padding: 8px 10px;
  }
  .tb-icon {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .chips {
    margin-top: 16px;
  }
  .chip {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* === Section Styles === */
.section-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

/* === Finance Page === */
.finance-section, .account-section, .install-section {
  margin-bottom: 48px;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.market-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s;
}

.market-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.market-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.market-change {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.market-change.positive {
  color: #10b981;
  background: #ecfdf5;
}

.market-change.negative {
  color: #ef4444;
  background: #fef2f2;
}

.market-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.market-chart {
  font-size: 24px;
  text-align: right;
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--teal);
  color: white;
  border: 0;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.add-btn:hover {
  background: #189e8f;
  transform: translateY(-1px);
}

.watchlist-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.watchlist-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr 1fr;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.watchlist-row:last-child {
  border-bottom: 0;
}

.watchlist-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  background: var(--bg);
}

.stock-symbol strong {
  display: block;
  font-size: 16px;
  margin-bottom: 2px;
}

.stock-symbol small {
  color: var(--muted);
  font-size: 13px;
}

.positive {
  color: #10b981;
  font-weight: 600;
}

.negative {
  color: #ef4444;
  font-weight: 600;
}

.action-btn {
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.action-btn:hover {
  background: var(--panel);
  border-color: #cbd5e1;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.news-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s;
  cursor: pointer;
}

.news-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
}

.news-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--teal-light);
  color: var(--teal);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.news-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px;
  line-height: 1.4;
}

.news-card p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.news-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
}

.tool-card:hover {
  border-color: var(--teal);
  box-shadow: 0 8px 20px rgba(29, 179, 162, 0.15);
}

.tool-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 16px 0 8px;
}

.tool-card p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.tool-btn {
  width: 100%;
  padding: 10px 20px;
  background: var(--teal-light);
  color: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn:hover {
  background: var(--teal);
  color: white;
}

/* === Account Page === */
.profile-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.profile-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.avatar-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--border);
}

.upload-btn {
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-btn:hover {
  background: var(--bg);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  background: var(--bg);
  color: var(--text);
}

.form-input:focus {
  outline: none;
  border-color: var(--focus-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.save-btn {
  padding: 12px 24px;
  background: var(--teal);
  color: white;
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-start;
}

.save-btn:hover {
  background: #189e8f;
  transform: translateY(-1px);
}

.settings-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.setting-item:last-child {
  border-bottom: 0;
}

.setting-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}

.setting-info p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--teal);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

.subscription-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.sub-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.sub-header h3 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.sub-header p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.plan-badge {
  padding: 6px 12px;
  background: var(--teal-light);
  color: var(--teal);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.sub-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.feature-item.disabled {
  color: var(--muted);
}

.upgrade-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--teal);
  color: white;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.upgrade-btn:hover {
  background: #189e8f;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(29, 179, 162, 0.3);
}

.select-input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.danger-section .settings-list {
  border-color: #fecaca;
}

.danger-btn {
  padding: 8px 16px;
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.danger-btn:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* === Install Page === */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.platform-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  transition: all 0.2s;
}

.platform-card:hover {
  border-color: var(--teal);
  box-shadow: 0 12px 28px rgba(29, 179, 162, 0.15);
  transform: translateY(-4px);
}

.platform-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.platform-card h3 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
}

.platform-card p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.version-info {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.download-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--teal);
  color: white;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.download-btn:hover {
  background: #189e8f;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(29, 179, 162, 0.3);
}

.download-options {
  font-size: 13px;
  color: var(--muted);
}

.download-options a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}

.download-options a:hover {
  text-decoration: underline;
}

.mobile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

.mobile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  transition: all 0.2s;
}

.mobile-card:hover {
  border-color: var(--teal);
  box-shadow: 0 8px 20px rgba(29, 179, 162, 0.15);
}

.mobile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.mobile-icon {
  font-size: 48px;
}

.mobile-header h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

.mobile-header p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.mobile-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.feature-badge {
  padding: 6px 12px;
  background: var(--teal-light);
  color: var(--teal);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
}

.mobile-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.store-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--text);
  color: white;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.store-btn:hover {
  background: #1e293b;
  transform: translateY(-2px);
}

.browser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.browser-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
}

.browser-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
}

.browser-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.browser-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
}

.browser-card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.install-btn {
  width: 100%;
  padding: 10px 20px;
  background: var(--teal-light);
  color: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.install-btn:hover {
  background: var(--teal);
  color: white;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.feature-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.2s;
}

.feature-box:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.feature-box h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 12px 0 8px;
}

.feature-box p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.cli-card {
  background: #1e293b;
  border-radius: 16px;
  padding: 28px;
  color: white;
}

.cli-commands {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cli-command {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  padding: 14px 18px;
  border-radius: 10px;
  font-family: 'Courier New', monospace;
}

.cli-command code {
  color: #10b981;
  font-size: 14px;
}

.copy-btn {
  padding: 6px 10px;
  background: #334155;
  color: white;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: #475569;
}
