/* =====================================================
   Mudabbir Dashboard - Modern Apple Design
   Glassmorphism. SF Pro. Refined.

   Changes (2026-02-02):
   - Refactored to use UnoCSS for layout and styling.
   - Cleaned up redundant custom classes.
   ===================================================== */

:root {
  /* Apple-inspired Dark Palette (Used by UnoCSS variables and remaining custom CSS) */
  --bg-color: #000000;
  --glass-bg: rgba(28, 28, 30, 0.65);
  --glass-border: rgba(255, 255, 255, 0.12);
  --card-bg: rgba(44, 44, 46, 0.6);
  
  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-tertiary: rgba(235, 235, 245, 0.3);

  /* Accents */
  --accent-color: #0A84FF; /* iOS Blue */
  --accent-hover: #0077ED;
  --success-color: #30D158;
  --danger-color: #FF453A;
  --warning-color: #FF9F0A;
  --info-color: #0A84FF;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* Spacing & Radius */
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

button {
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  padding: 0;
  cursor: pointer;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  background-image: radial-gradient(circle at 50% 0%, #1a1a1a 0%, #000000 70%); /* Subtle depth */
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* =====================================================
   Sidebar
   ===================================================== */
.sidebar-shell {
  transition: width 0.22s ease, padding 0.22s ease, transform 0.3s ease;
}

.sidebar-rail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.2s ease;
}

.sidebar-rail-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.14);
}

/* =====================================================
   Toast Notifications
   ===================================================== */
.toast-container {
  position: fixed;
  top: 32px;
  right: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
}

.toast {
  background: rgba(35, 35, 35, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: 14px; /* iOS notification style */
  padding: 14px 18px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  transition: all 0.3s ease-out;
}
.toast-enter { transform: translateX(100%); opacity: 0; }
.toast-enter-active { transform: translateX(0); opacity: 1; }
.toast-exit { transform: translateX(0); opacity: 1; }
.toast-exit-active { transform: translateX(100%); opacity: 0; }

.toast.success { border-left: none; color: var(--success-color); } /* Icon handles color */
.toast.error { border-left: none; color: var(--danger-color); }
.toast.info { border-left: none; color: var(--text-primary); }

.toast-icon { margin-right: 12px; font-size: 16px; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.25); }

/* Animation Utils */
@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes badgeFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* =====================================================
   Settings Panel (Notion-style two-column)
   ===================================================== */

/* Sidebar nav */
.settings-nav {
  width: 100%;
  border-right: none;
}
.settings-nav.is-hidden {
  display: none;
}
.settings-nav.is-visible {
  display: block;
}
@media (min-width: 768px) {
  .settings-nav,
  .settings-nav.is-hidden,
  .settings-nav.is-visible {
    display: block !important;
    width: 200px !important;
    border-right: 1px solid var(--glass-border) !important;
  }
}

/* Content area */
.settings-content.is-hidden {
  display: none;
}
.settings-content.is-visible {
  display: block;
}
@media (min-width: 768px) {
  .settings-content,
  .settings-content.is-hidden,
  .settings-content.is-visible {
    display: block !important;
  }
}

/* Nav items */
.settings-nav-item {
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Mobile: larger tap targets + chevron hint */
@media (max-width: 767px) {
  .settings-nav-item {
    padding: 12px 16px;
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    margin-bottom: 0;
  }
  .settings-nav-item::after {
    content: '\203A';
    margin-left: auto;
    font-size: 20px;
    opacity: 0.3;
    font-weight: 300;
  }
}

/* =====================================================
   Channels Panel (Two-column, mirrors Settings)
   ===================================================== */

/* Sidebar nav */
.channels-nav {
  width: 100%;
  border-right: none;
}
.channels-nav.is-hidden {
  display: none;
}
.channels-nav.is-visible {
  display: block;
}
@media (min-width: 768px) {
  .channels-nav,
  .channels-nav.is-hidden,
  .channels-nav.is-visible {
    display: block !important;
    width: 180px !important;
    border-right: 1px solid var(--glass-border) !important;
  }
}

/* Content area */
.channels-content.is-hidden {
  display: none;
}
.channels-content.is-visible {
  display: block;
}
@media (min-width: 768px) {
  .channels-content,
  .channels-content.is-hidden,
  .channels-content.is-visible {
    display: block !important;
  }
}

/* Nav items */
.channels-nav-item {
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Mobile: larger tap targets + chevron hint */
@media (max-width: 767px) {
  .channels-nav-item {
    padding: 12px 16px;
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    margin-bottom: 0;
  }
  .channels-nav-item::after {
    content: '\203A';
    margin-left: auto;
    font-size: 20px;
    opacity: 0.3;
    font-weight: 300;
  }
}

/* =====================================================
   API Key Help Links
   ===================================================== */
.api-key-help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-color);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}
.api-key-help:hover {
  opacity: 1;
  text-decoration: underline;
}

/* =====================================================
   Chat Markdown Content
   ===================================================== */
.messages {
  overflow-x: hidden;
}
.message-content-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  word-break: break-word;
}
.message-content-wrapper p {
  margin: 0 0 0.5em;
}
.message-content-wrapper p:last-child {
  margin-bottom: 0;
}
.message-content-wrapper h1,
.message-content-wrapper h2,
.message-content-wrapper h3,
.message-content-wrapper h4,
.message-content-wrapper h5,
.message-content-wrapper h6 {
  margin: 0.8em 0 0.4em;
  font-weight: 600;
  line-height: 1.3;
}
.message-content-wrapper h1 { font-size: 1.3em; }
.message-content-wrapper h2 { font-size: 1.15em; }
.message-content-wrapper h3 { font-size: 1.05em; }
.message-content-wrapper h4,
.message-content-wrapper h5,
.message-content-wrapper h6 { font-size: 1em; }
.message-content-wrapper a {
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.message-content-wrapper a:hover {
  opacity: 0.85;
}
.message-content-wrapper pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0.5em 0;
  font-size: 0.88em;
  line-height: 1.5;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}
.message-content-wrapper pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}
.message-content-wrapper code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'JetBrains Mono', monospace;
  overflow-wrap: break-word;
  word-break: break-all;
}
.message-content-wrapper ul,
.message-content-wrapper ol {
  margin: 0.4em 0;
  padding-left: 1.5em;
}
.message-content-wrapper li {
  margin: 0.15em 0;
}
.message-content-wrapper blockquote {
  border-left: 3px solid var(--accent-color);
  margin: 0.5em 0;
  padding: 4px 12px;
  opacity: 0.85;
}
.message-content-wrapper table {
  border-collapse: collapse;
  margin: 0.5em 0;
  max-width: 100%;
  display: block;
  overflow-x: auto;
  font-size: 0.9em;
}
.message-content-wrapper th,
.message-content-wrapper td {
  border: 1px solid var(--glass-border);
  padding: 6px 10px;
  text-align: left;
}
.message-content-wrapper th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}
.message-content-wrapper hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 0.8em 0;
}
.message-content-wrapper del {
  opacity: 0.6;
}
.message-content-wrapper img {
  max-width: 100%;
  border-radius: 8px;
}

/* =====================================================
   Responsive Overrides
   ===================================================== */
@media (max-width: 640px) {
  .toast-container {
    top: 16px;
    right: 16px;
    left: 16px;
  }
  .toast {
    font-size: 13px;
    padding: 10px 14px;
  }
}
