/* ============================================================
   ADAPTIVE GRID & BREAKPOINTS
   Gramaton.pro — Responsive 3-Column → 1-Column Layout
   ============================================================
   Breakpoints:
   - Desktop:  ≥ 1025px  (3-column, sidebar visible)
   - Tablet:   768-1024px (thin sidebar, 2 columns)
   - Mobile:   < 768px    (1 column, drawer menu)
   ============================================================ */

/* ---------- GLOBAL RESET & BASE ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: #0a0516;
  color: #e0d5c1;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- APP CONTAINER (3 columns) ---------- */
.app-container {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* ---------- SIDEBAR (desktop: full, tablet: thin) ---------- */
.app-sidebar {
  width: 280px;
  min-width: 280px;
  height: 100%;
  background: rgba(10, 5, 22, 0.7);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid rgba(122, 34, 166, 0.2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width 300ms cubic-bezier(0.22, 1, 0.36, 1),
              min-width 300ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 10;
}

/* Sidebar scrollbar */
.app-sidebar::-webkit-scrollbar { width: 3px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(122, 34, 166, 0.3);
  border-radius: 3px;
}

/* ---------- LEFT PANEL (chat list) ---------- */
.app-left-panel {
  width: 380px;
  min-width: 380px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(122, 34, 166, 0.15);
  background: rgba(10, 5, 22, 0.4);
  overflow: hidden;
  transition: width 300ms ease, transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- CENTER PANEL (chat messages) ---------- */
.app-center-panel {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

/* ---------- RIGHT PANEL (contact/user info) ---------- */
.app-right-panel {
  width: 320px;
  min-width: 320px;
  height: 100%;
  border-left: 1px solid rgba(122, 34, 166, 0.15);
  background: rgba(10, 5, 22, 0.4);
  overflow-y: auto;
  transition: width 300ms ease, transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- MOBILE HEADER (visible on < 768px) ---------- */
.mobile-header {
  display: none;
  height: 56px;
  min-height: 56px;
  padding: 0 16px;
  align-items: center;
  gap: 12px;
  background: rgba(10, 5, 22, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(122, 34, 166, 0.2);
  z-index: 100;
}

.mobile-header .app-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  flex: 1;
  text-align: center;
  font-family: 'Georgia', serif;
}

/* ============================================================
   TABLET: 768px – 1024px
   ============================================================ */
@media (max-width: 1024px) and (min-width: 768px) {
  .app-sidebar {
    width: 64px;
    min-width: 64px;
  }

  .app-sidebar .sidebar-link span,
  .app-sidebar .sidebar-section-title {
    display: none;
  }

  .app-sidebar .sidebar-link {
    justify-content: center;
    padding: 16px 0;
  }

  .app-right-panel {
    width: 280px;
    min-width: 280px;
  }

  .app-left-panel {
    width: 340px;
    min-width: 340px;
  }
}

/* ============================================================
   MOBILE: < 768px
   ============================================================ */
@media (max-width: 767px) {
  body {
    font-size: 14px;
  }

  .app-container {
    flex-direction: column;
  }

  /* Sidebar → hidden by default, shown as drawer */
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 360px;
    min-width: auto;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    transform: translate3d(-100%, 0, 0);
    -webkit-transform: translate3d(-100%, 0, 0);
  }

  .app-sidebar.open {
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
  }

  /* Left panel → full screen, slides horizontally */
  .app-left-panel {
    position: fixed;
    top: 56px;
    left: 0;
    width: 100vw;
    width: 100dvw;
    min-width: auto;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    z-index: 50;
    transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
  }

  .app-left-panel.slide-out {
    transform: translate3d(-100%, 0, 0);
    -webkit-transform: translate3d(-100%, 0, 0);
  }

  /* Center panel → full screen when active */
  .app-center-panel {
    position: fixed;
    top: 56px;
    left: 0;
    width: 100vw;
    width: 100dvw;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    z-index: 51;
    transform: translate3d(100%, 0, 0);
    -webkit-transform: translate3d(100%, 0, 0);
    transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .app-center-panel.slide-in {
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
  }

  /* Right panel → hidden on mobile */
  .app-right-panel {
    display: none;
  }

  /* Mobile header visible */
  .mobile-header {
    display: flex;
  }
}

/* ============================================================
   DESKTOP (≥ 1025px) — default styles apply, no overrides
   ============================================================ */
@media (min-width: 1025px) {
  .mobile-header {
    display: none;
  }
}

/* ============================================================
   CHAT LIST ITEMS (responsive avatars, text)
   ============================================================ */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 200ms ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-list-item:hover {
  background: rgba(122, 34, 166, 0.08);
}

.chat-list-item .avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7a22a6, #3a0f5e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #e0d5c1;
}

@media (max-width: 767px) {
  .chat-list-item {
    padding: 14px 12px;
  }

  .chat-list-item .avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 18px;
  }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hidden-mobile {
  display: block;
}

@media (max-width: 767px) {
  .hidden-mobile {
    display: none !important;
  }
}

.hidden-desktop {
  display: none;
}

@media (max-width: 767px) {
  .hidden-desktop {
    display: block;
  }
}

/* Swipe zone (invisible trigger for edge swipe) */
.swipe-zone {
  position: fixed;
  top: 0;
  left: 0;
  width: 30px;
  height: 100vh;
  height: 100dvh;
  z-index: 500;
  background: transparent;
}