/* ==========================================
   PANELS (Detail panel / User info panel / Overlays)
   ========================================== */

/* ------------------------------------------
   DETAIL PANEL (Right slide-in)
   ------------------------------------------ */

.detail-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 100;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.detail-panel.open {
  right: 0;
}

.detail-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.detail-panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.detail-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.detail-section {
  margin-bottom: 28px;
}

.detail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.detail-value {
  font-size: 18px;
  font-weight: 500;
}

.detail-value.phone {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-cyan);
}

.detail-value.no-name {
  color: var(--text-secondary);
  font-style: italic;
}

/* Уменьшить и сделать серым label "ИМЯ" в панели деталей */
.detail-section .detail-label {
  color: var(--text-muted);
  font-size: 11px;
}

/* Detail panel - иконки под именем */
.detail-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

/* Дата регистрации меньше */
#detail-date {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Detail Status Icons */
.detail-status-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.detail-status-icons .status-icon {
  width: 32px;
  height: 32px;
}

.detail-status-icons .status-icon svg {
  width: 18px;
  height: 18px;
}

/* Секция устройства */
.detail-device-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.detail-device-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-device-row:last-child {
  border-bottom: none;
}

.detail-device-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.detail-device-value {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

/* ------------------------------------------
   COMMENT SECTION (inside Detail panel)
   ------------------------------------------ */

.comment-section {
  margin-top: 24px;
  padding: 0;
  border-top: none;
  background: transparent;
}

.comment-label {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-label svg {
  width: 16px;
  height: 16px;
  color: var(--accent-purple);
}

.comment-textarea {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  resize: vertical;
  transition: all 0.25s ease;
}

.comment-textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.comment-textarea::placeholder {
  color: var(--text-secondary);
}

/* ------------------------------------------
   CALL STATUS (inside panel)
   ------------------------------------------ */

.call-status-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
}

.call-status-label svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.call-status-label span {
  color: var(--text-primary);
}

.call-status-label.answered svg {
  color: var(--accent-green);
}

.call-status-label.missed svg {
  color: var(--accent-red);
}

.call-status-label.outgoing svg {
  color: var(--accent-cyan);
}

/* ------------------------------------------
   USER INFO PANEL (Right slide-in)
   ------------------------------------------ */

/* Кнопка информации в хедере чата */
.user-info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-left: 12px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.user-info-btn:hover {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: white;
}

.user-info-btn svg {
  width: 18px;
  height: 18px;
}

/* Оверлей */
.user-info-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.user-info-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Панель */
.user-info-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  z-index: 1002;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
}

.user-info-panel.open {
  transform: translateX(0);
}

.user-info-panel.shifted {
  transform: translateX(-100%);
}

/* Панель аренд */
.user-info-panel.rentals-panel {
  z-index: 1003;
}

/* Кнопка открытия аренд */
.user-info-rentals-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
}

.user-info-rentals-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
}

.rentals-btn-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rentals-btn-content svg {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
}

.rentals-btn-content span {
  font-size: 15px;
  font-weight: 500;
}

.rentals-btn-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rentals-active-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.rentals-total {
  font-size: 14px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.rentals-btn-meta > svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.user-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.user-info-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-info-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  cursor: pointer;
  border-radius: 10px;
  color: var(--text-secondary);
  transition: all 0.25s ease;
}

.user-info-close:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.user-info-close svg {
  width: 18px;
  height: 18px;
}

.user-info-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* Загрузка */
.user-info-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-secondary);
  gap: 16px;
}

/* Ошибка */
.user-info-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-secondary);
  text-align: center;
  gap: 12px;
}

.user-info-error svg {
  width: 48px;
  height: 48px;
  color: var(--accent-red);
  opacity: 0.7;
}

.user-info-retry {
  margin-top: 8px;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.user-info-retry:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Секции */
.user-info-section {
  margin-bottom: 28px;
}

.user-info-section:last-child {
  margin-bottom: 0;
}

.user-info-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

/* Поля информации */
.user-info-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(42, 42, 58, 0.5);
}

.user-info-field:last-child {
  border-bottom: none;
}

.user-info-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.user-info-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

.user-info-value.no-data {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

.user-info-value.verified {
  color: var(--accent-green);
}

.user-info-value.not-verified {
  color: var(--accent-red);
}

/* Баланс */
.user-info-balance {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
}

/* Аренды */
.user-info-rentals {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
}

.user-info-no-rentals {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-style: italic;
}

/* Карточка аренды */
.rental-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  transition: all 0.25s ease;
}

.rental-card:hover {
  border-color: rgba(0, 212, 255, 0.3);
}

.rental-card.active {
  border-left: 3px solid var(--accent-green);
}

.rental-card.completed {
  border-left: 3px solid var(--text-muted);
}

.rental-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.rental-warehouse {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  padding-right: 12px;
}

.rental-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}

.rental-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.rental-status.completed {
  background: rgba(85, 85, 102, 0.2);
  color: var(--text-muted);
}

.rental-cell {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-family: 'JetBrains Mono', monospace;
}

.rental-dates {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.rental-date {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rental-date-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rental-date-value {
  font-size: 13px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

.rental-guest {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.rental-guest-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.rental-guest-value {
  font-size: 13px;
  font-weight: 600;
}

.rental-guest-value.yes {
  color: var(--accent-orange);
}

.rental-guest-value.no {
  color: var(--text-muted);
}

/* ------------------------------------------
   Rentals button in Detail panel + shifting panels
   ------------------------------------------ */

/* Кнопка аренд в detail panel */
.detail-rentals-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  margin-top: 16px;
}

.detail-rentals-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
}

.detail-rentals-btn-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-rentals-btn-left svg {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
}

.detail-rentals-btn-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-rentals-btn-right svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* Detail panel shifted (когда открыта панель аренд) */
.detail-panel.shifted {
  right: 420px;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rentals panel */
#rentals-panel {
  z-index: 101;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#rentals-panel.open {
  transform: translateX(0);
}

/* Синхронная анимация для обеих панелей */
.detail-panel {
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Шапка панели аренд как у информации */
#rentals-panel .user-info-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}

#rentals-panel .user-info-header h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

/* ------------------------------------------
   Mobile Responsive for panels
   ------------------------------------------ */

@media (max-width: 768px) {
  .detail-panel {
    width: 100%;
    right: -100%;
  }

  .detail-panel.open {
    right: 0;
  }

  .detail-header {
    padding: 20px;
  }

  .detail-header h2 {
    font-size: 18px;
  }

  .detail-content {
    padding: 20px;
  }

  .detail-section {
    margin-bottom: 24px;
  }

  .detail-value {
    font-size: 16px;
  }

  .comment-section {
    padding: 0;
  }

  .comment-textarea {
    min-height: 100px;
    padding: 14px;
  }

  /* Mobile Responsive для UserInfo */
  .user-info-panel {
    width: 100%;
  }

  .user-info-header {
    padding: 16px 20px;
  }

  .user-info-header h3 {
    font-size: 16px;
  }

  .user-info-content {
    padding: 20px;
  }

  .user-info-balance {
    font-size: 24px;
  }

  .rental-dates {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .user-info-btn {
    width: 28px;
    height: 28px;
    margin-left: 8px;
  }

  .user-info-btn svg {
    width: 16px;
    height: 16px;
  }

  .user-info-header {
    padding: 14px 16px;
  }

  .user-info-content {
    padding: 16px;
  }

  .user-info-section {
    margin-bottom: 24px;
  }

  .rental-card {
    padding: 14px;
  }
}

/* ------------------------------------------
   Mobile fix: scroll entire detail panel
   (как у тебя в конце файла)
   ------------------------------------------ */

@media (max-width: 768px) {
  .detail-panel {
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .detail-content {
    flex: 0 0 auto;
    overflow: visible;
  }

  .comment-section {
    margin-top: 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}
