@font-face {
  font-family: "Vazirmatn";
  src: url("./Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("./Vazirmatn-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;

  --line: #e5e9ef;
  --line-input: #dfe4eb;
  --line-soft: #edf0f3;

  --text: #151a21;
  --muted: #7b8491;

  --accent: #008cff;
  --accent-dark: #0075d1;

  --shadow: 0 6px 25px rgba(20, 35, 55, 0.045);
  --shadow-hover: 0 5px 18px rgba(20, 35, 55, 0.06);

  --radius: 12px;
  --transition: 0.18s ease;
}

/* =========================
   DARK MODE
========================= */

html.dark-mode {
  --bg: #12161c;
  --panel: #1a2028;
  --panel-soft: #202731;

  --line: #303946;
  --line-input: #394452;
  --line-soft: #29323d;

  --text: #f3f6fa;
  --muted: #9aa6b5;

  --shadow: 0 6px 25px rgba(0, 0, 0, 0.22);
  --shadow-hover: 0 5px 18px rgba(0, 0, 0, 0.3);
}

/* =========================
   RESET
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;

  background: var(--bg);
  color: var(--text);

  font-family: "Vazirmatn", system-ui, sans-serif;
  font-weight: 400;

  transition:
    background-color var(--transition),
    color var(--transition);
}

a,
a:visited,
a:hover,
a:active,
a:focus {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

/* =========================
   APP / HEADER
========================= */

.app {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 18px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;

  margin-bottom: 12px;
}

.brand {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.7px;
}

.brand span {
  color: var(--accent);
  font-size: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row-reverse;
}

.badge {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 11px;

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;

  transition:
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition);
}

/* =========================
   THEME TOGGLE
========================= */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1/1;
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition);
}


h1 {
  margin: 0 0 10px;

  font-size: clamp(25px, 5vw, 40px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -1.4px;
}

.intro {
  max-width: 700px;
  margin: 0 0 12px;

  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

/* =========================
   MAIN LAYOUT
========================= */

.grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1.25fr)
    minmax(0, 0.75fr);

  align-items: stretch;
  gap: 18px;

  width: 100%;
}

.panel {
  display: flex;
  flex-direction: column;

  width: 100%;
  min-width: 0;
  padding: 12px;

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;

  box-shadow: var(--shadow);

  transition:
    background-color var(--transition),
    border-color var(--transition);
}

aside.panel {
  align-items: stretch;
  justify-content: space-between;
}

/* =========================
   SECTIONS
========================= */

.section {
  width: 100%;
  margin-bottom: 16px;
}

.section:last-child {
  margin-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  margin-bottom: 8px;
}

.section-title h2 {
  margin: 0;

  font-size: 14px;
  font-weight: 900;
}

/* =========================
   INPUTS
========================= */

select,
input {
  display: block;

  width: 100%;
  min-width: 0;
  padding: 12px 13px;

  color: var(--text);
  font-family: inherit;
  font-weight: 400;

  background: var(--panel);
  border: 1px solid var(--line-input);
  border-radius: 10px;
  outline: none;

  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background-color var(--transition),
    color var(--transition);
}

select:hover,
input:hover {
  border-color: #cbd3dd;
}

html.dark-mode select:hover,
html.dark-mode input:hover {
  border-color: #4b5969;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 140, 255, 0.08);
}

/* =========================
   SEARCH
========================= */

.search-select {
  position: relative;

  width: 100%;
  min-width: 0;
}

.search-input {
  padding-left: 45px;
  cursor: text;
}

.search-input::placeholder {
  color: #9aa3ae;
}

.clear-search {
  position: absolute;
  top: 50%;
  left: 10px;
  z-index: 5;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 28px;
  height: 28px;
  padding: 0;

  color: #8b949e;
  font-family: inherit;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;

  background: transparent;
  border: 0;
  border-radius: 50%;

  cursor: pointer;

  transform: translateY(-50%);

  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.clear-search:hover {
  background: #f1f4f7;
  color: var(--text);
}

html.dark-mode .clear-search:hover {
  background: #29323d;
}

.search-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 50;

  display: none;

  width: 100%;
  max-height: 280px;

  overflow-x: hidden;
  overflow-y: auto;

  direction: rtl;

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;

  box-shadow: 0 15px 40px rgba(25, 40, 60, 0.12);
}

html.dark-mode .search-options {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
}

.search-options.open {
  display: block;
}

.search-option {
  width: 100%;
  padding: 11px 13px;

  direction: ltr;
  text-align: left;

  color: var(--text);
  font-size: 13px;
  font-weight: 400;

  border-bottom: 1px solid #f0f2f5;

  cursor: pointer;

  transition: background-color 0.15s ease;
}

html.dark-mode .search-option {
  border-bottom-color: var(--line-soft);
}

.search-option:last-child {
  border-bottom: 0;
}

.search-option:hover,
.search-option.selected {
  background: #f3f8fd;
}

html.dark-mode .search-option:hover,
html.dark-mode .search-option.selected {
  background: #202b37;
}

.search-option.selected {
  color: var(--accent);
  font-weight: 900;
}

.no-result {
  padding: 13px;

  color: var(--muted);
  font-size: 12px;
}

/* =========================
   RESULT
========================= */

.result {
  position: sticky;
  top: 16px;

  width: 100%;
  min-width: 0;
}

.power {
  margin: 18px 0 4px;

  color: var(--accent);

  direction: ltr;
  text-align: center;

  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -3px;
}

.unit {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.recommend {
  margin: 24px 0 4px;

  font-size: 32px;
  font-weight: 900;
  text-align: center;
}

.sub {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 16px 0;

  font-size: 13px;

  border-bottom: 1px solid var(--line-soft);
}

.stat:last-child {
  border-bottom: 0;
}

.stat span:first-child {
  min-width: 0;
}

.stat span:last-child {
  flex-shrink: 0;

  direction: ltr;
  font-weight: 900;
}

/* =========================
   NOTICE / RESET
========================= */

.notice {
  width: 100%;
  margin-top: 15px;
  padding: 12px 13px;

  color: var(--muted);
  font-size: 11px;
  line-height: 1.9;

  background: #f7f9fb;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

html.dark-mode .notice {
  background: var(--panel-soft);
}

.notice strong {
  color: var(--text);
  font-weight: 900;
}

.reset {
  display: block;

  width: 100%;
  margin-top: 15px;
  padding: 11px;

  color: var(--text);
  font-size: 13px;
  font-weight: 400;

  background: var(--panel);
  border: 1px solid var(--line-input);
  border-radius: 10px;

  cursor: pointer;

  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.reset:hover {
  color: var(--accent);
  background: #f5f9fd;
  border-color: var(--accent);
}

html.dark-mode .reset:hover {
  background: #202b37;
}

/* =========================
   PRODUCTS
========================= */

.products {
  display: none;

  width: 100%;
  margin-top: 16px;
}

.products.visible {
  display: block;
}

.products-title {
  margin: 0 0 10px;

  font-size: 16px;
  font-weight: 900;
}

.products-subtitle {
  margin-bottom: 12px;

  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.7;
}

.product-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;

  width: 100%;
}

.product-row {
  display: flex;
  align-items: stretch;
  gap: 10px;

  width: 100%;
}

.product {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);

  align-items: center;
  flex: 1;

  gap: 11px;

  width: 100%;
  min-width: 0;
  padding: 10px;

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background-color var(--transition);
}

.product:hover {
  border-color: #cfd8e2;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

html.dark-mode .product:hover {
  border-color: #4b5969;
}

.product-info {
  min-width: 0;
}

.product-name {
  margin-bottom: 3px;

  font-size: 11px;
  font-weight: 900;
  line-height: 1.5;

  overflow-wrap: anywhere;
}

.product-watt {
  margin-bottom: 5px;

  color: var(--muted);
  font-size: 9px;
}

.product-bottom {
  display: flex;
  flex-direction: column;
  align-items: end;
  justify-content: space-between;
  gap: 8px;

  min-width: 0;
}

.product-price {
  min-width: 0;

  direction: rtl;

  font-size: 11px;
  font-weight: 900;
}

.buy {
  flex-shrink: 0;
  padding: 6px 10px;

  color: #fff;
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;

  background: var(--accent);
  border-radius: 8px;

  transition: background-color 0.18s ease;
}

.buy:hover,
.buy:active,
.buy:focus,
.buy:focus-visible {
  color: #fff;
  background: var(--accent-dark);
}

/* =========================
   PRODUCT IMAGE
========================= */

.product-image {
  display: flex;
  align-items: center;
  justify-content: center;

  flex-shrink: 0;

  width: 58px;
  height: 58px;

  background: #f6f8fb;
  border: 0;
  border-radius: 9px;

  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;

  direction: ltr;
  text-align: center;

  object-fit: contain;

  transition: background-color var(--transition);
}

html.dark-mode .product-image {
  background: var(--panel-soft);
}

/* =========================
   PRODUCT BADGES
========================= */

.product-badge {
  display: flex;
  align-items: center;
  justify-content: center;

  flex: 0 0 32px;
  min-height: 80px;

  overflow: hidden;

  border-radius: 10px;

  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.product-badge span {
  display: block;

  white-space: nowrap;

  transform: rotate(-90deg);
}

.product-badge.badge-minimum {
  color: #c96a00;
  background: #fff0dc;
}

.product-badge.badge-good {
  color: #a68100;
  background: #fff8cf;
}

.product-badge.badge-excellent {
  color: #21833f;
  background: #ddf5e4;
}

/* =========================
   FOOTER
========================= */

.footer {
  display: flex;
  width: 100%;
  margin-top: 20px;
  justify-content: space-between;

  color: #929ba7;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.8;
}

/* =========================
   TABLET
========================= */

@media (max-width: 800px) {
  .app {
    max-width: none;
    padding: 18px 14px;
  }

  .grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .grid > main,
  .grid > aside {
    display: flex;

    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;

    flex: 0 0 auto;
  }

  .grid > main.panel {
    order: 1;
  }

  .grid > aside.panel {
    order: 2;
  }

  .result {
    position: relative;
    top: auto;
  }

  .power {
    font-size: 50px;
  }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 500px) {
  .app {
    padding: 14px;
  }

  .top {
    align-items: flex-start;
    gap: 0;
  }

  .top-actions {
    gap: 6px;
  }

  .panel {
    padding: 14px;
    border-radius: 14px;
  }

  h1 {
    font-size: 22px;
  }

  .power {
    margin-top: 14px;
    font-size: 46px;
  }

  .recommend {
    margin-top: 20px;
    font-size: 27px;
  }

  .stat {
    padding: 13px 0;
  }

  .product {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
  }

  .product-image {
    width: 52px;
    height: 52px;
    font-size: 16px;
  }

  .badge {
    font-size: 10px;
  }

  .brand {
    font-size: 16px;
  }

  .brand span {
    font-size: 12px;
  }
}

/* =========================
   DARK MODE PRODUCT BADGES
========================= */

html.dark-mode .product-badge.badge-minimum {
  color: #f2a24a;
  background: #332719;
}

html.dark-mode .product-badge.badge-good {
  color: #e0bf4f;
  background: #332f19;
}

html.dark-mode .product-badge.badge-excellent {
  color: #62c78a;
  background: #193327;
}

.reset-all {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    padding: 0;

    aspect-ratio: 1 / 1;

    border: 0;
    cursor: pointer;

    font: inherit;
    line-height: 1;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;
}

.reset-all.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.reset-all {
    display: none;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;
    aspect-ratio: 1 / 1;

    padding: 0;
    border: 0;

    cursor: pointer;

    font: inherit;
    line-height: 1;
}

.reset-all.visible {
    display: inline-flex;
}

.reset-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;
    aspect-ratio: 1 / 1;

    padding: 0;
    border: 0;

    cursor: pointer;

    font: inherit;
    line-height: 1;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.reset-all.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.search-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.part-dot {
  flex: 0 0 7px;

  width: 7px;
  height: 7px;

  border-radius: 50%;
}

.part-dot.amd {
  background: #e85d5d;
}

.part-dot.intel {
  background: #4d9de0;
}

.part-dot.nvidia {
  background: #5fba72;
}

