/* ===== WW SHOP — Variant 3 (Modern Navy + Soft Light) ===== */

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }

:root{
  --bg-1:#eef3fb;
  --bg-2:#dde8f7;

  --text:#182536;
  --muted:#607089;

  --header-1:#071a2f;
  --header-2:#0b2440;

  --primary:#1a7dff;
  --primary-2:#0f67ea;

  --card:#ffffff;
  --card-2:#f6f9ff;
  --border:#d7e2f2;

  --shadow: 0 14px 42px rgba(12,24,40,.14);
  --shadow-soft: 0 10px 24px rgba(12,24,40,.10);
  --radius:16px;
}

/* ===== BODY ===== */
body{
  margin:0;
  font-family: Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(900px 420px at 50% 0%, #f9fbff 0%, var(--bg-1) 55%, var(--bg-2) 100%);
}

a{ color:inherit; }

/* ===== CONTAINER ===== */
.container{
  width: min(1200px, 92%);
  margin: 22px auto 42px;
}

/* ===== HEADER ===== */
.site-header{
  background: linear-gradient(180deg, var(--header-1), var(--header-2));
  padding: 16px 20px;
  box-shadow: 0 10px 28px rgba(3,10,20,.30);
}

.site-header__inner{
  max-width:1200px;
  margin:0 auto;
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.site-logo{
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .7px;
  text-transform: uppercase;
  color:#d6e8ff;
  text-decoration:none;
}

.site-nav{
  display:flex;
  align-items:center;
  gap: 12px;
}

.site-nav a{
  color: rgba(255,255,255,.92);
  text-decoration:none;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
  transition: .15s ease;
}

.site-nav a:hover{
  background: rgba(255,255,255,.10);
  color:#fff;
}

/* ===== Cart badge ===== */
.cart-link{
  position: relative;
  display:inline-flex;
  align-items:center;
}

.cart-badge{
  position:absolute;
  top:-6px;
  right:-12px;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  background:#ff3b30;
  color:#fff;
  font-size:11px;
  font-weight:900;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 8px 16px rgba(0,0,0,.18);
}

/* ===== Scroll margin for anchors ===== */
.section-anchor{ scroll-margin-top: 90px; }

/* ===== CONTROLS (Search + Sort) ===== */
.controls{
  max-width: 1200px;
  margin: 12px auto 16px;
  display:flex;
  gap: 12px;
  align-items:center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.controls .search{
  flex: 1 1 520px;
  display:flex;
  gap: 10px;
  align-items:center;
}

.controls .search input{
  width:100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 12px;
  outline:none;
  background:#fff;
  box-shadow: 0 10px 20px rgba(12,24,40,.05);
}

.controls .search input:focus{
  border-color: rgba(26,125,255,.65);
  box-shadow: 0 0 0 4px rgba(26,125,255,.12), 0 10px 20px rgba(12,24,40,.06);
}

.controls .search button{
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #23a0ff, #1678ff);
  color:#fff;
  font-weight: 900;
  cursor:pointer;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(26,125,255,.18);
  transition:.15s ease;
}

.controls .search button:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(26,125,255,.22);
}

.controls .search a.reset{
  height: 42px;
  display:inline-flex;
  align-items:center;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  color:#22334a;
  text-decoration:none;
  font-weight: 900;
}

.controls .sort{
  flex: 0 0 auto;
  display:flex;
  gap: 10px;
  align-items:center;
}

.controls .sort select{
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 10px;
  outline:none;
  background:#fff;
  box-shadow: 0 10px 20px rgba(12,24,40,.05);
}

/* ===== CATEGORY HEADER (big bar + tabs) ===== */
.catalog-head{
  margin: 0 auto 14px;
  max-width: 1200px;
}

.catalog-head.sticky{
  position: sticky;
  top: 70px;
  z-index: 50;
  background: rgba(238, 243, 251, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(215,226,242,.9);
  padding: 10px 0 10px;
}

.catalog-active{
  display:block;
  width:100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color:#fff;
  font-weight: 900;
  letter-spacing:.2px;
  box-shadow: var(--shadow-soft);
}

.catalog-tabs{
  margin-top: 12px;
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
}

.catalog-tab{
  display:inline-flex;
  align-items:center;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255,255,255,.90);
  border: 1px solid var(--border);
  color:#22334a;
  text-decoration:none;
  font-weight: 900;
  transition: .15s ease;
  cursor:pointer;
  user-select:none;
}

.catalog-tab:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(12,24,40,.10);
}

.catalog-tab.is-active{
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  border-color: rgba(26,125,255,.35);
  color:#fff;
}

/* ===== PRODUCTS ZONE ===== */
.products-wrapper{
  max-width: 1000px;
  margin: 0 auto;
}

/* ===== TABLE ===== */
.product-table{
  width:100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 16px;
  overflow:hidden;
  border: 1px solid rgba(215,226,242,.95);
  box-shadow: 0 14px 34px rgba(12,24,40,.08);
}

.product-table thead th{
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color:#fff;
  padding: 14px 16px;
  text-align:left;
  font-weight: 900;
  letter-spacing:.2px;
}

.product-table tbody td{
  padding: 14px 16px;
  border-bottom: 1px solid rgba(223,232,247,.9);
  vertical-align: middle;
}

.product-table tbody tr{
  transition: all .15s ease;
}

.product-table tbody tr:hover{
  background: var(--card-2);
}

.product-table tbody tr:last-child td{ border-bottom:0; }

/* ===== Subcategory rows inside table ===== */
.product-table tbody tr.subhead-row td{
  background: rgba(26,125,255,0.14);
  font-weight: 900;
  color: #1f3f75;
  border-bottom: 1px solid rgba(26,125,255,0.18);
  padding: 12px 16px;
}

/* отступ вверх между подразделами */
.product-table tbody tr.subhead-row{
  border-top: 12px solid transparent;
}

/* без hover эффекта */
.product-table tbody tr.subhead-row:hover{
  background: rgba(26,125,255,0.14);
}

/* Price highlight */
.price{
  font-weight: 900;
  color: var(--primary);
  font-size: 16px;
}

/* ===== Add to cart form ===== */
.add-to-cart-form{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: nowrap;
}

.quantity-input{
  width: 64px;
  height: 36px;
  text-align:center;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline:none;
  background:#fff;
  box-shadow: 0 10px 18px rgba(12,24,40,.05);
}

.quantity-input:focus{
  border-color: rgba(26,125,255,.65);
  box-shadow: 0 0 0 4px rgba(26,125,255,.12), 0 10px 18px rgba(12,24,40,.06);
}

.add-to-cart-form button{
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #23a0ff, #1678ff);
  color:#fff;
  font-weight: 900;
  cursor:pointer;
  white-space: nowrap;
  transition: .15s ease;
}

.add-to-cart-form button:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(26,125,255,.22);
}

.add-to-cart-form button:active{
  transform: translateY(0);
  box-shadow:none;
}

/* ===== FOOTER ===== */
.site-footer,
footer{
  margin-top: 46px;
  background: rgba(255,255,255,.72);
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align:center;
  padding: 18px 20px;
  font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 768px){
  .site-logo{ font-size: 22px; }
  .site-nav a{ margin-left: 10px; }
  .catalog-head.sticky{ top: 64px; }
}

@media (max-width: 520px){
  .products-wrapper{ max-width: 100%; }
  .add-to-cart-form{ gap: 8px; }
  .quantity-input{ width: 58px; }
  .add-to-cart-form button{ padding: 0 12px; }
}

/* ===== Admin login centered ===== */
.admin-login-page{
  min-height: calc(100vh - 120px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.admin-login-box{
  width:100%;
  max-width:420px;
  padding:28px;
  background:#fff;
  border-radius:16px;
  border:1px solid var(--border);
  box-shadow:0 20px 50px rgba(12,24,40,.12);
}

.admin-login-box label{
  display:block;
  margin:12px 0 6px;
  font-weight:700;
}

.admin-login-box input{
  width:100%;
  height:42px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--border);
  outline:none;
}

.admin-login-box input:focus{
  border-color: rgba(26,125,255,.6);
  box-shadow:0 0 0 4px rgba(26,125,255,.12);
}

.admin-hint{
  margin-top:16px;
  font-size:13px;
  color:var(--muted);
  text-align:center;
}

/* ===== 2FA (clean, without duplicates) ===== */
.twofa-form{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-top:10px;
}

.twofa-field{
  display:flex;
  flex-direction:column;
  margin-top:12px;
}

.twofa-field label{
  font-weight:700;
  margin-bottom:6px;
}

.twofa-input,
.twofa-select{
  width:100%;
  height:46px;
  border:1px solid #d7e2f2;
  border-radius:12px;
  padding:0 12px;
  font-size:14px;
  outline:none;
}

.twofa-input:focus,
.twofa-select:focus{
  border-color: rgba(26,125,255,.6);
  box-shadow: 0 0 0 4px rgba(26,125,255,.12);
}

.twofa-row{
  display:flex;
  gap:10px;
  align-items:center;
}

.twofa-select{
  flex:1;
  width:auto;
}

.twofa-actions{
  flex:1;
  display:flex;
  justify-content:center;
  align-items:center;
}

.twofa-btn{
  height:46px;
  padding:0 18px;
  border:0;
  border-radius:12px;
  background: linear-gradient(180deg,#23a0ff,#1678ff);
  color:#fff;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
  width:220px;
  max-width:100%;
}

.twofa-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(26,125,255,.25);
}

@media (max-width: 520px){
  .twofa-row{
    flex-direction:column;
    align-items:stretch;
  }
  .twofa-actions{
    width:100%;
  }
  .twofa-btn{
    width:100%;
  }
}

/* ==========================================================
   FINAL PATCH: "Действие" вправо + subhead слева (без :has)
   ========================================================== */

/* Заголовок последней колонки ("Действие") вправо */
.product-table thead th:last-child{
  text-align: right !important;
  padding-right: 0 !important;
}

/* Последняя колонка контента ближе к краю */
.product-table tbody td:last-child{
  padding-right: 0 !important;
}

/* Форма в последней колонке растягивается и прижимается вправо (фоллбек) */
.product-table tbody td:last-child .add-to-cart-form{
  width: 100% !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 12px !important;
  flex-wrap: nowrap !important;
}

/* Если есть td-actions/actions-right — используем их */
.product-table td.td-actions{
  text-align: right !important;
}
.product-table td.td-actions .actions-right{
  width: 100% !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 12px !important;
}

/* Кнопка не переносится */
.product-table tbody td:last-child button{
  white-space: nowrap !important;
}

/* disabled */
.add-to-cart-form button:disabled,
.add-to-cart-btn:disabled{
  opacity: .55 !important;
  cursor: not-allowed !important;
  transform:none !important;
  box-shadow:none !important;
}

/* Подкатегории (subhead-row + любые colspan) — ВСЕГДА слева */
.product-table tbody tr.subhead-row td,
.product-table tbody tr td[colspan]{
  text-align: left !important;
  padding-left: 18px !important;
}

/* (опционально) "Ничего не найдено" слева */
.product-table tbody tr.no-rows td{
  text-align: left !important;
}