/* DIY Calc — Dark Theme Stylesheet */
:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #252836;
  --bg-hover: #2a2d3a;
  --border: #333648;
  --text: #e8e9ed;
  --text-muted: #8b8fa3;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.15);
  --green: #00b894;
  --green-light: #55efc4;
  --orange: #fdcb6e;
  --red: #ff7675;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0,0,0,0.3);
  --max-w: 720px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 1.5rem 1rem; }
.container-wide { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem; }

/* Header */
.site-header {
  text-align: center;
  padding: 2rem 0 1rem;
}
.site-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.site-header .logo-accent { color: var(--accent-light); }
.site-header .tagline {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: 0.25rem;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--accent-light); text-decoration: none; }

/* Calculator Cards Grid (index) */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.calc-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(108, 92, 231, 0.12);
}
.calc-card .icon {
  font-size: 2.2rem;
  line-height: 1;
}
.calc-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
}
.calc-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
}
.calc-card .arrow {
  color: var(--accent-light);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Card (general) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

/* Form Elements */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::-webkit-inner-spin-button,
input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.input-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.input-group { display: flex; flex-direction: column; }

/* Slab / Area Sections */
.area-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  position: relative;
}
.area-section .area-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.area-section .area-header h3 {
  font-size: 1rem;
  font-weight: 700;
}
.area-sub-result {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #5b4bd5; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.btn-danger {
  background: transparent;
  color: var(--red);
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid transparent;
}
.btn-danger:hover { border-color: var(--red); }

/* Results */
.results {
  background: linear-gradient(135deg, rgba(108,92,231,0.08), rgba(0,184,148,0.06));
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.25rem;
}
.results h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}
.result-item {
  text-align: center;
  padding: 0.75rem;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
}
.result-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--green-light);
  line-height: 1.2;
}
.result-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.result-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem;
  font-size: 0.95rem;
}

/* Tips */
.tips {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.tips h3 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tips ul { list-style: none; }
.tips li {
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-left: 1.2rem;
  position: relative;
}
.tips li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-light);
}

/* Diagram */
.diagram {
  text-align: center;
  margin: 1rem 0;
}
.diagram svg { max-width: 280px; width: 100%; height: auto; }

/* Shape toggle */
.shape-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.shape-toggle button {
  flex: 1;
  padding: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.shape-toggle button.active {
  background: var(--accent);
  color: #fff;
}

/* Other calculators */
.other-calcs {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.other-calcs h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}
.other-calcs-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.other-calcs-grid a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.15s;
}
.other-calcs-grid a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Ad placeholder */
/* .ad-slot { min-height: 90px; background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.8rem; margin: 1.5rem 0; } */

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .site-header, .back-link, .tips, .other-calcs, .site-footer, .btn, .area-header .btn-danger { display: none; }
  .results { border-color: #000; background: #f5f5f5; }
  .result-value { color: #000; }
}

/* Responsive */
@media (max-width: 480px) {
  .site-header h1 { font-size: 1.5rem; }
  .input-row { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .result-value { font-size: 1.5rem; }
  .container { padding: 1rem 0.75rem; }
}
