/* ============================================================
   SNÈH AI — SIDEBAR STYLES (APPLE TYPOGRAPHY & CHATGPT ACCURACY)
   ============================================================ */

/* --- Sidebar Off-Canvas Container --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 285px;
  max-width: 85vw;
  height: 100dvh;
  background: var(--bg-primary, #FAFAFA);
  color: var(--text-primary, #0d0d0d);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme="dark"] .sidebar {
  background: #121212;
  color: #ececec;
}

.sidebar.active {
  transform: translateX(0);
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: none;
  z-index: 999;
}

/* --- Sidebar Header (Apple Big Bold Title + Back Button) --- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1rem 0.5rem 1.15rem;
  background: transparent;
  flex-shrink: 0;
}

.sidebar-brand-title {
  display: flex;
  align-items: center;
}

/* Big, Bold, Heavy-Weight Apple System Font */
.sidebar-brand-title .brand-name {
  font-size: 2rem;
  font-weight: 1000;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--text-primary, #0d0d0d);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

[data-theme="dark"] .sidebar-brand-title .brand-name {
  color: #f5f5f7;
}

/* Single Back Button (Top Right) */
.close-sidebar {
width: 2.85rem;
  height: 2.85rem;
  background: var(--inputboxmodel);
  backdrop-filter: blur(8px);
  border: 0.3px solid var(--input-border-color);

    border-radius: 28px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-primary);
  transition: all 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  
}

.close-sidebar i,
.close-sidebar svg {
  width: 25px;
  height: 25px;
  stroke-width: 2.5px;
}




/* --- Quick Navigation Items --- */
.sidebar-nav-links {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.85rem;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  border-radius: 8px;
  color: var(--text-primary, #0d0d0d);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  transition: background 0.12s ease;
}

[data-theme="dark"] .sidebar-nav-item {
  color: #ececec;
}

.sidebar-nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav-item .nav-icon {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-secondary, #606770);
  flex-shrink: 0;
}

.sidebar-nav-item .nav-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 2px;
}

[data-theme="dark"] .sidebar-nav-item .nav-icon {
  color: #b0b3b8;
}

/* --- Section Title: Recents --- */
.sidebar-section-title {
  padding: 1.2rem 1.35rem 0.65rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #8e8e93);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

/* --- History List (With Top & Bottom Fade Mask) --- */
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.2rem 0.65rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: none;
  -ms-overflow-style: none;

  /* Smooth Fading Effect at Top & Bottom Edges */
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 1) 20px,
    rgba(0, 0, 0, 1) calc(100% - 20px),
    rgba(0, 0, 0, 0) 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 1) 20px,
    rgba(0, 0, 0, 1) calc(100% - 20px),
    rgba(0, 0, 0, 0) 100%
  );
}

.history-list::-webkit-scrollbar {
  display: none !important;
}

/* --- ChatGPT Recents Typography Precision --- */
.history-item {
  padding: 7px 10px;
  margin-bottom: 1px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.12s ease;
  border: none !important;
  color: var(--text-primary, #0d0d0d);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 1.2rem;
  font-weight: 460;
  line-height: 1.35;
  letter-spacing: -0.01em;
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .history-item {
  background: rgba(255, 255, 255, 0.04);
}

.history-item:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}
[data-theme="dark"] .history-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

.history-item span {
  font-size: 1.03rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  color: var(--text-primary, #0d0d0d);
  font-weight: 400;
}

[data-theme="dark"] .history-item span {
  color: #ececec;
}

.delete-chat-btn {
  color: var(--text-tertiary, #8e8e93);
  padding: 3px 5px;
  opacity: 0.1;
  transition: opacity 0.12s ease, color 0.12s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-chat-btn i,
.delete-chat-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2px;
}

.history-item:hover .delete-chat-btn {
  opacity: 0.7;
}

.delete-chat-btn:hover {
  opacity: 1 !important;
  color: #ff3b30 !important;
}

/* --- Vertically Compact Bottom Footer Container --- */
.sidebar-footer-container {
  padding: 0.4rem 0.75rem 0.5rem; /* Ultra-compact vertical padding */
  background: transparent;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}

/* User Capsule Wrapper */
.sidebar-user-capsule {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

/* Guest Sign-In Pill Button */
.sidebar-guest-signin {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.04);
  border: 0.3px solid var(--input-border-color, rgba(0, 0, 0, 0.1));
  padding: 12px 18px;
  border-radius: 40px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  width: 87%;
}

[data-theme="dark"] .sidebar-guest-signin {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-guest-signin:hover {
  background: rgba(0, 0, 0, 0.07);
}

[data-theme="dark"] .sidebar-guest-signin:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-guest-signin i,
.sidebar-guest-signin svg {
  width: 18px;
  height: 18px;
  font-size: 1rem;
  color: var(--primary, #0B57CF);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  stroke-width: 2.2px;
}

.sidebar-guest-signin span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #0d0d0d);
  white-space: nowrap;
}

[data-theme="dark"] .sidebar-guest-signin span {
  color: #ffffff;
}

/* Logged-In User Profile Capsule */
.sidebar-user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 40px;
  background: rgba(0, 0, 0, 0.03);
  border: 0.3px solid var(--input-border-color, rgba(0, 0, 0, 0.08));
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease;
}

[data-theme="dark"] .sidebar-user-profile {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-user-profile:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .sidebar-user-profile:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.99rem;
  font-weight: 700;
  color: var(--text-primary, #0d0d0d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

[data-theme="dark"] .sidebar-user-name {
  color: #ffffff;
}

/* Settings Icon Button */
.sidebar-settings-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--input-border-color, rgba(0, 0, 0, 0.1));
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-secondary, #606770);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.22rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-settings-btn i,
.sidebar-settings-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

[data-theme="dark"] .sidebar-settings-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #b0b3b8;
}

.sidebar-settings-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--text-primary, #0d0d0d);
}

[data-theme="dark"] .sidebar-settings-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Vertically Compact & Centered Brand Info */
.sidebar-footer-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
  padding-top: 1px;
}

.footer-mini-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
  font-size: 0.5rem;
}

.footer-mini-grid a {
  color: var(--text-tertiary, #8e8e93);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-mini-grid a:hover {
  color: var(--primary, #0B57CF);
}

.dot-sep {
  color: var(--text-tertiary, #8e8e93);
  font-size: 0.5rem;
  opacity: 0.6;
}


/* ============================================================
   GROK-STYLE BLUE CAPSULE BANNER (OFFLINE AI)
   ============================================================ */
.offline-ai-capsule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0;
  padding: 10px 12px;
  background: linear-gradient(135deg, #0B57CF 0%, #0041a8 100%);
  color: #ffffff !important;
  border-radius: 40px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(11, 87, 207, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.offline-ai-capsule:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(11, 87, 207, 0.45);
}

.offline-ai-capsule .capsule-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.offline-ai-capsule .capsule-icon {
  width: 20px;
  height: 20px;
  color: #ffffff;
  flex-shrink: 0;
}

.offline-ai-capsule .capsule-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.offline-ai-capsule .capsule-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offline-ai-capsule .capsule-subtitle {
  font-size: 0.70rem;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.2;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offline-ai-capsule .capsule-action-btn {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
  transition: all 0.2s ease;
}

.offline-ai-capsule:hover .capsule-action-btn {
  background: #ffffff;
  color: #0B57CF;
}


/* Smooth Text Transition for Capsule Subtitle */
.offline-ai-capsule .capsule-subtitle {
  font-size: 0.70rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.35s ease, transform 0.35s ease;
  will-change: opacity, transform;
}

.offline-ai-capsule .capsule-subtitle.fade-out {
  opacity: 0;
  transform: translateY(-4px);
}

