/* eufyMake E1 Ink Weight Calculator – standalone styles */
:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #e5e5e5;
  --popover: #ffffff;
  --popover-foreground: #0a0a0a;
  --eufy: #3bd467;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --radius: 0.5rem;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.dark {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #0a0a0a;
  --muted: #262626;
  --muted-foreground: #a3a3a3;
  --border: #262626;
  --popover: #0a0a0a;
  --popover-foreground: #fafafa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Ambient gradient */
.ambient { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob { position: absolute; border-radius: 9999px; filter: blur(80px); }
.blob-top { top: -10rem; left: 50%; transform: translateX(-50%); width: 24rem; height: 24rem; background: rgba(59, 212, 103, 0.10); }
.blob-right { top: 33%; right: -5rem; width: 20rem; height: 20rem; background: rgba(59, 212, 103, 0.05); }

.container {
  position: relative;
  z-index: 1;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
@media (min-width: 640px) { .container { padding: 3rem 1.25rem; } }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.header { display: flex; margin-bottom: 1.5rem; }
@media (min-width: 640px) { .header { margin-bottom: 2rem; } }
.brand { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
@media (min-width: 640px) { .brand { gap: 0.75rem; } }
.logo {
  display: flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 1rem;
  background: linear-gradient(to bottom right, var(--eufy), var(--emerald-600));
  color: #fff; box-shadow: 0 10px 15px -3px rgba(59, 212, 103, 0.3);
  flex-shrink: 0;
}
@media (min-width: 640px) { .logo { width: 2.75rem; height: 2.75rem; } .logo svg { width: 30px; height: 30px; } }
.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 1.375rem; font-weight: 600; line-height: 1.25; white-space: pre-line; }
@media (min-width: 640px) { .brand-text h1 { font-size: 1.75rem; } }
.subtitle { margin: 0; font-size: 0.75rem; color: var(--muted-foreground); }
@media (min-width: 640px) { .subtitle { font-size: 0.875rem; } }

.controls { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 9999px;
  border: 1px solid var(--border); background: rgba(245,245,245,0.6);
  color: var(--foreground); cursor: pointer; transition: background 0.15s;
}
.dark .icon-btn { background: rgba(38,38,38,0.6); }
.icon-btn:hover { background: var(--muted); }
.icon-btn svg { width: 16px; height: 16px; }

.lang-wrap { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 0.375rem;
  border-radius: 9999px; border: 1px solid var(--border);
  background: rgba(245,245,245,0.6); color: var(--foreground);
  padding: 0.375rem 0.5rem; font-size: 0.75rem; font-weight: 500; cursor: pointer;
  font-family: var(--font); transition: background 0.15s;
}
.dark .lang-btn { background: rgba(38,38,38,0.6); }
.lang-btn:hover { background: var(--muted); }
.lang-btn .globe { width: 14px; height: 14px; color: var(--eufy); }
.lang-btn .chev { width: 14px; height: 14px; color: var(--muted-foreground); transition: transform 0.15s; }
.lang-btn.open .chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 0.375rem);
  width: 11rem; border: 1px solid var(--border); background: var(--popover);
  color: var(--popover-foreground); border-radius: 0.75rem; padding: 0.25rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); z-index: 30;
}
.lang-item {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  padding: 0.5rem 0.625rem; border: none; background: transparent;
  color: inherit; font-size: 0.875rem; text-align: left; cursor: pointer;
  border-radius: 0.5rem; font-family: var(--font);
}
.lang-item:hover { background: var(--muted); }
.lang-item.active { background: rgba(59, 212, 103, 0.15); }
.lang-item .check { width: 14px; height: 14px; color: var(--eufy); margin-left: auto; }

/* Card */
.card {
  border: 1px solid var(--border); background: var(--card);
  border-radius: 1.5rem; padding: 1.25rem; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  display: flex; flex-direction: column; gap: 1.25rem;
}
@media (min-width: 640px) { .card { padding: 1.75rem; } }

.field { display: flex; flex-direction: column; }
.label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; }

/* Cartridge grid */
.cart-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.5rem; }
@media (min-width: 640px) { .cart-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.cart-btn {
  display: flex; align-items: center; gap: 0.5rem; text-align: left;
  border: 1px solid var(--border); background: rgba(245,245,245,0.5); color: var(--foreground);
  border-radius: 0.75rem; padding: 0.625rem 0.75rem; cursor: pointer; transition: all 0.15s;
  font-family: var(--font);
}
.dark .cart-btn { background: rgba(38,38,38,0.5); }
.cart-btn:hover { background: var(--muted); }
.cart-btn.active { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.cart-dot { width: 0.75rem; height: 0.75rem; border-radius: 9999px; flex-shrink: 0; }
.cart-label { display: block; font-weight: 500; font-size: 0.875rem; }
.cart-meta { display: block; font-size: 0.75rem; color: var(--muted-foreground); }
.cart-weight { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }

/* Input */
.input {
  width: 100%; border: 1px solid var(--border); background: var(--background);
  color: var(--foreground); border-radius: 0.75rem; padding: 0.75rem 1rem;
  font-size: 1.125rem; font-family: var(--font); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--muted-foreground); opacity: 0.7; }
.input:focus { border-color: rgba(59, 212, 103, 0.5); box-shadow: 0 0 0 2px rgba(59, 212, 103, 0.2); }

/* Actions */
.actions { display: flex; gap: 0.75rem; }
.btn {
  border: none; cursor: pointer; font-family: var(--font); font-weight: 600;
  border-radius: 0.75rem; padding: 0.75rem 1rem; font-size: 0.875rem; transition: all 0.15s;
}
.btn-primary {
  flex: 1; color: #fff; background: linear-gradient(to right, var(--eufy), var(--emerald-600));
  box-shadow: 0 10px 15px -3px rgba(59, 212, 103, 0.3); display: flex; align-items: center; justify-content: center;
}
.btn-primary:hover { background: linear-gradient(to right, var(--eufy), var(--emerald-500)); }
.btn-ghost {
  display: flex; align-items: center; gap: 0.375rem; border: 1px solid var(--border);
  background: rgba(245,245,245,0.5); color: var(--foreground);
}
.dark .btn-ghost { background: rgba(38,38,38,0.5); }
.btn-ghost:hover { background: var(--muted); }

/* Result */
.result-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); margin-bottom: 0.5rem; }
.result-empty {
  border: 1px solid var(--border); background: rgba(245,245,245,0.4);
  border-radius: 1rem; padding: 2rem; text-align: center; color: var(--muted-foreground);
}
.dark .result-empty { background: rgba(38,38,38,0.4); }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.75rem; }
.result-cell { border: 1px solid var(--border); background: rgba(245,245,245,0.4); border-radius: 1rem; padding: 1rem; text-align: center; }
.dark .result-cell { background: rgba(38,38,38,0.4); }
.result-cell-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.result-cell-value { margin-top: 0.25rem; font-size: 1.875rem; font-weight: 600; line-height: 1; }
.result-unit { margin-left: 0.25rem; font-size: 1rem; font-weight: 400; color: var(--muted-foreground); }
.progress { height: 0.75rem; width: 100%; border-radius: 9999px; background: var(--muted); overflow: hidden; margin-top: 0.25rem; }
.progress-bar { height: 100%; border-radius: 9999px; background: var(--eufy); transition: width 0.5s; }
.formula-box { margin-top: 0.5rem; border: 1px solid var(--border); background: rgba(245,245,245,0.3); border-radius: 1rem; padding: 1rem; }
.dark .formula-box { background: rgba(38,38,38,0.3); }
.formula-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.formula-text { margin-top: 0.375rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; word-break: break-word; }
@media (min-width: 640px) { .formula-text { font-size: 1rem; } }

/* Note */
.note {
  margin-top: 1.25rem; display: flex; align-items: flex-start; gap: 0.5rem;
  border: 1px solid rgba(59, 212, 103, 0.2); background: rgba(59, 212, 103, 0.05);
  border-radius: 1rem; padding: 1rem;
}
.note[hidden] { display: none; }
.note-icon { color: var(--eufy); flex-shrink: 0; margin-top: 0.125rem; }
.note-text { margin: 0; font-size: 0.75rem; line-height: 1.6; color: var(--foreground); opacity: 0.8; }

/* Counter */
.counter { margin-top: 1rem; text-align: center; font-size: 0.75rem; color: var(--muted-foreground); }
.counter-value { font-weight: 500; color: var(--foreground); }

/* Back link + tool footer */
.back-link {
  display: inline-block; font-size: 0.8125rem;
  color: var(--muted-foreground); text-decoration: none; flex-shrink: 0;
}
.back-link:hover { color: var(--foreground); text-decoration: underline; }
.support-line {
  margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0.375rem; font-size: 0.8125rem; color: var(--muted-foreground);
}
.support-line svg { flex-shrink: 0; color: var(--eufy); }
.support-line a { color: var(--eufy); font-weight: 500; text-decoration: none; }
.support-line a:hover { text-decoration: underline; }
.tool-footer {
  margin-top: 1rem; text-align: center; font-size: 0.75rem;
  color: var(--muted-foreground); display: flex; justify-content: center;
  gap: 0.5rem; flex-wrap: wrap;
}
.tool-footer a { color: inherit; text-decoration: none; }
.tool-footer a:hover { text-decoration: underline; color: var(--foreground); }