/* =====================================================
   1. ROOT VARIABLES
   ===================================================== */
:root {
  --color-primary: #5661f6;
  --color-accent: #ffb178;
  --color-bg-light: #f8faff;
  --color-bg-dark: #121212;
  --color-text-dark: #2d2d2d;
  --color-text-light: #f0f0f0;
  --color-hover-bg: rgba(200, 210, 255, 0.85);
  --radius: 12px;
  --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 6px 18px rgba(86, 97, 246, 0.25);
  --cm-bg: #fff;
  --cm-fg: #2d2d2d;
  --cm-border: #ddd;
  --cm-radius: 8px;
  --cm-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --cm-hover: #f0f0f0;
  --cm-active: #e0e0e0;
  --cm-muted: #888;
  --cm-item-h: 32px;
  --cm-pad-x: 12px;
  --bg-gradient-card: linear-gradient(180deg, #fff 0%, #f9f9ff 100%);
  --transition: 0.3s ease;
  --blur-strength: 12px;
  --saturate-strength: 180%;
  --blur-bg-light: rgba(255, 255, 255, 0.25);
  --blur-bg-strong: rgba(255, 255, 255, 0.45);
  --shadow-base: 0 8px 24px rgba(0, 0, 0, 0.08);
  --border-glass: 1px solid rgba(255, 255, 255, 0.3);
  --hover-primary-light: rgba(86, 97, 246, 0.1);
  --hover-primary-strong: rgba(86, 97, 246, 0.25);
}

/* =====================================================
   2. BASE ELEMENTS
   ===================================================== */
body {
  background: linear-gradient(145deg, #e8edff 0%, #f4f7ff 100%);
  color: var(--color-text-dark);
  transition: background-color var(--transition), color var(--transition);
  width: 100%;
}

h1,
h2,
h3,
h4 {
  color: var(--color-text-dark);
  font-weight: 600;
}

#theme-body {
  background-color: var(--color-bg-light);
  color: var(--color-text-dark);
}

/* === Utility: Blur, Transition, Radius, Border for Glassy Components === */
.rounded-base {
  border-radius: var(--radius);
}
.border-glass {
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

/* =====================================================
   UNIVERSAL GLASS EFFECT (Optimized)
   ===================================================== */

/* Базовый стеклянный фон */
.glass {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.2) 100%
  );
  border: var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow-base), inset 0 1px 0 var(--blur-bg-light);
  transition: var(--transition);
  isolation: isolate;
}

/* Общие эффекты блюра и насыщения */

/* Внутренний свет */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 var(--blur-bg-strong),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  pointer-events: none;
}

/* Вариации */
.glass.light {
  background: rgba(255, 255, 255, 0.15);
}

.glass.strong {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(20px) saturate(200%);
}

/* Упрощённая база (для карточек, таблиц и т.п.) */
.glass-base {
  position: relative;
  background: var(--blur-bg-light);
  border: var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow-base), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: var(--transition);
  isolation: isolate;
}

/* =====================================================
   3. NAVIGATION BAR
   ===================================================== */
.navbar {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(248, 250, 255, 0.8) 100%
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-scroller .nav {
  display: flex;
  flex-wrap: nowrap;
  padding-bottom: 1rem;
  margin-top: -1px;
  overflow-x: auto;
  white-space: nowrap;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

.nav-link {
  position: relative;
  padding: 0.5rem 1rem 4px;
  border-radius: var(--radius);
  color: var(--color-text-dark);
  cursor: pointer;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.nav-link:hover {
  background-color: var(--color-hover-bg);
  color: var(--color-primary);
}

.nav-link.active-custom {
  color: var(--color-primary) !important;
  font-weight: 600;
}

/* =====================================================
   DROPDOWN MENU (GLASS STYLE)
   ===================================================== */

.dropdown-menu {
  transition: none;
  transform: none;
  opacity: 1;
  z-index: 2000 !important;
}

.dropdown-menu.glass {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), inset 0 1px 0 var(--blur-bg-light);
  padding: 6px;
  overflow: hidden;
}

.dropdown-menu.glass,
.dropdown-menu,
.dropdown-item,
.dropdown-menu.show {
  backdrop-filter: blur(var(--blur-strength)) saturate(var(--saturate-strength));
  -webkit-backdrop-filter: blur(var(--blur-strength))
    saturate(var(--saturate-strength));
  border-radius: var(--radius);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.dropdown-item {
  background: transparent !important;
  border: none !important;
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease;
}

.dropdown-item:hover {
  background-color: var(--color-hover-bg) !important;
  transform: translateY(-1px);
}

.dropdown-item.active,
.dropdown-item:active {
  background-color: var(--color-hover-bg) !important;
  color: var(--color-text-dark) !important;
  transform: translateY(-1px);
}

.dropdown-toggle::after {
  display: none !important;
  opacity: 0;
}

.dropdown-menu.show {
  opacity: 1;
  transform: translateY(0);
}

/* =====================================================
   4. HOVER & UTILITY CLASSES
   ===================================================== */
.hover-dropdown .dropdown-menu {
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.3s ease, visibility 0.25s ease;
  margin-top: 0;
}

.hover-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.hoverable {
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.25s ease;
  cursor: pointer;
}

.hoverable:hover {
  background-color: var(--color-hover-bg);
  box-shadow: var(--shadow-hover);
}

#clearSearch i {
  display: inline-block;
  transition: opacity 0.3s ease;
}

#clearSearch:hover i {
  opacity: 0.8;
}

/* =====================================================
   5. BUTTONS
   ===================================================== */

.btn {
  border: none !important;
  border-radius: 8px !important;
  padding: 6px 14px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  color: var(--color-text-dark) !important;
  transition: all 0.3s ease !important;
}

.btn-circle {
  background: var(--color-bg-light);
  width: 40px; /* Adjust as needed for your button size */
  height: 40px; /* Adjust as needed for your button size */
  border-radius: 50%;
  border: none;
  text-align: center;
  display: flex; /* Use flexbox for centering content */
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-light);
}

.btn-circle:hover {
  background: var(--color-hover-bg) !important;
  transform: translateY(-1px) !important;
}

.btn-circle:active {
  background: var(--color-primary) !important;
  color: white !important;
  box-shadow: 0 4px 16px rgba(86, 97, 246, 0.25) !important;
}

.btn-group {
  background: none !important;
  border-radius: 12px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: inline-flex;
}

.btn:hover {
  background: var(--color-hover-bg) !important;
  transform: translateY(-1px) !important;
}

.btn.active {
  background: var(--color-primary) !important;
  color: white !important;
  box-shadow: 0 4px 16px rgba(86, 97, 246, 0.25) !important;
}

/* Button color variants */
.btn-primary {
  background: var(--color-primary) !important;
  color: #fff !important;
}

.btn-primary:hover {
  background: #4752e1 !important;
}

.btn-success {
  background: #00c896 !important;
  color: #fff !important;
}

.btn-success:hover {
  background: #00b285 !important;
}

.btn-danger {
  background: #ff5a5a !important;
  color: #fff !important;
}

.btn-danger:hover {
  background: #e64b4b !important;
}

.btn-warning {
  background: #ffb178 !important;
  color: #fff !important;
}

.btn-warning:hover {
  background: #ffa05c !important;
}

.btn-secondary {
  background: rgba(90, 98, 104, 1) !important;
  color: #fff !important;
}

.btn-secondary:hover {
  background: rgba(70, 78, 84, 1) !important;
}

.btn-dark {
  background: #2d2d2d !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  transition: all 0.3s ease !important;
}

.btn-dark:hover {
  background: #1f1f1f !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
  transform: translateY(-1px) !important;
}

button.btn-nohover:hover,
.btn-nohover:hover,
.btn-nohover:focus,
.btn-nohover:active,
.btn-glass.btn-nohover:hover {
  transform: none !important;
  background: none !important;
  color: inherit !important;
  box-shadow: none !important;
}

.badge-glass {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(86, 97, 246, 0.15);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.75rem;
}

.badge-glass.success {
  color: #00c896;
  background: rgba(0, 200, 150, 0.15);
}
.badge-glass.danger {
  color: #ff5a5a;
  background: rgba(255, 90, 90, 0.15);
}
.badge-glass.secondary {
  color: rgba(90, 98, 104, 1);
  background: rgba(90, 98, 104, 0.35);
}
.badge-glass.warning {
  color: #ffb178;
  background: rgba(255, 177, 120, 0.25);
}

.amount-positive {
  color: #009e5c !important;
}

.amount-negative {
  color: #d63d3d !important;
}

/* =====================================================
   6. TABLES
   ===================================================== */
.table {
  background: var(--cm-bg);
  color: var(--color-text-dark);
  border-radius: var(--radius);
  transition: all 0.3s ease;
}

.table-hover tbody tr:hover {
  background: rgba(86, 97, 246, 0.12);
  transform: scale(1.01);
  transition: background 0.3s ease, transform 0.4s ease;
}

.table thead th {
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #8ea2ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

tbody tr {
  animation: fadeInRow 0.3s ease;
}

/* =====================================================
   7. CARDS
   ===================================================== */
.card {
  position: relative;
  border: none !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  background: var(--cm-bg);
  padding: 1rem;
  color: var(--color-text-dark);
  overflow: visible !important;
  z-index: 1;
  border-radius: var(--radius);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 6px 24px rgba(86, 97, 246, 0.1);
}

.card-lift {
  transition: transform 0.4s ease, box-shadow 0.25s ease;
}

.card-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 30px rgba(86, 97, 246, 0.15);
}

/* Заголовок карточки */
.card-header {
  border-bottom: 1px solid rgba(86, 97, 246, 0.08);
  color: var(--color-text-dark);
  font-weight: 600;
  padding: 0.75rem 1.25rem;
}

/* Тело карточки */
.card-body {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: visible !important;
  position: relative;
  z-index: 2;
}

/* Чтобы dropdown или tooltip не обрезались */
.card,
.card-body {
  overflow: visible !important;
}

/* =====================================================
   8. MODALS
   ===================================================== */
.quickmodal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  animation: fadeIn 0.3s ease;
}

.quickmodal {
  background: var(--cm-bg);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-light);
}

.quickmodal-title {
  margin: 0 0 10px;
  font-weight: 600;
  color: var(--color-text-dark);
}

.quickmodal-body {
  margin-bottom: 16px;
  color: var(--color-text-dark);
}

.quickmodal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =====================================================
   9. CONTEXT MENU (GLASS STYLE)
   ===================================================== */
.custom-context-menu {
  display: none;
  position: absolute;
  z-index: 9999;
  color: var(--cm-fg);
  border-radius: var(--cm-radius);
  padding: 6px;
  min-width: 160px;
  opacity: 0;
}

/* Показ при открытии */
.custom-context-menu[style*="display: block"] {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.custom-context-item {
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease;
  border-radius: var(--radius);
}
/* При наведении — чуть больше света */
.custom-context-item:hover {
  background-color: var(--color-hover-bg);
  transform: translateY(-1px);
}

/* =====================================================
   10. ANIMATIONS
   ===================================================== */
.fade-row-enter {
  opacity: 0;
  transform: translateY(6px);
}

.fade-row-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-row-exit {
  opacity: 1;
  transform: translateY(0);
}

.fade-row-exit-active {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-enter {
  opacity: 0;
  transform: translateY(8px);
}

.fade-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-appear {
  opacity: 0;
  transform: translateY(8px);
}

.fade-appear-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-exit {
  opacity: 1;
}

.fade-exit-active {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.fade-exit-done {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInRow {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-danger {
  background: rgba(255, 140, 160, 0.18) !important;
  color: #d63d3d !important;
  border: 1px solid rgba(255, 140, 160, 0.35) !important;
  border-radius: var(--radius);
}

/* === Ostel Toast Styles === */
.Toastify__toast {
  border-radius: var(--radius) !important;
  background: rgba(255, 255, 255, 0.75) !important;
  border: none !important;
  color: var(--color-text-dark) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08) !important;
  font-weight: 500 !important;
  padding: 14px 18px !important;
  transition: all 0.35s ease !important;
}

.Toastify__toast:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.12) !important;
}

.Toastify__toast--success {
  background: rgba(0, 200, 150, 0.1) !important;
  color: #009e7a !important;
}

.Toastify__toast--warning {
  background: rgba(255, 177, 120, 0.1) !important;
  color: #d68040 !important;
}

.Toastify__toast--error {
  background: rgba(255, 90, 90, 0.1) !important;
  color: #d63d3d !important;
}

.Toastify__toast--info {
  background: rgba(86, 97, 246, 0.08) !important;
  color: var(--color-primary) !important;
}

/* Hide Toastify icons completely */
.Toastify__toast-icon {
  display: none !important;
  visibility: hidden !important;
}

#filtersPanel {
  position: relative;
  z-index: 50; /* поднимает фильтры над summary */
  overflow: visible !important;
}

#filtersPanel .dropdown-menu {
  z-index: 9999 !important;
}

/* === Единый стиль Glass для всех форм === */

.form-control {
  background: var(--blur-bg-light) !important;
  color: var(--color-text-dark) !important;
  padding: 8px 12px !important;
  font-size: 0.95rem !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02) !important;
  border-radius: var(--radius);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.form-control:hover {
  border-color: rgba(86, 97, 246, 0.4) !important;
  background: rgba(255, 255, 255, 0.35) !important;
}

.form-control:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 4px rgba(86, 97, 246, 0.15) !important;
  background: var(--blur-bg-strong) !important;
  outline: none !important;
}

.form-control::placeholder {
  color: rgba(0, 0, 0, 0.5) !important;
}

.form-control.is-invalid {
  border-color: rgba(255, 90, 90, 0.6) !important;
  background: rgba(255, 0, 0, 0.05) !important;
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

/* Селекты (native) */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg fill='rgba(0,0,0,0.6)' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E<path d='M7 7l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

/* === Unified Glass Select Styles (React Select only) === */

.react-select__control,
.react-select__menu {
  background: var(--blur-bg-light) !important;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  transition: all 0.3s ease;
  color: var(--color-text-dark) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

/* Hover & Focus states */
.react-select__control--is-focused {
  border-color: rgba(86, 97, 246, 0.5) !important;
  box-shadow: 0 0 0 4px rgba(86, 97, 246, 0.15) !important;
}

.react-select__option--is-focused {
  background: rgba(86, 97, 246, 0.1) !important;
}

.react-select__option--is-selected {
  background: rgba(86, 97, 246, 0.25) !important;
}

.glass,
.glass-base,
.dropdown-menu,
.form-control,
.react-select__control,
.react-select__menu,
.table,
.navbar,
.card,
.btn-circle,
.alert-danger,
.Toastify__toast,
.btn-group .badge-glass {
  backdrop-filter: blur(var(--blur-strength)) saturate(var(--saturate-strength));
  -webkit-backdrop-filter: blur(var(--blur-strength))
    saturate(var(--saturate-strength));
}
