/* ==========================================================================
   ПЕРЕИСПОЛЬЗУЕМЫЕ КОМПОНЕНТЫ
   Один "рецепт" карточки/строки на всё приложение — новый блок или кнопка
   добавляются данными в js/config.js, а не новой вёрсткой/CSS.
   ========================================================================== */

/* ---- Карточка-список (группа строк, как в iOS Settings) ---- */
.card{
  background: var(--bg-elevated);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.row{
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  position: relative;
}
.row:active{ background: var(--bg-elevated-2); }

/* разделитель между строками внутри карточки (кроме последней) */
.row + .row::before{
  content: "";
  position: absolute;
  left: 14px;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--divider);
}
/* если у строки есть иконка — разделитель начинается после иконки, как в iOS */
.row.has-icon + .row.has-icon::before{ left: 50px; }

.row-icon{
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.row-icon svg{ width: 17px; height: 17px; }

.row-body{
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.row-title{
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-subtitle{
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-trailing{
  flex: 0 0 auto;
  font-size: 15px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.row-chevron{ color: var(--chevron); flex: 0 0 auto; }

/* Значок-статус ("Неактивна" в макете настроек) — тоже переиспользуемый */
.row-status{ font-size: 15px; color: var(--text-secondary); }

/* Цвета бейджей иконок — подставляются через data-атрибут в разметке */
.row-icon[data-color="blue"]{   background: var(--icon-blue); }
.row-icon[data-color="green"]{  background: var(--icon-green); }
.row-icon[data-color="orange"]{ background: var(--icon-orange); }
.row-icon[data-color="purple"]{ background: var(--icon-purple); }
.row-icon[data-color="pink"]{   background: var(--icon-pink); }
.row-icon[data-color="red"]{    background: var(--icon-red); }
.row-icon[data-color="teal"]{   background: var(--icon-teal); }
/* "custom" — цветная SVG-иконка со своим фоном/скруглением внутри самого
   SVG (см. /admin/icons, цветные иконки типа doc-color/photo-color): не
   рисуем кружок-подложку и растягиваем иконку во всю плашку 30x30. */
.row-icon[data-color="custom"]{ background: transparent; }
.row-icon[data-color="custom"] svg{ width: 30px; height: 30px; }

/* ---- Плитки шаблонов (страница "Создать") ---- */
.tile-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tile{
  aspect-ratio: 1 / 1.05;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: none;
  cursor: pointer;
}

/* ==========================================================================
   ТАББАР
   Скрывается/показывается через body.tabbar-hidden (см. js/tabbar.js).
   Когда скрыт — полностью убран из потока и недоступен для скринридеров/фокуса.
   ========================================================================== */
.tabbar{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding: 8px 14px calc(var(--safe-bottom) + 8px);
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--tabbar-border);
  transition: transform .2s ease, opacity .2s ease;
}
body.tabbar-hidden .tabbar{
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.tabbar-inner{
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(120,120,128,0.16);
  border-radius: 999px;
  padding: 4px;
}

.tab-btn{
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--tabbar-inactive-fg);
  border-radius: 999px;
  padding: 7px 4px 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}
.tab-btn svg{ width: 22px; height: 22px; }
.tab-btn.is-active{
  background: var(--tabbar-active-bg);
  color: var(--tabbar-active-fg);
}

@media (min-width: 480px){
  .content{ max-width: 480px; margin: 0 auto; width: 100%; }
  .topbar{ max-width: 480px; margin: 0 auto; width: 100%; }
  .tabbar-inner{ max-width: 480px; margin: 0 auto; }
}
