:root {
  --primary: #6b4c9a;
  --primary-dark: #4a3570;
  --primary-light: #8b6bb8;
  --accent: #e8a87c;
  --accent-dark: #d4846a;
  --success: #3d9b8f;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(107, 76, 154, 0.08);
  --shadow-lg: 0 10px 40px rgba(107, 76, 154, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Nunito', 'Inter', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

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

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.nav-main {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav-main a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.nav-main a:hover,
.nav-main a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

.lang-switcher {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.lang-switcher a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  transition: all 0.2s;
}

.lang-switcher a:hover,
.lang-switcher a.active {
  background: white;
  color: var(--primary);
}

/* Hero */
.hero {
  background: linear-gradient(160deg, #4a3570 0%, #6b4c9a 40%, #8b6bb8 100%);
  color: white;
  padding: 3.5rem 1.25rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::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='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}

.hero-content {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.92;
  max-width: 560px;
  margin: 0 auto 1.75rem;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  padding: 0.4rem 0.9rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Main layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.main-content {
  margin-top: -2.5rem;
  position: relative;
  z-index: 10;
  padding-bottom: 4rem;
}

/* Category tabs */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--card);
  padding: 0.6rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex: 1;
  min-width: 140px;
  padding: 0.85rem 1rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.cat-tab:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.cat-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(107, 76, 154, 0.3);
}

/* Calculator cards */
.calc-grid {
  display: grid;
  gap: 1.25rem;
}

.calc-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow 0.25s;
}

.calc-card:hover {
  box-shadow: var(--shadow-lg);
}

.calc-header {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.calc-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.calc-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.calc-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.calc-body {
  padding: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select {
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: var(--font);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 76, 154, 0.15);
}

.btn-calc {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 0.85rem 1.75rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.25s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(107, 76, 154, 0.35);
}

.btn-calc:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(107, 76, 154, 0.4);
}

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

.result-box {
  margin-top: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-radius: var(--radius-sm);
  border: 1px solid #a7f3d0;
  display: none;
}

.result-box.show {
  display: block;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-box .result-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #047857;
  margin-bottom: 0.35rem;
}

.result-box .result-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: #065f46;
  line-height: 1.2;
}

.result-box .result-detail {
  font-size: 0.9rem;
  color: #047857;
  margin-top: 0.5rem;
}

.result-box.warning {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fdba74;
}

.result-box.warning .result-label,
.result-box.warning .result-detail { color: #c2410c; }
.result-box.warning .result-value { color: #9a3412; }

/* SEO content sections */
.seo-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  margin-top: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.seo-section h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.seo-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.5rem 0 0.6rem;
  color: var(--text);
}

.seo-section p,
.seo-section li {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.seo-section ul {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.seo-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.seo-section th,
.seo-section td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.seo-section th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--text);
}

/* Footer */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.85);
  padding: 3rem 1.25rem 1.5rem;
  margin-top: 3rem;
}

.footer-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col h4 {
  color: white;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.footer-col a {
  display: block;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: white;
}

.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
}

/* Static pages */
.page-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 2.5rem 1.25rem;
  text-align: center;
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
}

.page-content {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.25rem 3rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.page-content h2 {
  font-family: var(--font-display);
  color: var(--primary-dark);
  margin: 1.5rem 0 0.75rem;
}

.page-content p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Mobile */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-main {
    width: 100%;
    justify-content: space-between;
  }
  .hero {
    padding: 2.5rem 1rem 3.5rem;
  }
  .calc-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Hide inactive panels */
.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Breed select enhancement */
.select-breed {
  width: 100%;
}

.note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.life-stage-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.life-stage-badge.puppy { background: #dbeafe; color: #1e40af; }
.life-stage-badge.adult { background: #d1fae5; color: #065f46; }
.life-stage-badge.senior { background: #fef3c7; color: #92400e; }
.life-stage-badge.geriatric { background: #fee2e2; color: #991b1b; }
/* RTL support (Arabic) */
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .header-inner,
html[dir="rtl"] .nav-main,
html[dir="rtl"] .lang-switcher,
html[dir="rtl"] .category-tabs,
html[dir="rtl"] .form-row,
html[dir="rtl"] .calc-header,
html[dir="rtl"] .footer-grid {
  flex-direction: row-reverse;
}
html[dir="rtl"] .nav-main a,
html[dir="rtl"] .lang-switcher a {
  text-align: center;
}
html[dir="rtl"] .seo-section ul {
  padding-right: 1.25rem;
  padding-left: 0;
}
