@font-face {
    font-family: 'Inter';
    /* Используем url_for в HTML или относительный путь в CSS */
    src: url('/static/fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter';
    color: #333;
    background: #ECF3F9;
}

svg {
    height: 20px;
    width: 20px;
}

header{
    background: white;
    border-bottom: 2px solid #E6E6E6;
    padding: 10px 0;
}

.main-container {
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 16px;
}

.selector-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    padding: 20px;
}

.header {
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  /* max-width: 1200px; */
  margin: 0 auto;
  border-bottom: 2px solid #E6E6E6;
  padding-bottom: 10px;
  justify-content: space-between;
}

/* ── Header ── */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo{
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: larger;
}

.logo svg{
  width: 35px !important;           /* берём из viewBox, или 40px — как хочешь */
  height: 39px !important;          /* сохраняем пропорции */
  flex-shrink: 0;
}

.notifications {
  font-size: 17px;
  color: #FF9500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shield {
  color: #667887;
  font-size: 1.3rem;
  font-weight: bold;
}

.user-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.menu-arrow {
  font-size: 0.85rem;
  color: #777;
  margin-left: 4px;
}

#chat-input:disabled,
#send-message:disabled {
  background: #f0f0f0 !important;
  color: #aaa !important;
  cursor: not-allowed !important;
  border-color: #ddd !important;
}

.view-ticket-btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #1F77B8;                /* основной синий из твоего проекта */
  background-color: transparent;
  border: 1px solid #1F77B8;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  margin-top: 8px;
}

.view-ticket-btn:hover {
  background-color: #1F77B8;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 119, 184, 0.25);
}

.view-ticket-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.view-ticket-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #ccc;
  color: #ccc;
}

/* Стрелочка сверху */
.menu-arrow-up {
  position: absolute;
  top: -6px;
  right: 12px;                     /* чуть левее правого края */
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid white;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 10px;
}

.menu-list li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: #222;
  text-decoration: none;
  font-size: 0.98rem;
  margin: 5px 0px;
}

.menu-list li a:hover,
.menu-list li a.active {
  background: #FCE6C6;
  /* color: #e65100; */
  border-radius: 10px;
}

.separator {
  height: 1px;
  background: #eee;
  margin: 4px 12px;
}

.exit a {
  color: #d32f2f;
}

.exit a:hover {
  background: #ffebee;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.08);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s ease;
  z-index: 9998;
}

.menu-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* На мобильных — чуть шире и ближе к краю экрана */
@media (max-width: 480px) {
  .user-menu-dropdown {
    right: 8px;
    width: 260px;
    left: auto;                    /* переопределяем, чтобы не растягивалось */
  }
  
  .menu-arrow-up {
    right: 16px;
  }
}

/* ── Компактный дропдаун под триггером ── */
.user-toggle {
  position: relative;              /* Якорь для absolute меню */
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  z-index: 1001;                   /* Чтобы меню не пряталось под sticky header */
}

.user-menu-dropdown {
  position: absolute;
  top: 100%;                       /* Сразу под высотой .user-toggle */
  right: 0px;                        /* Прижато к правому краю .user-toggle */
  width: 220px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.95) translateY(-4px);
  transform-origin: top right;
  visibility: hidden;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 1000;
  margin-top: 4px;                 /* Отступ от триггера для воздуха */
}

.user-menu-dropdown.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  visibility: visible;
}

/* Стрелочка сверху */
.menu-arrow-up {
  position: absolute;
  top: -6px;
  right: 12px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid white;
}

.selector-content {
    /* display: flex; */
    /* gap:10px; */
    padding: 20px;
    background: #ECF3F9;
    border-radius: 20px;
    margin-top: 20px;
}

.content {
  padding: 16px;
  /* min-width: 100vh; */
  /* margin: 10px auto; */
  border-radius: 20px;
  background: white;
}

h1 {
  margin-top: 0;
  font-size: 1.5rem;
}

/* Кнопка в правом нижнем углу */
.support-link {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: #1F77B8;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.25);
  z-index: 1000;
  cursor: pointer;
  transition: all 0.3s ease;
}

.support-link:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Окно чата */
.support-chat {
  position: fixed;
  bottom: 10px;
  right: 30px;
  width: 380px;
  height: 520px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

.support-chat.active {
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

/* Заголовок */
.chat-header {
  /* background: #1F77B8; */
  /* color: white; */
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.chat-title {
  font-size: 1.1rem;
}

.close-chat {
  background: none;
  border: none;
  /* color: white; */
  font-size: 24px;
  cursor: pointer;
  padding: 0 8px;
}

/* Сообщения */
.chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 80%;
}

.message.bot {
  background: #e9ecef;
  border-radius: 12px 12px 12px 0;
  padding: 10px 14px;
  align-self: flex-start;
}

.message.user {
  background: #1F77B8;
  color: white;
  border-radius: 12px 12px 0 12px;
  padding: 10px 14px;
  /* margin-left: auto; */
  align-self: flex-end;
}

.message.system {
  max-width: 100%;
  background: #ffffff;
  border: 1px solid #dde5ec;
  border-radius: 14px;
  padding: 12px 14px;
  color: #334155;
}

.message-text {
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-time {
  margin-top: 6px;
  font-size: 0.78rem;
  color: rgba(51, 65, 85, 0.7);
}

.message.user .message-time {
  color: rgba(255, 255, 255, 0.72);
}

.support-note {
  font-weight: 600;
  margin-bottom: 10px;
}

.empty-state {
  color: #637180;
}

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket-card {
  padding: 12px;
  border: 1px solid #dbe4ec;
  border-radius: 12px;
  background: #f8fbfd;
}

.ticket-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.ticket-card-meta {
  color: #607080;
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.ticket-card-preview {
  color: #334155;
  font-size: 0.92rem;
  margin-bottom: 10px;
}

.ticket-card-preview.empty {
  color: #94a3b8;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-open {
  background: #fff4df;
  color: #9a6400;
}

.status-answered {
  background: #e4f6ea;
  color: #1f7d47;
}

.status-closed {
  background: #edf1f5;
  color: #62707c;
}

.status-unknown {
  background: #f0f2f5;
  color: #596674;
}

/* Кнопки действий */
.chat-actions {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid #e9ecef;
  background: white;
}

.action-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid #1F77B8;
  background: white;
  color: #1F77B8;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.action-btn:hover {
  background: #1F77B8;
  color: white;
}

/* Поле ввода */
.chat-input-area {
  display: flex;
  padding: 12px 16px;
  border-top: 1px solid #e9ecef;
  background: white;
}

#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  resize: none;
  font-size: 0.95rem;
  line-height: 1.4;
  max-height: 120px;
}

#send-message {
  width: 48px;
  height: 48px;
  margin-left: 12px;
  background: #1F77B8;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#send-message:hover {
  background: #0d5db8;
}

/* Оверлей на мобильных */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.chat-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Адаптив */
@media (max-width: 480px) {
  .support-chat {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  
  .support-link {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 26px;
  }
}

@media (max-width: 768px){
  .selector-content {
        flex-direction: column;
        gap: 0;
        background: none;
        padding: 0;
    }
  
  .main-container {
        padding: 0;
        margin: 0;
    }
}

/* Фикс для мобильных: не даём улетать за экран */
@media (max-width: 480px) {
  .content{
    margin: 0 auto;
    border-radius: 0px;
    /* height: 100vh; */
    padding: 0px;
  }

  .user-menu-dropdown {
    margin: 5%;            /* Сдвиг, чтобы прижато к краю */
    /* width: calc(95vw); */      /* Адаптивная ширина, но не больше экрана */
  }
  
  .header{
    padding-bottom: 10px;        /* Отступы по краям для мобильных */
  }

  .notifications {
    font-size: 0.95rem;
    /* font-weight: bold; */
  }

  .menu-arrow-up {
    right: 24px;                   /* Корректировка стрелки */
  }

  .logo-text{
    display: none;                /* Скрываем текст на мобильных */
  }

  .selector-card{
    border-radius: 0;
    box-shadow: none;
    height: auto;
    padding: 20px 10px;
  }
}

.ticket-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.ticket-modal .modal-content {
  background: white;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

.ticket-modal .close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  cursor: pointer;
  color: #333;
}

.messages-list {
  max-height: 400px;
  overflow-y: auto;
  margin: 1rem 0;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}
