:root {
  --app-bg: #f6f1e8;
  --app-bg-2: #e5edf3;
  --panel-bg: #ffffff;
  --panel-border: rgba(15, 23, 42, 0.08);
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #f97316;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-soft: 0 30px 60px rgba(15, 23, 42, 0.12);
  --shadow-tight: 0 12px 26px rgba(15, 23, 42, 0.08);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}
main {
    padding-top: 56px; /* or your navbar height */
}


@media (min-width: 992px) {
    .chat-sidebar-offcanvas {
        position: static;
        transform: none !important;
        visibility: visible !important;
        width: 320px;
        border-right: 1px solid #dee2e6;
    }

    .offcanvas-backdrop {
        display: none !important;
    }
}



@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-Thin.woff2') format('woff2');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-ExtraLight.woff2') format('woff2');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/webfonts/Vazirmatn-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}


body {
    font-family: 'Vazirmatn', sans-serif;
}

html {
  font-size: 15px;
}

@media (min-width: 992px) {
  html {
    font-size: 16px;
  }
}

body.app-body {
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  color: var(--text-main);
  background: linear-gradient(135deg, var(--app-bg), var(--app-bg-2));
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body.app-body::before,
body.app-body::after {
  content: "";
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(15, 118, 110, 0.18), transparent 60%);
  top: -120px;
  right: -120px;
  z-index: 0;
  pointer-events: none;
}

body.app-body::after {
  width: 460px;
  height: 460px;
  top: auto;
  right: auto;
  bottom: -160px;
  left: -160px;
  background: radial-gradient(circle at 40% 40%, rgba(249, 115, 22, 0.2), transparent 65%);
}

.app-header {
  background: linear-gradient(120deg, #0f172a, #111827 60%, #0f766e);
  color: #f8fafc;
  box-shadow: var(--shadow-soft);
  z-index: 2;
}

.app-header .navbar-brand {
  color: #f8fafc;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.app-header .navbar-brand:hover {
  color: #e2e8f0;
}

.app-header .btn {
  border-radius: 999px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(249, 115, 22, 0.25);
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 18px;
  padding: 20px;
  height: calc(100vh - 78px);
  position: relative;
  z-index: 1;
}

@media (max-width: 991px) {
    .chat-shell {
        grid-template-columns: 1fr;
        height: calc(100vh - 68px);
        padding: 14px;
        gap: 14px;
        padding-bottom: 0px;
    }
    .chat-sidebar-offcanvas {
        top: 56px !important;
        height: calc(100% - 56px) !important;
    }

  .chat-sidebar-offcanvas {
    width: min(85vw, 340px);
  }
}

@media (max-width: 767px) {
  .chat-panel {
    border-radius: 16px;
  }

  .chat-header {
    padding: 12px 14px;
  }

  .chat-messages {
    padding: 16px;
    max-height: 55vh;
  }

  .message {
    max-width: 88%;
  }

  .room-preview {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-input {
    padding: 12px;
  }

  .chat-input .row {
    flex-direction: row;
  }

  .chat-input .col-auto,
  .chat-input .col-12,
  .chat-input .col-lg {
    width: 100%;
  }

  .chat-input .form-control,
  .chat-input .btn {
    width: 100%;
  }

  .emoji-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .sidebar-actions .btn {
    flex: 1 1 100%;
  }
}

.chat-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
}

.chat-sidebar-offcanvas {
  width: 320px;
}

.chat-sidebar-offcanvas .offcanvas-body {
  height: 100%;
}

.chat-sidebar-offcanvas .chat-panel {
  height: 100%;
  width:100%;
}

.sidebar-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(248, 250, 252, 0.9);
}

.sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sidebar-search {
  padding: 12px 20px;
}

.sidebar-search .form-control {
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.room-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 16px;
}

.sidebar-divider {
  border-top: 1px solid var(--panel-border);
  margin: 10px 6px 12px;
}

.sidebar-section {
  padding: 0 6px 6px;
}

.sidebar-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 6px 8px;
}

#guestLinkList .room-item {
  display: block;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

#guestLinkList .room-item:hover {
  text-decoration: none;
}

.room-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.7);
}

.room-item:hover {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.25);
}

.room-item.active {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: var(--shadow-tight);
}

.room-title {
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.room-preview {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.badge-unread {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
}

.chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(248, 250, 252, 0.95);
}

.chat-header .room-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.5));
}

.message {
  max-width: 72%;
  padding: 12px 14px;
  border-radius: 16px;
  margin-bottom: 14px;
  position: relative;
  box-shadow: var(--shadow-tight);
}

.message .meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.message-in {
  background: #ffffff;
  margin-left: auto;
  border-top-right-radius: 4px;
}

.message-out {
  background: rgba(15, 118, 110, 0.16);
  margin-right: auto;
  border-top-left-radius: 4px;
}

.message-deleted {
  font-style: italic;
  color: var(--text-muted);
}

.message-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.08);
}

.reply-bar .btn-close {
  font-size: 0.75rem;
}

.message-reply,
.message-forwarded {
  border-right: 3px solid var(--primary);
  background: rgba(15, 118, 110, 0.08);
  padding: 6px 10px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.message-forwarded {
  border-right-color: var(--accent);
  background: rgba(249, 115, 22, 0.12);
}

.reply-label,
.forward-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.reply-preview,
.forward-preview {
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: pre-wrap;
}

.typing-indicator {
  min-height: 18px;
  font-style: italic;
  color: var(--text-muted);
}

.message-actions {
  position: absolute;
  top: 8px;
  left: 10px;
}

.message-actions .dropdown-toggle {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0 4px;
  text-decoration: none;
}

.message-actions .dropdown-toggle::after {
  display: none;
}

.message-actions .dropdown-menu {
  min-width: 140px;
}

.attachment-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.attachment-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgb(228 233 235);
    text-decoration: none;
    color: inherit;
    box-shadow: 0 0 3px 0px #a2a2a2;
}

.voice-player {
  width: 100%;
}

.chat-input {
  padding: 16px 20px;
  border-top: 1px solid var(--panel-border);
  background: #fff;
}

.chat-input textarea {
  resize: none;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f8fafc;
}

.chat-input .btn {
  border-radius: 999px;
}

.emoji-menu {
  padding: 10px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.emoji-btn {
  border: none;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 8px;
  padding: 6px;
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.15s ease, background 0.15s ease;
}

.emoji-btn:hover {
  background: rgba(15, 118, 110, 0.2);
  transform: translateY(-1px);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 12px;
}

.admin-grid {
  padding: 24px;
}

.admin-table {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: rgba(15, 118, 110, 0.35);
}

.btn-outline-primary:hover {
  background-color: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.6);
}

.btn-outline-secondary {
  color: #334155;
  border-color: rgba(15, 23, 42, 0.2);
}

.form-control:focus,
.form-select:focus,
.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.2);
}
