/* ═══════════════════════════════════════════════════════════
   Avtarium Internal Layout CSS
   Система классов для замены inline стилей
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   LAYOUT GRIDS
   ═══════════════════════════════════════════════════════════ */

/* Главный layout: основной контент + sidebar справа (2/3 + 1/3) */
.grid-main-sidebar {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  align-items: stretch;
}

/* Сетка 3 колонки равномерно */
.grid-3-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* Сетка 2 колонки равномерно */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* Сетка 2 колонки для карточек (используется внизу) */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  align-items: stretch;
}

.grid-2 > * {
  min-height: 100%;
}

/* Сетка 4 колонки для KPI карточек */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

/* ═══════════════════════════════════════════════════════════
   SPACING - УНИФИЦИРОВАННЫЕ ОТСТУПЫ
   ═══════════════════════════════════════════════════════════ */

/* Отступ между карточками */
.card-spacing {
  margin-bottom: var(--space-6);
}

/* Последняя карточка без отступа снизу */
.card-spacing:last-child,
.mb-0 {
  margin-bottom: 0;
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-3 {
  margin-top: var(--space-3);
}

/* ═══════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════ */

/* Заголовки разделов */
.text-heading {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

/* Заголовок с иконкой */
.heading-with-icon {
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
}

/* Подсказка/hint текст */
.text-hint {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 400;
}

/* Метка (uppercase, мелкий шрифт) */
.metric-label,
.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Крупное значение метрики */
.metric-value {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

/* KPI значения - унифицированные, без bold */
.kpi-value {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: var(--space-2);
  color: var(--text);
  font-feature-settings: 'tnum';
  letter-spacing: -0.02em;
}

.kpi-currency {
  font-size: 22px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 4px;
}

.kpi-change {
  font-size: 13px;
  font-weight: 500;
  margin-left: var(--space-2);
}

/* Размеры шрифтов */
.text-26 {
  font-size: 26px;
  font-weight: 700;
}

.text-22 {
  font-size: 22px;
  font-weight: 600;
  color: var(--mint);
  margin-bottom: 4px;
}

.text-18 {
  font-size: 18px;
  font-weight: 600;
}

.text-16 {
  font-size: 16px;
  font-weight: 600;
}

.text-13 {
  font-size: 13px;
  font-weight: 500;
}

.text-12 {
  font-size: 12px;
}

.text-11 {
  font-size: 11px;
}

.text-10 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* Цвета текста */
.text-muted {
  color: var(--muted);
}

.text-mint {
  color: var(--mint);
}

.text-danger {
  color: #ef4444;
}

.text-warning,
.text-amber {
  color: #fbbf24;
}

.text-ozon {
  color: #005bff;
  font-weight: 600;
}

.text-wb {
  color: #cb11ab;
  font-weight: 600;
}

.text-blue {
  color: #3b82f6;
}

/* Комбинированные классы текста */
.text-13-500-muted {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.text-13-semibold-amber,
.text-13-600-amber {
  font-size: 13px;
  font-weight: 500;
  color: #fbbf24;
  opacity: 0.85;
}

.text-13-600-blue {
  font-size: 13px;
  font-weight: 500;
  color: #3b82f6;
  opacity: 0.85;
}

.text-13-600-danger {
  font-size: 13px;
  font-weight: 500;
  color: #ef4444;
  opacity: 0.85;
}

/* Ссылки в блоке внимания */
.recommendation-link {
  display: block;
  padding: 4px 0;
  color: var(--text);
  text-decoration: none;
  opacity: 0.8;
  font-size: 12px;
  transition: opacity 0.15s;
}

.recommendation-link:hover {
  opacity: 1;
}

.alert-link {
  display: block;
  padding: 6px 0;
  text-decoration: none;
  font-size: 12px;
  transition: opacity 0.15s;
}

.alert-link:hover {
  opacity: 0.8;
}

/* Дата/время заказа - компактно и ненавязчиво */
.order-datetime {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.9;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ═══════════════════════════════════════════════════════════
   SURFACES & CARDS
   ═══════════════════════════════════════════════════════════ */

/* Карточка с градиентом мяты */
.card-gradient-mint {
  background: linear-gradient(135deg, rgba(0, 217, 165, 0.08) 0%, transparent 100%);
}

/* Внутренняя поверхность (для вложенных блоков) */
.surface-card {
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: var(--space-3);
}

.surface-p2-3 {
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-radius: var(--r-sm);
}

/* Карточка магазина (ozon/wb) */
.shop-card {
  flex: 1;
  padding: var(--space-3);
  background: var(--surface);
  border-radius: var(--r-md);
}

.shop-card-ozon {
  border-left: 3px solid #005bff;
}

.shop-card-wb {
  border-left: 3px solid #cb11ab;
}

/* Карточка в sidebar (горизонтальный скролл) */
.sidebar-card {
  flex: 0 0 200px;
  min-width: 200px;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--space-3);
}

/* ═══════════════════════════════════════════════════════════
   FLEXBOX UTILITIES
   ═══════════════════════════════════════════════════════════ */

.flex-gap-3 {
  display: flex;
  gap: var(--space-3);
}

.flex-gap-2 {
  display: flex;
  gap: var(--space-2);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.flex-baseline {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-col-gap-2 {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.flex-1 {
  flex: 1;
}

/* Горизонтальный скролл */
.flex-scroll {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

.flex-scroll::-webkit-scrollbar {
  height: 6px;
}

.flex-scroll::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════
   GOAL / PROGRESS BARS
   ═══════════════════════════════════════════════════════════ */

.goal-container {
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.goal-edit-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.goal-edit-btn:hover {
  color: var(--text);
}

.progress-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s;
}

/* Progress bars в воронке */
.progress-bar-mint,
.progress-bar-yellow,
.progress-bar-blue,
.progress-bar-danger,
.progress-bar-amber,
.progress-bar-purple {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.progress-bar-mint {
  background: var(--mint);
}

.progress-bar-yellow {
  background: #fbbf24;
}

.progress-bar-blue {
  background: #3b82f6;
}

.progress-bar-danger {
  background: #ef4444;
}

.progress-bar-amber {
  background: #f59e0b;
}

.progress-bar-purple {
  background: #a855f7;
}

/* Тонкий progress bar для регионов */
.progress-thin {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   STATUS FUNNEL
   ═══════════════════════════════════════════════════════════ */

.funnel-item {
  min-width: 60px;
  border-radius: var(--r-sm);
  padding: var(--space-3);
  text-align: center;
  position: relative;
  overflow: hidden;
  cursor: help;
}

.funnel-processing {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.1));
}

.funnel-shipped {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
}

.funnel-delivered {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.2), rgba(74, 222, 128, 0.1));
}

.funnel-cancelled {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
}

.funnel-returned {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.05));
}

.funnel-value {
  font-size: 24px;
  font-weight: 600;
}

.funnel-value-yellow {
  color: #fbbf24;
}

.funnel-value-blue {
  color: #3b82f6;
}

.funnel-value-mint {
  color: var(--mint);
}

.funnel-value-danger {
  color: #ef4444;
}

.funnel-value-purple {
  color: #a855f7;
}

.funnel-label {
  font-size: 11px;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════
   FEES & PROFIT VISUALIZATION
   ═══════════════════════════════════════════════════════════ */

.fees-total-bar {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.3), rgba(245, 158, 11, 0.3), rgba(139, 92, 246, 0.3), rgba(59, 130, 246, 0.3));
  border-radius: var(--r-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  text-align: center;
}

.profit-bar {
  border-radius: var(--r-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  text-align: center;
}

.profit-bar-positive {
  background: rgba(16, 185, 129, 0.2);
}

.profit-bar-negative {
  background: rgba(239, 68, 68, 0.2);
}

.fee-item,
.profit-item {
  min-width: 50px;
  border-radius: var(--r-sm);
  padding: var(--space-2);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.fee-commission {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
}

.fee-logistics {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
}

.fee-storage {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.1));
}

.fee-penalty {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
}

.fee-returns {
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.2), rgba(251, 113, 133, 0.1));
}

.fee-other {
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.2), rgba(107, 114, 128, 0.1));
}

.profit-revenue {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.2), rgba(74, 222, 128, 0.1));
}

.profit-cost {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
}

.profit-fees {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
}

.profit-net-positive {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
}

.profit-net-negative {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
}

/* ═══════════════════════════════════════════════════════════
   TABLE UTILITIES
   ═══════════════════════════════════════════════════════════ */

.table-container {
  overflow-x: auto;
  min-width: 100%;
}

.table {
  width: 100%;
  min-width: 800px;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.max-w-250 {
  max-width: 250px;
}

/* ═══════════════════════════════════════════════════════════
   MISC UTILITIES
   ═══════════════════════════════════════════════════════════ */

/* Разделитель с отступом */
.divider-mt {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* Warning box */
.warning-box {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: rgba(251, 191, 36, 0.1);
  border-radius: var(--r-sm);
  border-left: 3px solid #fbbf24;
  font-size: 12px;
}

/* Inline badge / chip */
.inline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Минимальная ширина для flex-child */
.flex-1-min0 {
  flex: 1;
  min-width: 0;
}

/* Section header с иконкой и подсказкой */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.section-header h3 {
  margin: 0;
}

/* Filter row - заголовок с иконкой */
.filter-row {
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
}

.filter-row svg {
  flex-shrink: 0;
}

/* Навигационная ссылка в списке */
.nav-link-item {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 10px 12px !important;
  margin: 0 -12px !important;
  text-decoration: none !important;
  color: var(--text) !important;
  border-radius: var(--r-sm) !important;
  background: transparent !important;
  transition: all 0.15s !important;
}

.nav-link-item:hover {
  background: rgba(0, 217, 165, 0.08) !important;
  color: var(--text) !important;
}

.nav-link-item:hover .text-13 {
  color: var(--mint) !important;
}

/* Колонка списка */
.flex-col-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Margin/padding helpers */
.p-4 {
  padding: var(--space-4);
}

.m0 {
  margin: 0;
}

/* Text alignment */
.text-left {
  text-align: left;
}

/* Font weights */
.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-400 {
  font-weight: 400;
}

/* Utility для скрытия переполнения */
.overflow-hidden {
  overflow: hidden;
}

/* Relative positioning */
.relative {
  position: relative;
}

/* ═══════════════════════════════════════════════════════════
   PERIOD FILTER - БЕЗ КАРТОЧКИ, МИНИМАЛИСТИЧНЫЙ
   ═══════════════════════════════════════════════════════════ */
.period-filter {
  margin-bottom: var(--space-6);
}

.period-filter-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.period-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: var(--r-md);
}

.period-tab {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: all 0.15s;
}

.period-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.period-tab.active {
  color: var(--mint);
  background: var(--mint-subtle);
}

.period-custom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.period-date {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  width: 140px;
  transition: all 0.15s;
  color-scheme: dark;
  cursor: pointer;
}

.period-date:focus {
  outline: none;
  border-color: var(--mint);
  background: var(--bg-elevated);
}

/* Видимость календарной иконки */
.period-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
  filter: invert(0.6);
}

.period-date::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  filter: invert(0.8);
}

.period-separator {
  color: var(--muted);
  font-size: 13px;
}

.period-apply,
.period-export {
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.period-apply:hover,
.period-export:hover {
  color: var(--mint);
  border-color: var(--mint);
  background: var(--mint-subtle);
}

.period-apply svg,
.period-export svg {
  display: block;
}
