/* ===== Базовые переменные и сброс ===== */
:root {
  --sidebar-bg: linear-gradient(165deg, #2d0a5e 0%, #3b0764 100%);
  --sidebar-width: 280px;
  --text-light: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --accent-gold: #ffd966;
  --content-bg: #ffffff;
  --shadow: 0 20px 45px -12px rgba(0, 0, 0, 0.25);
  --border-radius: 28px;
}

body {
  margin: 0; padding: 0; height: 100vh;
  background: #f4f2f9;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex; justify-content: center; align-items: center; overflow: hidden;
}

.app-container {
  display: flex; width: 90vw; height: 90vh; max-width: 1400px;
  background: var(--content-bg); border-radius: var(--border-radius); box-shadow: var(--shadow); overflow: hidden;
}

/* Левая панель (основное меню) */
.sidebar {
  width: var(--sidebar-width); background: var(--sidebar-bg); color: var(--text-light);
  display: flex; flex-direction: column; flex-shrink: 0; padding: 32px 20px; box-sizing: border-box;
}
.profile-block { text-align: center; margin-bottom: 28px; }
.avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent-gold);
  background: #d9c7ff; box-shadow: 0 6px 18px rgba(0,0,0,0.3); margin-bottom: 14px;
}
.profile-id { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.profile-rating { font-size: 15px; font-weight: 500; color: var(--accent-gold); letter-spacing: 1px; }
.menu { display: flex; flex-direction: column; gap: 6px; margin-top: 20px; }
.menu hr { border: none; border-top: 1px solid rgba(255,255,255,0.2); margin: 6px 0; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.72); cursor: pointer; transition: all 0.2s ease;
}
.menu-item:hover { background: rgba(255,255,255,0.12); color: #fff; }
.menu-item.active { background: rgba(255,255,255,0.18); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.15); font-weight: 600; }
.menu-icon { font-size: 18px; width: 24px; text-align: center; }
.menu-item.sub-item { padding-left: 32px; font-size: 13px; color: rgba(255,255,255,0.6); }
.menu-item.sub-item .menu-icon { font-size: 16px; }
.menu-item.sub-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.menu-item.sub-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 500; box-shadow: none; }

/* Правая область контента */
.content { flex: 1; display: flex; flex-direction: column; background: #fafcff; min-height: 0; }
.content-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px; background: #fff; border-bottom: 1px solid #edf2f7; flex-shrink: 0;
}
.profile-back-link {
  background: none; border: none; color: #310a6b; font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer; font-family: inherit;
}
.profile-back-link:hover { opacity: 0.8; text-decoration: underline; }
.content-inner { flex: 1; overflow-y: auto; padding: 32px; }

/* Заголовки и кнопки */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-header .data-title { margin-bottom: 0; }
.action-button,
.action-button:link, .action-button:visited, .action-button:hover, .action-button:active {
  background: #310a6b; color: white; border: none; padding: 10px 22px; border-radius: 30px;
  font-size: 14px; font-weight: 500; text-decoration: none; display: inline-block; cursor: pointer;
  transition: background 0.2s, transform 0.1s; white-space: nowrap;
}
.action-button:hover { background: #4a1d8c; }
.action-button:active { transform: scale(0.97); }
.action-button:disabled { background: #cbd5e1; color: #94a3b8; cursor: not-allowed; }
.action-button:disabled:hover { background: #cbd5e1; }
.t-records a.action-button { color: white; }

/* Таблицы (для остальных разделов, кроме поиска) */
.data-title { font-size: 24px; font-weight: 600; color: #0a2540; }
.bootstrap-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bootstrap-table th, .bootstrap-table td {
  padding: 12px 8px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: middle;
}
.bootstrap-table th { font-weight: 600; background: #e2e8f0; color: #0f172a; border-bottom: 2px solid #cbd5e1; }
.bootstrap-table tbody tr:hover { background: #f1f5f9; }
.clickable-row { cursor: pointer; }

/* Баджи статусов */
.badge-status {
  display: inline-block; padding: 4px 12px; border-radius: 30px;
  font-size: 12px; font-weight: 500; background: #f1f5f9; color: #1e293b;
}
.badge-status.new { background: #dbeafe; color: #1e40af; }
.badge-status.accepted { background: #dcfce7; color: #166534; }
.badge-status.rejected { background: #fee2e2; color: #991b1b; }
.badge-status.archived { background: #f1f5f9; color: #64748b; }
.badge-status.active, .badge-status.open { background: #dbeafe; color: #1e40af; }
.badge-status.closed, .badge-status.completed { background: #dcfce7; color: #166534; }
.badge-status.processing { background: #fed7aa; color: #9a3412; }
.badge-status.pending { background: #fff3cd; color: #856404; }

.btn-link-table {
  background: none; border: none; color: #310a6b; font-size: 13px;
  cursor: pointer; padding: 4px 8px; border-radius: 20px; transition: 0.2s;
}
.btn-link-table:hover { background: #eef2ff; color: #1e1b4b; }

/* Прелоудер */
.loading-wave-wrapper { display: flex; justify-content: center; align-items: center; flex: 1; min-height: 300px; }
.loading-wave { width: 300px; height: 100px; display: flex; justify-content: center; align-items: flex-end; }
.loading-bar {
  width: 20px; height: 10px; margin: 0 5px; background-color: #310a6b; border-radius: 5px;
  animation: loading-wave-animation 1s ease-in-out infinite;
}
.loading-bar:nth-child(2) { animation-delay: 0.1s; }
.loading-bar:nth-child(3) { animation-delay: 0.2s; }
.loading-bar:nth-child(4) { animation-delay: 0.3s; }
@keyframes loading-wave-animation { 0% { height: 10px; } 50% { height: 50px; } 100% { height: 10px; } }

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
  body { overflow: hidden; }
  .app-container { flex-direction: column; height: 100vh; width: 100vw; border-radius: 0; margin: 0; }

  .sidebar { width: 100%; padding: 0; background: none; flex-direction: column; }
  .sidebar-default { display: none; }

  .mobile-mini-profile { display: none; background: var(--sidebar-bg); justify-content: center; align-items: center; padding: 10px 16px; flex-shrink: 0; }
  .mobile-logo { height: 28px; width: auto; display: block; margin: 0 auto; }

  .mobile-bottom-menu {
    display: flex; justify-content: space-around; align-items: center; background: var(--sidebar-bg);
    padding: 10px 0; border-top: 1px solid rgba(255,255,255,0.2); position: fixed; bottom: 0; left: 0;
    width: 100%; z-index: 900; flex-shrink: 0;
  }
  .mob-menu-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: rgba(255,255,255,0.6); font-size: 11px; cursor: pointer; transition: color 0.2s; padding: 4px 8px; border-radius: 12px; }
  .mob-menu-item.active { color: white; background: rgba(255,255,255,0.2); font-weight: 600; }
  .mob-menu-icon { font-size: 20px; }
  .mob-menu-label { font-size: 10px; }

  .content { flex: 1; min-height: 0; padding-bottom: 60px; }
  .content-topbar { padding: 12px 16px; position: sticky; top: 0; z-index: 10; background: white; }
  .content-inner { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  .data-title, h2.data-title { text-align: left !important; }
}

@media (max-width: 480px) {
  .profile-back-link { font-size: 14px; }
  .action-button { padding: 8px 18px; font-size: 13px; }
  .mob-menu-item { font-size: 10px; }
  .mob-menu-icon { font-size: 18px; }
}

/* Скрытие мобильных элементов на десктопе */
.mobile-mini-profile, .mobile-bottom-menu, .mobile-filter-fab, .mobile-filter-close { display: none !important; }
@media (max-width: 768px) {
  .mobile-mini-profile { display: flex !important; }
  .mobile-bottom-menu { display: flex !important; }
  .mobile-filter-fab { display: flex !important; }
  .mobile-filter-close { display: block !important; }
}

#content-area .data-title {
  text-align: left !important;
}