@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --brand-900: #5a250f;
  --brand-800: #7b3417;
  --brand-700: #a2471f;
  --brand-600: #ca5f24;
  --brand-500: #e47a34;
  --brand-400: #ef9c63;
  --brand-300: #f6c39f;
  --brand-200: #fde7d2;
  --brand-100: #fff5ec;
  --accent-900: #0b3c5d;
  --accent-700: #16527b;
  --accent-500: #2e6f98;
  --ink-950: #111827;
  --ink-900: #1f2937;
  --ink-700: #445168;
  --ink-600: #5f6b82;
  --ink-500: #77839a;
  --line-strong: #d4dde9;
  --line: #e5ebf4;
  --line-soft: #edf2f8;
  --surface: #ffffff;
  --surface-soft: #f4f7fc;
  --surface-muted: #eef3fa;
  --success: #1f8d65;
  --danger: #c73344;
  --warning: #b66a00;
  --sidebar-width: 292px;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-soft: 0 16px 34px rgba(22, 34, 54, 0.09);
  --shadow-strong: 0 22px 50px rgba(17, 25, 40, 0.16);
}

* {
  box-sizing: border-box;
}

body.admin-body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', sans-serif;
  color: var(--ink-900);
  background:
    radial-gradient(circle at 8% 6%, #fff8f0 0%, transparent 34%),
    radial-gradient(circle at 96% 8%, #dfefff 0%, transparent 30%),
    linear-gradient(180deg, #f7faff 0%, #edf3fb 100%);
}

body.admin-body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(140, 160, 190, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(140, 160, 190, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 70%);
  z-index: -1;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  background:
    linear-gradient(198deg, rgba(10, 36, 58, 0.95) 0%, rgba(26, 64, 94, 0.92) 34%, rgba(84, 42, 20, 0.94) 100%);
  color: #fff;
  box-shadow: var(--shadow-strong);
  z-index: 1040;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 7px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 20px;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.24);
  text-decoration: none;
  color: #fff;
}

.sidebar-brand-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.03rem;
  letter-spacing: 0.4px;
  font-weight: 700;
}

.sidebar-brand-subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.2px;
}

.sidebar-section-title {
  margin: 10px 12px 2px;
  font-family: 'Sora', sans-serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}

.sidebar .nav {
  gap: 6px;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.94rem;
  transition: all 0.22s ease;
}

.sidebar .nav-link span:first-child {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.93rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: translateX(2px);
}

.sidebar .nav-link.active {
  background: #fff;
  color: var(--accent-900);
  box-shadow: 0 8px 16px rgba(8, 20, 36, 0.26);
}

.sidebar .nav-link.active span:first-child {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  padding: 12px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.79);
  line-height: 1.45;
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 30px 30px 42px;
}

.page-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 95% 0, rgba(228, 122, 52, 0.16) 0, transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(252, 254, 255, 0.96));
  box-shadow: var(--shadow-soft);
}

.page-header::after {
  content: '';
  position: absolute;
  left: 20px;
  bottom: -1px;
  width: 82px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--brand-700), var(--accent-500));
}

.page-title {
  margin: 0;
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.28rem, 1.9vw, 1.82rem);
  letter-spacing: 0.2px;
  font-weight: 700;
  color: var(--ink-950);
}

.page-subtitle {
  margin: 5px 0 0;
  color: var(--ink-600);
  font-size: 0.95rem;
  font-weight: 600;
  max-width: 760px;
}

.page-actions,
.table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 74px;
  height: 74px;
  background: radial-gradient(circle, rgba(228, 122, 52, 0.24), transparent 70%);
}

.metric-label {
  margin: 0;
  font-family: 'Sora', sans-serif;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 1.05px;
  color: var(--ink-600);
}

.metric-value {
  margin: 8px 0 0;
  font-family: 'Sora', sans-serif;
  font-size: 1.74rem;
  font-weight: 700;
  color: var(--ink-950);
}

.metric-hint {
  margin: 4px 0 0;
  color: var(--ink-600);
  font-size: 0.83rem;
  font-weight: 600;
}

.content-card,
.table-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.content-card + .content-card,
.table-card + .table-card {
  margin-top: 16px;
}

.form-shell {
  width: min(100%, 980px);
  margin-inline: auto;
}

.form-shell-md {
  width: min(100%, 860px);
}

.form-shell-sm {
  width: min(100%, 760px);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 330px) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.search-row.search-row-two {
  grid-template-columns: minmax(280px, 1fr) auto;
}

.search-row > .form-control,
.search-row > .form-select {
  background: #fff;
}

.section-title {
  margin: 0 0 12px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-950);
}

.form-label {
  margin-bottom: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.18px;
  color: var(--ink-700);
}

.form-control,
.form-select {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fbfdff;
  color: var(--ink-900);
  font-size: 0.94rem;
  transition: all 0.18s ease;
}

.form-control::placeholder {
  color: #8b98ad;
}

.form-control:focus,
.form-select:focus {
  border-color: #d38a54;
  background: #fff;
  box-shadow: 0 0 0 0.22rem rgba(202, 95, 36, 0.14);
}

.form-text,
.text-muted {
  color: var(--ink-600) !important;
}

.form-check-input {
  border-color: #bfcbdb;
}

.form-check-input:checked {
  background-color: var(--accent-700);
  border-color: var(--accent-700);
}

.btn {
  border-radius: 10px;
  min-height: 40px;
  padding-inline: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.22rem rgba(30, 111, 152, 0.24);
}

.btn-sm {
  min-height: 34px;
  padding-inline: 11px;
  font-size: 0.82rem;
}

.btn-icon-action {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-action svg {
  width: 14px;
  height: 14px;
}

.btn-brand {
  border: 1px solid transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  box-shadow: 0 8px 14px rgba(162, 71, 31, 0.23);
}

.btn-brand:hover,
.btn-brand:focus {
  color: #fff;
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--brand-800), var(--brand-600));
}

.btn-soft {
  border: 1px solid #e0c0aa;
  color: var(--brand-800);
  background: var(--brand-100);
}

.btn-soft:hover,
.btn-soft:focus {
  color: var(--brand-900);
  border-color: #d9aa86;
  background: #ffe9d8;
}

.btn-outline-accent {
  border-color: #9cbad4;
  color: var(--accent-700);
}

.btn-outline-accent:hover,
.btn-outline-accent:focus {
  border-color: var(--accent-700);
  background: var(--accent-700);
  color: #fff;
}

.btn-outline-secondary {
  border-color: #b8c7da;
  color: #4b5b74;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  border-color: #5f748f;
  background: #5f748f;
  color: #fff;
}

.btn-outline-danger {
  border-color: #e5a2ae;
  color: #af3344;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn-secondary {
  border-color: #98a8c0;
  background: #60728d;
}

.btn-secondary:hover,
.btn-secondary:focus {
  border-color: #495f7d;
  background: #495f7d;
}

.badge.text-bg-light,
.table-summary-badge {
  border-radius: 999px;
  border: 1px solid #d3deec !important;
  background: #f5f9ff !important;
  color: var(--ink-700) !important;
  font-weight: 700;
  padding: 0.5rem 0.72rem;
}

.alert {
  border-radius: 12px;
  border-width: 1px;
}

.alert-danger {
  border-color: #f0bdc4;
  background: #fff2f4;
  color: #9d2434;
}

.alert-success {
  border-color: #b9e6d2;
  background: #effcf6;
  color: #176d4f;
}

.table-responsive {
  overflow: auto;
}

.table-admin,
.table-products {
  width: 100%;
  margin-bottom: 0;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.table-admin thead th,
.table-products thead th {
  border: none;
  padding: 12px 12px;
  background: linear-gradient(135deg, var(--accent-700), #3d769e);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.table-admin thead th:first-child,
.table-products thead th:first-child {
  border-top-left-radius: 11px;
}

.table-admin thead th:last-child,
.table-products thead th:last-child {
  border-top-right-radius: 11px;
}

.table-admin tbody td,
.table-products tbody td {
  padding: 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-900);
}

.table-admin tbody tr:nth-child(even),
.table-products tbody tr:nth-child(even) {
  background: #fbfdff;
}

.table-admin tbody tr:hover,
.table-products tbody tr:hover {
  background: #f0f7ff;
}

.table-admin a,
.table-products a {
  color: var(--accent-700);
  font-weight: 700;
  text-decoration: none;
}

.table-admin a:hover,
.table-products a:hover {
  text-decoration: underline;
}

@media (min-width: 992px) {
  .table-admin thead th,
  .table-products thead th {
    position: sticky;
    top: 0;
    z-index: 2;
  }
}

.pagination {
  flex-wrap: wrap;
  gap: 0.36rem;
  margin: 14px 0 0;
}

.pagination .page-link {
  min-width: 38px;
  border-radius: 9px;
  border-color: #d2deec;
  color: var(--ink-700);
  font-weight: 700;
  text-align: center;
}

.pagination .page-item.active .page-link {
  border-color: var(--brand-600);
  background: var(--brand-600);
  color: #fff;
}

.pagination .page-link:hover {
  border-color: #d3a17d;
  background: #fff1e6;
  color: var(--brand-800);
}

.packs-col {
  white-space: normal;
}

.packs-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.packs-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
  line-height: 1.2;
}

.packs-list .size,
.packs-list .price {
  color: var(--ink-900);
}

.file-row,
.pack-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
}

.file-row input[type='file'],
.pack-row input {
  flex: 1;
}

.table-bulk-import {
  min-width: max-content;
}

.table-bulk-import thead th,
.table-bulk-import tbody td {
  white-space: nowrap;
  vertical-align: middle;
}

.table-bulk-import .bulk-header-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.table-bulk-import .bulk-clear-column-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1;
  color: var(--brand-900);
  background: #fce8d8;
  cursor: pointer;
}

.table-bulk-import .bulk-clear-column-btn:hover,
.table-bulk-import .bulk-clear-column-btn:focus {
  border-color: #fff;
  background: #f8d6bd;
  outline: none;
}

.table-bulk-import .bulk-cell {
  min-width: 156px;
  background: #fff;
}

.table-bulk-import .bulk-row-number {
  min-width: 58px;
  text-align: center;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  color: var(--ink-700);
  background: #f7fafc;
}

.table-bulk-import .bulk-cell.bulk-cell-error {
  border-color: #d53f4a !important;
  background: #fff2f4;
  box-shadow: 0 0 0 0.14rem rgba(213, 63, 74, 0.17);
}

.table-bulk-import .bulk-row-number.bulk-row-number-error {
  background: #ffd9de;
  color: #9f1f2f;
}

.mobile-sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--brand-700), var(--accent-700));
  box-shadow: var(--shadow-soft);
  z-index: 1070;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 26, 42, 0.56);
  backdrop-filter: blur(2px);
  z-index: 1035;
}

body.sidebar-lock {
  overflow: hidden;
}

.auth-page {
  min-height: 100vh;
  margin: 0;
  font-family: 'Manrope', sans-serif;
  background:
    radial-gradient(circle at 8% 10%, #ffe8d4 0%, transparent 32%),
    radial-gradient(circle at 86% 12%, #d9ecff 0%, transparent 30%),
    linear-gradient(180deg, #f7faff 0%, #eaf1fb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  border-radius: 22px;
  border: 1px solid #dce6f4;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  padding: 24px;
}

.auth-card-wide {
  width: min(560px, 100%);
}

.auth-title {
  margin: 0 0 3px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  color: var(--ink-950);
}

.auth-subtitle {
  margin: 0 0 18px;
  color: var(--ink-600);
  font-size: 0.93rem;
  font-weight: 600;
}

.auth-link {
  color: var(--accent-700);
  text-decoration: none;
  font-weight: 700;
}

.auth-link:hover {
  color: var(--accent-900);
  text-decoration: underline;
}

.result-panel {
  padding: 14px;
}

.page-header,
.metric-card,
.content-card,
.table-card,
.auth-card {
  animation: panel-enter 0.34s ease both;
}

.metric-card:nth-child(2) {
  animation-delay: 0.05s;
}

.metric-card:nth-child(3) {
  animation-delay: 0.1s;
}

.metric-card:nth-child(4) {
  animation-delay: 0.15s;
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-header,
  .metric-card,
  .content-card,
  .table-card,
  .auth-card {
    animation: none;
  }

  .btn,
  .sidebar .nav-link,
  .form-control,
  .form-select {
    transition: none;
  }
}

@media (max-width: 1240px) {
  .main-content {
    padding: 24px 22px 34px;
  }
}

@media (max-width: 1199.98px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-row {
    grid-template-columns: 1fr 1fr auto;
  }
}

@media (max-width: 991.98px) {
  .mobile-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    width: min(310px, 88vw);
    transform: translateX(-104%);
    transition: transform 0.24s ease;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.backdrop-open {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 74px 14px 26px;
  }

  .search-row,
  .search-row.search-row-two {
    grid-template-columns: 1fr;
  }

  .page-header {
    padding: 16px;
  }
}

@media (max-width: 767.98px) {
  .content-card,
  .table-card {
    padding: 14px;
    border-radius: 13px;
  }

  .file-row,
  .pack-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn,
  .btn-sm {
    width: 100%;
  }

  .page-actions .btn,
  .table-toolbar .btn {
    width: auto;
  }

  .table-products .btn-icon-action,
  .table-admin .btn-icon-action {
    width: 34px;
  }
}

@media (max-width: 575.98px) {
  .table-admin:not(.table-bulk-import) thead,
  .table-products thead {
    position: absolute;
    left: -9999px;
    top: -9999px;
  }

  .table-admin:not(.table-bulk-import),
  .table-products,
  .table-admin:not(.table-bulk-import) tbody,
  .table-products tbody,
  .table-admin:not(.table-bulk-import) tr,
  .table-products tr,
  .table-admin:not(.table-bulk-import) td,
  .table-products td {
    display: block;
    width: 100%;
  }

  .table-admin:not(.table-bulk-import) tr,
  .table-products tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 11px;
    padding: 8px 10px;
    background: #fff;
  }

  .table-admin:not(.table-bulk-import) td,
  .table-products td {
    border: none !important;
    padding: 8px 6px;
    white-space: normal;
  }

  .table-admin:not(.table-bulk-import) td::before,
  .table-products td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 120px;
    margin-right: 8px;
    color: var(--ink-600);
    font-weight: 700;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 1.14rem;
  }
}
