: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 {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 8px;
    align-items: end;
  }

  .chat-input .col-12.col-lg {
    grid-column: 1 / -1;
  }

  .chat-input .col-auto {
    width: auto;
  }

  .chat-input .form-control,
  .chat-input .btn {
    width: 100%;
  }

  .chat-input textarea {
    min-height: 40px;
    max-height: 92px;
  }

  #fileInput {
    max-width: 128px;
    font-size: 0.78rem;
    padding-top: 0.32rem;
    padding-bottom: 0.32rem;
  }

  .chat-input .btn {
    white-space: nowrap;
  }

  .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;
  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);
    max-height: 100px;
    overflow: auto;
}

.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;
}

.mobile-unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
}

.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));
}

div#replyToPreview {
    max-height: 50px;
    overflow: auto;
}




.message {
    max-width: 100%;
    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;
    word-break: break-word;
}

.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;
}

.message-quick-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message:hover .message-quick-actions,
.message:focus-within .message-quick-actions {
  opacity: 1;
}

.quick-action-btn {
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: #334155;
}

.quick-action-btn:hover {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.35);
}

.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;
}

.upload-progress-wrap .progress {
  height: 18px;
  border-radius: 999px;
  background: #e2e8f0;
}

.upload-progress-wrap .progress-bar {
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saved-toolbar {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 8px;
}

.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;
}

.admin-report {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.report-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: #f8fafc;
}

.report-label {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.report-value {
  font-size: 1.35rem;
  font-weight: 700;
}

.report-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.report-tabs {
  display: none;
  gap: 8px;
  flex-wrap: wrap;
}

.report-tabs .btn.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.report-table {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 10px;
  background: #fff;
}

.admin-session-browser .form-select,
.admin-session-browser .form-control {
  min-width: 180px;
}

.admin-session-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 12px;
}

.admin-session-list {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  max-height: 68vh;
  overflow: auto;
  padding: 8px;
}

.admin-session-item {
  width: 100%;
  text-align: right;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.admin-session-item.active {
  border-color: rgba(15, 118, 110, 0.5);
  background: rgba(15, 118, 110, 0.1);
}

.admin-session-viewer {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 10px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.admin-session-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.admin-session-messages {
  flex: 1;
  max-height: 62vh;
  overflow: auto;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
}

.admin-session-message {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.daily-chart {
  position: relative;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
}

.daily-chart-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.daily-chart-bars {
  height: 210px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(8px, 1fr);
  gap: 4px;
  align-items: end;
}

.daily-chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 8px;
}

.daily-chart-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #0f766e, #115e59);
  cursor: pointer;
}

.daily-chart-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  line-height: 1;
  max-height: 74px;
  overflow: hidden;
}

.daily-chart-meta {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.daily-chart-tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  background: #0f172a;
  color: #fff;
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

.day-detail {
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}

.saved-item {
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
}

.saved-preview {
  white-space: pre-wrap;
  word-break: break-word;
}

.saved-badge {
  font-size: 0.68rem;
  color: #0f766e;
  border: 1px solid rgba(15, 118, 110, 0.35);
  border-radius: 999px;
  padding: 1px 7px;
  background: rgba(15, 118, 110, 0.08);
}

.seen-summary-btn {
  border: none;
  background: transparent;
  color: #0f766e;
  font-size: 0.72rem;
  padding: 0;
  text-decoration: underline;
}

.sr-only-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.room-item:focus-visible,
.quick-action-btn:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 2px;
}

@media (max-width: 991px) {
  .report-tabs {
    display: flex;
  }

  #reportPanes {
    display: block;
  }

  .report-pane {
    display: none;
    margin-bottom: 12px;
  }

  .report-pane.active {
    display: block;
  }

  .saved-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-session-grid {
    grid-template-columns: 1fr;
  }

  .message-quick-actions {
    opacity: 1;
    flex-wrap: wrap;
  }
}

.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);
}
