/* ====== Kimia Inventory – Custom Styles ====== */
:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, .06);
  --panel2: rgba(255, 255, 255, .09);
  --border: rgba(255, 255, 255, .10);
  --text: rgba(255, 255, 255, .92);
  --muted: rgba(255, 255, 255, .70);
  --muted2: rgba(255, 255, 255, .55);
  --primary: #6d8bff;
  --primary2: #4c6fff;
  --good: #2bd4a6;
  --bad: #ff5c7a;
  --warn: #ffcc66;
  --radius: 18px;
  --shadow: 0 18px 60px rgba(0, 0, 0, .45);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Vazirmatn, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background-color: #0b1220;
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(109, 139, 255, .35), transparent 55%),
    radial-gradient(900px 600px at 10% 0%, rgba(43, 212, 166, .20), transparent 55%),
    linear-gradient(180deg, #070b14, #0b1220 30%, #0b1220);
  color: rgba(255, 255, 255, .92);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------- Sidebar --------------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-left: 1px solid var(--border);
  backdrop-filter: blur(14px);
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(109, 139, 255, .95), rgba(43, 212, 166, .85));
  box-shadow: 0 12px 30px rgba(109, 139, 255, .18);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-logo:after {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at 35% 25%, rgba(255,255,255,.65), transparent 45%);
  transform: rotate(22deg);
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-title small {
  display: block;
  font-size: 11px;
  color: var(--muted2);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: .15s ease;
}

.sidebar-link:hover {
  background: var(--panel);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(109, 139, 255, .15);
  color: var(--primary);
  font-weight: 600;
  border: 1px solid rgba(109, 139, 255, .20);
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: .8;
}

/* --------------- Layout --------------- */
.main-area {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 48px;
}

.page-header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 20px;
}

.page-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.page-brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.page-brand p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.top-pills {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.pill b {
  color: var(--text);
  font-weight: 600;
}

/* --------------- Cards --------------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .05));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(14px);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

/* --------------- Summary Grid --------------- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin: 12px 0 16px;
}

@media (max-width: 1200px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr; }
}

.summary-card {
  border: 1px solid rgba(255, 255, 255, .12);
  background: linear-gradient(180deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .035));
  border-radius: 16px;
  padding: 14px;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.summary-card .label {
  font-size: 12px;
  color: var(--muted2);
}

.summary-card .value {
  font-size: 18px;
  font-weight: 800;
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.summary-card .unit {
  font-size: 11px;
  color: var(--muted2);
}

.summary-card.gold24 {
  border-color: rgba(255, 204, 102, .22);
  background: linear-gradient(180deg, rgba(255, 204, 102, .10), rgba(255, 255, 255, .035));
}

.summary-card.gold18 {
  border-color: rgba(43, 212, 166, .20);
  background: linear-gradient(180deg, rgba(43, 212, 166, .085), rgba(255, 255, 255, .035));
}

.summary-card.equiv {
  border-color: rgba(109, 139, 255, .25);
  background: linear-gradient(180deg, rgba(109, 139, 255, .11), rgba(255, 255, 255, .035));
}

/* --------------- Upload Zone --------------- */
.upload-zone {
  border: 1px dashed rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .03);
  border-radius: 16px;
  padding: 18px;
  transition: .15s ease;
}

.upload-zone.dragover {
  border-color: rgba(109, 139, 255, .75);
  box-shadow: 0 0 0 4px rgba(109, 139, 255, .18);
  background: rgba(109, 139, 255, .07);
}

.upload-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.file-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.file-meta .name {
  font-weight: 600;
  font-size: 14px;
}

.file-meta .hint {
  font-size: 12px;
  color: var(--muted2);
}

/* --------------- Status Box --------------- */
.status-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .18);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  min-height: 54px;
}

.status-box.good {
  border-color: rgba(43, 212, 166, .35);
}

.status-box.bad {
  border-color: rgba(255, 92, 122, .35);
}

.status-box.warn {
  border-color: rgba(255, 204, 102, .35);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  margin-top: 6px;
  background: rgba(255, 255, 255, .35);
  flex-shrink: 0;
}

.status-box.good .status-dot {
  background: rgba(43, 212, 166, .9);
}

.status-box.bad .status-dot {
  background: rgba(255, 92, 122, .95);
}

.status-box.warn .status-dot {
  background: rgba(255, 204, 102, .95);
}

/* --------------- Table / Group View --------------- */
.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .16);
  width: 100%;
}

.group-table {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 100%;
}

.group-block {
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
  box-shadow: 0 14px 40px rgba(0, 0, 0, .22);
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(109, 139, 255, .16), rgba(43, 212, 166, .10));
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 15px;
}

.group-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .04);
  flex-shrink: 0;
}

.group-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.group-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .10);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.group-grid-head {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr;
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.group-grid-head > div {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 800;
}

.group-row {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.group-row:last-child {
  border-bottom: none;
}

.group-row > div {
  padding: 14px 16px;
  font-size: 13px;
}

.group-row:hover {
  background: rgba(255, 255, 255, .04);
}

.cell-weight, .cell-qty {
  font-variant-numeric: tabular-nums;
}

/* --------------- Pool Table (Estakhr) --------------- */
.pool-wrapper {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(0, 0, 0, .16);
}

.pool-grid-head {
  display: grid;
  grid-template-columns: 0.7fr 0.9fr repeat(4, 0.7fr) 0.8fr 0.8fr;
  background: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px 16px 0 0;
}

.pool-grid-head > div {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 800;
  color: #0b1220;
}

.pool-header-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
}

.pool-row {
  display: grid;
  grid-template-columns: 0.7fr 0.9fr repeat(4, 0.7fr) 0.8fr 0.8fr;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.pool-row:last-child {
  border-bottom: none;
}

.pool-row > div {
  padding: 14px 14px;
  font-size: 13px;
}

.pool-row:hover {
  background: rgba(255, 255, 255, .04);
}

.design-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

/* --------------- Toolbar --------------- */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.search-area {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: flex-start;
}

/* --------------- Buttons --------------- */
.btn {
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn:hover {
  background: rgba(255, 255, 255, .09);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0px);
}

.btn-primary {
  border-color: rgba(76, 111, 255, .55);
  background: linear-gradient(135deg, rgba(76, 111, 255, .95), rgba(109, 139, 255, .75));
  box-shadow: 0 16px 40px rgba(76, 111, 255, .18);
}

.btn-danger {
  border-color: rgba(255, 92, 122, .45);
  background: rgba(255, 92, 122, .12);
  color: var(--bad);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
}

/* --------------- Input --------------- */
.input {
  flex: 1;
  min-width: 220px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  outline: none;
  font-size: 13px;
  font-family: inherit;
}

.input::placeholder {
  color: rgba(255, 255, 255, .45);
}

/* --------------- Badge --------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
  font-size: 12px;
  white-space: nowrap;
}

/* --------------- Empty state --------------- */
.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted2);
  font-size: 14px;
}

/* --------------- Info grid --------------- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.info-item {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
}

.info-item .k {
  font-size: 12px;
  color: var(--muted2);
}

.info-item .v {
  margin-top: 4px;
  font-weight: 700;
  font-size: 13px;
  direction: ltr;
  text-align: left;
  word-break: break-all;
}

/* --------------- Responsive grid --------------- */
.grid-2col {
  display: grid;
  grid-template-columns: 1.6fr .4fr;
  gap: 20px;
}

@media (max-width: 980px) {
  .grid-2col { grid-template-columns: 1fr; }
}

/* --------------- Footer --------------- */
.footer-text {
  margin-top: 14px;
  color: rgba(255, 255, 255, .50);
  font-size: 12px;
  text-align: center;
}

/* --------------- Spacing helpers --------------- */
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
