/* تعریف فونت وزیر از مسیر محلی پروژه */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/vazir/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/vazir/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #04724d;
  --bg-light: #f4f4f9;
  --secondary: #b8dbd9;
  --accent: #586f7c;
  --dark: #000000;
  --unread-red: #e63946;
  --font-main: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  direction: rtl;
}

body {
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.glass-card {
  background: rgba(244, 244, 249, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
}

.chat-window {
  width: 380px;
  height: 580px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.2s ease-in-out;
}

.chat-header {
  background: var(--primary);
  color: #fff;
  padding: 15px;
  text-align: center;
  font-weight: 700;
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.msg-wrapper.user {
  align-self: flex-start;
}

.msg-wrapper.admin {
  align-self: flex-end;
}

.msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.user .msg {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.admin .msg {
  background: rgba(255, 255, 255, 0.9);
  color: var(--dark);
  border: 1px solid var(--secondary);
  border-bottom-left-radius: 2px;
}

/* زمان و تیک زیر پیام */
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.75;
}

.user .msg-meta {
  color: #fff;
}

.admin .msg-meta {
  color: var(--dark);
}

.ticks {
  font-weight: bold;
  font-size: 12px;
}

.ticks.sent { color: #a8dadc; }
.ticks.read { color: #2ec4b6; }

/* فرم خوش‌آمدگویی و گرفتن کد پشتیبانی */
.welcome-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  padding: 15px;
  color: var(--dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--secondary);
}

.welcome-card p {
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.welcome-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.welcome-form input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  font-size: 13px;
  direction: ltr;
  text-align: center;
}

.welcome-form button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

/* ورودی پیام */
.chat-input-area {
  padding: 12px 15px;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
}

.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.chat-input-area button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
}

.chat-input-area.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* پنل ادمین */
.admin-container {
  width: 90%;
  max-width: 1000px;
  height: 600px;
  display: flex;
}

.sidebar {
  width: 320px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  overflow-y: auto;
}

.sidebar-title {
  padding: 15px;
  background: rgba(0, 0, 0, 0.05);
  font-weight: 700;
}

.chat-item {
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item:hover,
.chat-item.active {
  background: rgba(255, 255, 255, 0.45);
}

.unread-badge {
  background: var(--unread-red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.main-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* فول‌اسکرین در موبایل */
@media (max-width: 600px) {
  body {
    background: var(--bg-light);
  }

  .chat-window {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .admin-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
}
