/* ═══════════════════════════════════════════════════════════════
   GROW A GARDEN CALCULATOR — Premium Stylesheet
   Mobile-first · Dark/Light Mode · Glassmorphism
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables (Light Mode) ─── */
:root {
  /* Brand Greens */
  --green-900: #1b3a1f;
  --green-800: #1b5e20;
  --green-700: #2e7d32;
  --green-600: #388e3c;
  --green-500: #43a047;
  --green-400: #66bb6a;
  --green-300: #a5d6a7;
  --green-200: #c8e6c9;
  --green-100: #e8f5e9;
  --green-50:  #f1f8f1;

  /* Backgrounds */
  --bg-body:      #f0f4ef;
  --bg-surface:   #ffffff;
  --bg-tool:      linear-gradient(135deg, #1a3a1c 0%, #0d2410 40%, #1a4020 70%, #0f2d14 100%);
  --bg-card:      rgba(255,255,255,0.92);
  --bg-card-hover:rgba(255,255,255,0.98);
  --bg-input:     #ffffff;
  --bg-table-hd:  #f0f5ef;
  --bg-result-card: #ffffff;
  --bg-intro:     #eef5e8;
  --bg-faq-item:  #f9fcf7;
  --bg-viz:       #e8f0e0;

  /* Text */
  --text-primary:   #1a2e1a;
  --text-secondary: #4a5e4a;
  --text-muted:     #6b7c6b;
  --text-on-dark:   #e8f5e9;
  --text-heading:   #2e7d32;
  --text-stat-val:  #1b5e20;

  /* Borders */
  --border-color:   #d0ddd0;
  --border-focus:   #2e7d32;
  --border-card:    rgba(46,125,50,0.12);

  /* Tool card glass effect */
  --tool-card-bg:   rgba(255,255,255,0.10);
  --tool-card-border: rgba(255,255,255,0.18);
  --tool-card-shadow: 0 8px 32px rgba(0,0,0,0.28);
  --tool-label-color: rgba(255,255,255,0.85);
  --tool-input-bg:  rgba(255,255,255,0.14);
  --tool-input-border: rgba(255,255,255,0.25);
  --tool-input-text: #ffffff;
  --tool-placeholder: rgba(255,255,255,0.45);
  --tool-select-bg: rgba(30,60,32,0.85);

  /* Buttons */
  --btn-primary-bg: #2e7d32;
  --btn-primary-hover: #1b5e20;
  --btn-secondary-bg: rgba(255,255,255,0.15);
  --btn-secondary-border: rgba(255,255,255,0.3);
  --btn-secondary-text: #ffffff;

  /* Shadows */
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.13);

  /* Transitions */
  --transition: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Result cards accent */
  --rc-plants: #43a047;
  --rc-yield:  #f57c00;
  --rc-water:  #0288d1;
  --rc-profit: #6a1b9a;

  /* Rating stars */
  --star-color: #f9a825;
  --star-empty: #d0ddd0;
}

/* ─── Dark Mode Variables ─── */
[data-theme="dark"] {
  --bg-body:      #0e1a0f;
  --bg-surface:   #162018;
  --bg-card:      rgba(20,35,22,0.95);
  --bg-card-hover:rgba(25,42,27,0.98);
  --bg-input:     #1a2e1c;
  --bg-table-hd:  #1a2e1c;
  --bg-result-card: #162018;
  --bg-intro:     #1a2e1c;
  --bg-faq-item:  #1a2e1c;
  --bg-viz:       #1a2e1c;

  --text-primary:   #e0f0e0;
  --text-secondary: #a0b8a0;
  --text-muted:     #708070;
  --text-heading:   #66bb6a;
  --text-stat-val:  #a5d6a7;

  --border-color:   #2a3e2a;
  --border-focus:   #66bb6a;
  --border-card:    rgba(102,187,106,0.15);

  --bg-table-hd:  #1e321e;
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.25);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);

  --star-empty: #2a3e2a;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background var(--transition-slow), color var(--transition-slow);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; }

/* ─── Skip to Main (a11y) ─── */
.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--green-700); color: #fff;
  padding: 8px 16px; text-decoration: none; border-radius: 0 0 8px 0;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ─── Container ─── */
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* ═══════════════════════ THEME TOGGLE ═══════════════════════ */
.theme-toggle {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 1000;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 46px; height: 46px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.theme-toggle:hover { transform: scale(1.1); border-color: var(--green-500); }

/* ═══════════════════════ HEADER ═══════════════════════ */
.site-header {
  background: linear-gradient(135deg, #1a3a1c 0%, #0d2410 50%, #1b5e20 100%);
  padding: 28px 20px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.site-header::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2343a047' fill-opacity='0.06'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  pointer-events: none;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.logo-icon {
  font-size: 3rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.site-header h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.subtitle {
  color: rgba(200,230,201,0.85);
  font-size: 0.9rem;
  font-weight: 400;
  margin-top: 4px;
}

.header-rating {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 10px 16px;
  text-align: center;
}
.stars-display {
  color: var(--star-color);
  font-size: 1.1rem;
  letter-spacing: 2px;
}
.rating-text {
  color: rgba(255,255,255,0.9);
  font-size: 0.8rem;
  font-weight: 600;
}
.rating-text span { opacity: 0.7; font-weight: 400; }

/* ═══════════════════════ BREADCRUMB ═══════════════════════ */
.breadcrumb {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 0;
  font-size: 13px;
}
.breadcrumb-list {
  list-style: none;
  display: flex;
  gap: 8px;
  align-items: center;
}
.breadcrumb-list li { color: var(--text-muted); }
.breadcrumb-list li::before { content: '›'; margin-right: 8px; }
.breadcrumb-list li:first-child::before { display: none; }
.breadcrumb-list a { color: var(--green-600); text-decoration: none; }
.breadcrumb-list a:hover { text-decoration: underline; }

/* ═══════════════════════ INTRO SECTION ═══════════════════════ */
.intro-section {
  background: var(--bg-intro);
  border-left: 4px solid var(--green-600);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 15px;
  color: var(--text-secondary);
  transition: background var(--transition-slow);
}

/* ═══════════════════════ TOOL WRAPPER ═══════════════════════ */
.tool-wrapper {
  background: var(--bg-tool);
  border-radius: 20px;
  padding: 28px 24px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
}
.tool-wrapper::before {
  content: '';
  position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(102,187,106,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(46,125,50,0.06) 0%, transparent 50%);
  pointer-events: none;
}

/* ─── Tool Cards (glassmorphism) ─── */
.tool-card {
  background: var(--tool-card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--tool-card-border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--tool-card-shadow);
  position: relative;
  z-index: 1;
  transition: background var(--transition);
}
.tool-card:last-of-type { margin-bottom: 0; }
.tool-card:hover { background: rgba(255,255,255,0.13); }

/* Step Header */
.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.step-badge {
  background: rgba(102,187,106,0.25);
  color: #a5d6a7;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(165,214,167,0.3);
  white-space: nowrap;
}
.step-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}
.auto-fill-badge {
  margin-left: auto;
  background: rgba(76,175,80,0.2);
  color: #81c784;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(129,199,132,0.3);
  display: none;
  white-space: nowrap;
}
.auto-fill-badge.visible { display: inline; }

/* ─── Grids ─── */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ─── Fields inside tool ─── */
.field { display: flex; flex-direction: column; gap: 5px; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tool-label-color);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Tool inputs */
.tool-wrapper select,
.tool-wrapper input[type="number"],
.tool-wrapper input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--tool-input-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: var(--tool-input-bg);
  color: var(--tool-input-text);
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.tool-wrapper select {
  background: var(--tool-select-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.6)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
.tool-wrapper select option {
  background: #1a3a1c;
  color: #e0f0e0;
}

.tool-wrapper select:focus,
.tool-wrapper input:focus {
  border-color: rgba(102,187,106,0.7);
  background: rgba(255,255,255,0.18);
  box-shadow: 0 0 0 3px rgba(102,187,106,0.2);
}

.tool-wrapper input::placeholder { color: var(--tool-placeholder); }
.tool-wrapper input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(0.6); }

.dim-row { display: flex; gap: 8px; }
.dim-row input { flex: 2; }
.dim-row select { flex: 0 0 64px; }

/* ─── Error Message ─── */
.error-message {
  background: rgba(211,47,47,0.15);
  border: 1px solid rgba(239,83,80,0.4);
  border-radius: 10px;
  padding: 12px 16px;
  color: #ef9a9a;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
}

/* ─── Action Buttons ─── */
.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
  position: relative;
  z-index: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.btn-icon { font-size: 1.1em; }

.btn-primary {
  background: linear-gradient(135deg, #43a047, #2e7d32);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(46,125,50,0.4);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #388e3c, #1b5e20);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(46,125,50,0.5);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--btn-secondary-border);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.12);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.9); }

/* ─── Loading Spinner ─── */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #66bb6a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════ RESULTS SECTION ═══════════════════════ */
.fade-section {
  opacity: 0;
  transform: translateY(20px);
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}
.fade-section.show {
  opacity: 1;
  transform: translateY(0);
  max-height: none;
  pointer-events: auto;
}

/* Success Toast */
.success-toast {
  background: linear-gradient(135deg, #2e7d32, #388e3c);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(46,125,50,0.3);
  display: none;
}
.success-toast.show { display: block; animation: slideDown 0.4s ease; }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Result Action Bar */
.result-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.results-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-heading);
}
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Small buttons */
.btn-sm {
  padding: 7px 14px;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-copy    { background: #e3f2fd; color: #1565c0; }
.btn-share   { background: #f3e5f5; color: #6a1b9a; }
.btn-download{ background: #e8f5e9; color: #2e7d32; }
.btn-print   { background: #fff3e0; color: #e65100; }
.btn-sm:hover { opacity: 0.85; transform: translateY(-1px); }

[data-theme="dark"] .btn-copy    { background: #1a2e50; color: #90caf9; }
[data-theme="dark"] .btn-share   { background: #2d1a40; color: #ce93d8; }
[data-theme="dark"] .btn-download{ background: #1a2e1c; color: #81c784; }
[data-theme="dark"] .btn-print   { background: #2e1a0a; color: #ffcc80; }

/* ─── Results Grid ─── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.result-card {
  background: var(--bg-result-card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-card);
  position: relative;
  overflow: hidden;
  transition: background var(--transition-slow), box-shadow var(--transition);
}
.result-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.result-card-icon {
  font-size: 1.6rem;
  margin-bottom: 10px;
  display: block;
}

.result-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid;
}
.result-card--plants h3 { color: var(--rc-plants); border-color: var(--rc-plants); }
.result-card--yield  h3 { color: var(--rc-yield);  border-color: var(--rc-yield); }
.result-card--water  h3 { color: var(--rc-water);  border-color: var(--rc-water); }
.result-card--profit h3 { color: var(--rc-profit); border-color: var(--rc-profit); }

.result-card--plants::before { background: var(--rc-plants); }
.result-card--yield::before  { background: var(--rc-yield); }
.result-card--water::before  { background: var(--rc-water); }
.result-card--profit::before { background: var(--rc-profit); }

.result-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  gap: 8px;
}
.stat:last-child { border-bottom: none; padding-bottom: 0; }
.stat span:first-child { color: var(--text-secondary); }
.stat-val { font-weight: 700; color: var(--text-stat-val); text-align: right; }

.profit-row .stat-val { font-size: 1rem; }

/* ─── Non-tool cards (results, article, faq) ─── */
.tool-card.result-outer,
#resultsSection .tool-card,
#historySection {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  backdrop-filter: none;
  transition: background var(--transition-slow);
}
#resultsSection .tool-card label { color: var(--text-secondary); }

.section-h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 16px;
  margin-top: 0;
}

/* ─── Table ─── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 400px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-color); }
th { background: var(--bg-table-hd); font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-intro); }

/* ─── Visualization ─── */
#viz {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 16px;
  background: var(--bg-viz);
  border-radius: 10px;
  min-height: 60px;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-slow);
}
.dot {
  width: 10px; height: 10px;
  background: var(--green-600);
  border-radius: 50%;
  transition: transform 0.15s;
}
.dot:hover { transform: scale(1.5); }
.viz-placeholder { color: var(--text-muted); font-size: 13px; }
.viz-note { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 10px; }
.viz-stats { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 6px; }

/* ─── History ─── */
.history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--bg-intro);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}
.history-item:hover { border-color: var(--green-500); box-shadow: var(--shadow-sm); }
.history-item-header { display: flex; justify-content: space-between; align-items: center; }
.history-item-title { font-weight: 600; color: var(--text-heading); }
.history-item-time { font-size: 11px; color: var(--text-muted); }
.history-item-details { color: var(--text-secondary); margin-top: 4px; }

/* ═══════════════════════ RATING SECTION ═══════════════════════ */
.rating-section {
  background: linear-gradient(135deg, var(--bg-intro), var(--bg-surface));
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 28px 24px;
  margin-bottom: 32px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.rating-inner h3 { font-size: 1.1rem; color: var(--text-heading); margin-bottom: 6px; }
.rating-inner > p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }

.star-rating { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.star {
  font-size: 2rem;
  color: var(--star-empty);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
  padding: 2px;
  line-height: 1;
}
.star:hover, .star.active { color: var(--star-color); }
.star:hover { transform: scale(1.2); }
.star-rating:hover .star { color: var(--star-color); }
.star-rating .star:hover ~ .star { color: var(--star-empty); }

.rating-result { font-size: 14px; color: var(--text-secondary); min-height: 20px; margin-bottom: 12px; }
.rating-summary { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rating-avg { font-size: 1.5rem; font-weight: 800; color: var(--text-heading); }
.rating-stars-small { color: var(--star-color); font-size: 1rem; letter-spacing: 2px; }
.rating-count { color: var(--text-muted); font-size: 13px; }

/* ═══════════════════════ TOOLTIPS ═══════════════════════ */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.tooltip-icon {
  width: 15px; height: 15px;
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}
.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a3a1c;
  color: #e0f0e0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  pointer-events: none;
  border: 1px solid rgba(102,187,106,0.2);
  max-width: 220px;
  white-space: normal;
  text-align: center;
}
.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1a3a1c;
}
.tooltip-wrap:hover .tooltip-text,
.tooltip-wrap:focus .tooltip-text { display: block; }

/* ═══════════════════════ ARTICLE ═══════════════════════ */
.content-article {
  background: var(--bg-surface);
  border-radius: 14px;
  padding: 36px 40px;
  margin: 0 0 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-card);
  transition: background var(--transition-slow);
}
.content-article h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--green-200);
}
[data-theme="dark"] .content-article h2 { border-color: var(--green-900); }
.content-article h2:first-child { margin-top: 0; }
.content-article h3 { font-size: 1.05rem; color: var(--green-800); margin: 18px 0 8px; }
[data-theme="dark"] .content-article h3 { color: var(--green-400); }
.content-article p { color: var(--text-secondary); margin-bottom: 14px; font-size: 15px; }
.content-article ul, .content-article ol { padding-left: 22px; margin-bottom: 14px; }
.content-article li { color: var(--text-secondary); font-size: 15px; margin-bottom: 6px; }

/* ═══════════════════════ FAQ ═══════════════════════ */
.faq-section {
  background: var(--bg-surface);
  border-radius: 14px;
  padding: 32px 36px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-card);
  transition: background var(--transition-slow);
}
.faq-section > h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--green-200);
}
[data-theme="dark"] .faq-section > h2 { border-color: var(--green-900); }

.faq-item { margin-bottom: 8px; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
.faq-question {
  width: 100%;
  background: var(--bg-faq-item);
  border: none;
  padding: 16px 20px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  transition: background var(--transition);
  gap: 12px;
}
.faq-question:hover { background: var(--bg-intro); }
.faq-icon {
  font-size: 1.2rem;
  color: var(--green-600);
  font-weight: 700;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.faq-question[aria-expanded="true"] .faq-icon { transform: rotate(45deg); }
.faq-answer { padding: 0 20px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.faq-answer:not([hidden]) { padding: 4px 20px 16px; max-height: 400px; }
.faq-answer p { color: var(--text-secondary); font-size: 14px; margin: 0; line-height: 1.7; }

/* ═══════════════════════ MODAL ═══════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
  backdrop-filter: blur(4px);
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 901;
  width: min(480px, 90vw);
}
.modal-box {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-card);
  position: relative;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--bg-intro); border: none; border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer;
  color: var(--text-secondary); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border-color); }
.modal-box h3 { font-size: 1.1rem; color: var(--text-heading); margin-bottom: 8px; }
.modal-box p { color: var(--text-secondary); font-size: 14px; margin-bottom: 14px; }
.share-url-wrap { display: flex; gap: 8px; margin-bottom: 16px; }
.share-url-wrap input {
  flex: 1; padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px; font-size: 13px;
  background: var(--bg-input); color: var(--text-primary);
}
.share-buttons { display: flex; gap: 10px; }
.share-btn {
  flex: 1; padding: 10px; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.share-twitter { background: #e7f3ff; color: #1a73e8; }
.share-wa { background: #e8f5e1; color: #2e7d32; }
.share-btn:hover { opacity: 0.85; transform: translateY(-1px); }

/* ═══════════════════════ FOOTER ═══════════════════════ */
.site-footer {
  background: linear-gradient(135deg, #1a3a1c, #0d2410);
  color: #a5d6a7;
  text-align: center;
  padding: 32px 20px;
  margin-top: 20px;
}
.footer-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.footer-brand { font-size: 1rem; color: #ffffff; }
.footer-copy { font-size: 13px; opacity: 0.8; }
.footer-tagline { font-size: 12px; opacity: 0.5; }

/* ═══════════════════════ PRINT STYLES ═══════════════════════ */
@media print {
  .theme-toggle, .action-buttons, .result-action-bar .result-actions,
  .breadcrumb, .site-header .header-rating, #historySection,
  .rating-section, .modal, .modal-overlay { display: none !important; }
  body { background: #fff; color: #000; }
  .tool-wrapper { background: #fff; box-shadow: none; border: 1px solid #ccc; }
  .tool-card { background: #fff; border: 1px solid #ddd; }
  .fade-section { opacity: 1; max-height: none; transform: none; }
  .result-card { break-inside: avoid; }
}

/* ═══════════════════════ RESPONSIVE ═══════════════════════ */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .header-inner { flex-direction: column; gap: 16px; text-align: center; }
  .header-logo { flex-direction: column; text-align: center; gap: 10px; }
  .logo-icon { font-size: 2.2rem; }
  .site-header h1 { font-size: 1.5rem; }
  .tool-wrapper { padding: 18px 14px; border-radius: 16px; }
  .tool-card { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .action-buttons { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }
  .result-action-bar { flex-direction: column; align-items: flex-start; }
  .result-actions { flex-wrap: wrap; }
  .results-grid { grid-template-columns: 1fr; }
  .content-article, .faq-section { padding: 24px 18px; }
  .step-header { gap: 8px; }
  .auto-fill-badge { width: 100%; text-align: center; margin-left: 0; }
  .theme-toggle { top: 10px; right: 10px; width: 40px; height: 40px; font-size: 17px; }
  table { font-size: 12px; }
  th, td { padding: 8px 8px; }
}

@media (max-width: 400px) {
  .site-header { padding: 20px 14px 18px; }
  .result-actions { gap: 6px; }
  .btn-sm { padding: 6px 10px; font-size: 12px; }
  .star { font-size: 1.6rem; }
}

/* ─── Focus Styles (a11y) ─── */
:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible { outline-offset: 3px; }

/* ─── Smooth transitions for theme switch ─── */
body, .site-header, .content-article, .faq-section,
.result-card, .tool-card, .intro-section, .rating-section,
table, .breadcrumb, .faq-item, .faq-question { 
  transition-property: background, background-color, border-color, color;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}
