/* ===========================
   kalkullator.guru - Main CSS
   =========================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #10b981;
  --accent: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

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

/* ===== NAVBAR ===== */
.navbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.navbar-brand {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand:hover { text-decoration: none; }

.navbar-menu {
  display: flex;
  gap: 4px;
  list-style: none;
}

.navbar-menu a {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
}

.navbar-menu a:hover,
.navbar-menu a.active {
  background: #eff6ff;
  color: var(--primary);
  text-decoration: none;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
}

/* ===== LAYOUT ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 30px;
  padding: 30px 0;
}

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }

/* ===== SHARE BAR ===== */
.share-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  background: #f8fafc;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.last-updated { font-size: 13px; color: var(--text-muted); }

.share-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.share-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.share-btn:hover { opacity: 0.85; text-decoration: none; }
.share-btn.fb { background: #1877f2; color: white; }
.share-btn.tw { background: #1da1f2; color: white; }
.share-btn.wa { background: #25d366; color: white; }
.share-btn.li { background: #0077b5; color: white; }
.share-btn.cp { background: #64748b; color: white; }

/* ===== TOOL PAGE ===== */
.tool-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}

.tool-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tool-meta a { color: var(--primary); }

/* ===== CALCULATOR BOX ===== */
.calc-box {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 30px;
  border: 1px solid var(--border);
}

.calc-box h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #eff6ff;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
  transition: border-color 0.2s;
}

.input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.input-wrap input,
.input-wrap select {
  flex: 1;
  padding: 10px 14px;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  color: var(--text);
}

.input-wrap .unit {
  padding: 10px 14px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ===== BUTTONS ===== */
.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  flex: 1;
  justify-content: center;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: #e2e8f0; }

/* ===== RESULTS ===== */
.result-box {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
  display: none;
}

.result-box.show { display: block; }

.result-box h3 {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 16px;
  font-weight: 600;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.result-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.result-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.result-card .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
}

.result-card .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-card.highlight {
  background: var(--primary);
  color: white;
}

.result-card.highlight .label,
.result-card.highlight .value,
.result-card.highlight .sub { color: white; }

.result-card.green { background: #ecfdf5; }
.result-card.green .value { color: var(--secondary); }
.result-card.yellow { background: #fffbeb; }
.result-card.yellow .value { color: var(--accent); }
.result-card.red { background: #fef2f2; }
.result-card.red .value { color: var(--danger); }

/* Breakdown table */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 14px;
}

.breakdown-table th {
  background: #f1f5f9;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.breakdown-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.breakdown-table tr:last-child td { border-bottom: none; }
.breakdown-table tr:hover td { background: #f8fafc; }

/* ===== CHART SECTION ===== */
.chart-section {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.chart-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.chart-section p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.chart-wrap {
  position: relative;
  height: 300px;
}

/* ===== TABLE OF CONTENTS ===== */
.toc {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}

.toc h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

.toc ol {
  padding-left: 20px;
  margin: 0;
}

.toc li {
  margin-bottom: 6px;
}

.toc a {
  color: var(--primary);
  font-size: 14px;
}

/* ===== CONTENT ARTICLE ===== */
.article {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 30px;
  border: 1px solid var(--border);
  margin-bottom: 30px;
}

.article h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #eff6ff;
}

.article h2:first-child { margin-top: 0; }

.article h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  margin: 22px 0 10px;
}

.article h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 18px 0 8px;
}

.article p {
  margin-bottom: 16px;
  line-height: 1.8;
  color: #334155;
}

.article ul, .article ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.article li {
  margin-bottom: 8px;
  line-height: 1.7;
  color: #334155;
}

.article strong { color: var(--text); }

/* Formula box */
.formula-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 20px 0;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  overflow-x: auto;
}

/* Info box */
.info-box {
  background: #eff6ff;
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
}

.info-box p { margin: 0; font-size: 14px; color: #1e40af; }

/* Warning box */
.warning-box {
  background: #fffbeb;
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
}

/* ===== FAQ ===== */
.faq-section { margin-bottom: 30px; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.faq-question {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-white);
  font-weight: 600;
  font-size: 15px;
  user-select: none;
}

.faq-question:hover { background: #f8fafc; }
.faq-question .icon { transition: transform 0.3s; font-size: 18px; color: var(--primary); }
.faq-item.open .faq-question .icon { transform: rotate(45deg); }

.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s;
  background: #f8fafc;
  font-size: 14px;
  color: #334155;
  line-height: 1.7;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 16px 20px;
}

/* ===== SIDEBAR ===== */
.sidebar-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #eff6ff;
}

.related-list {
  list-style: none;
}

.related-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.related-list li:last-child { border-bottom: none; }

.related-list a {
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.related-list a:hover { color: var(--primary); text-decoration: none; }
.related-list a::before { content: "→"; color: var(--primary); font-size: 12px; }

/* ===== HOMEPAGE ===== */
.hero {
  background: linear-gradient(135deg, #1d4ed8, #2563eb, #0ea5e9);
  color: white;
  padding: 60px 20px;
  text-align: center;
}

.hero h1 {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero p {
  font-size: 18px;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 30px;
}

.search-bar {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  background: white;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.search-bar input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
}

.search-bar button {
  padding: 14px 24px;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* Categories grid */
.categories-section {
  padding: 50px 0;
}

.categories-section h2 {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 30px;
  color: var(--text);
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.category-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: block;
}

.category-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--primary);
}

.category-card .icon { font-size: 32px; margin-bottom: 10px; }
.category-card .name { font-size: 14px; font-weight: 600; }
.category-card .count { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Tools grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.tool-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
  display: block;
}

.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.tool-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.tool-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0; }
.tool-card .tag {
  display: inline-block;
  background: #eff6ff;
  color: var(--primary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 8px;
  font-weight: 500;
}

/* ===== FOOTER ===== */
footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 40px 20px 20px;
  margin-top: 60px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

.footer-brand {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin-bottom: 10px;
}

.footer-desc { font-size: 13px; line-height: 1.7; }

.footer-col h4 {
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-bottom: 14px;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: #94a3b8; font-size: 13px; }
.footer-col a:hover { color: white; }

.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 20px;
  text-align: center;
  font-size: 13px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .navbar-menu { display: none; }
  .navbar-toggle { display: block; }
  .navbar-menu.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    z-index: 99;
  }

  .hero h1 { font-size: 28px; }
  .categories-grid { grid-template-columns: repeat(3, 1fr); }
  .tool-header h1 { font-size: 22px; }
  .calc-box { padding: 20px; }
  .btn-group { flex-direction: column; }
  .share-bar { flex-direction: column; align-items: flex-start; }
  .share-label { display: none; }
}

/* ===== PRINT ===== */
@media print {
  .navbar, .sidebar, .share-bar, footer { display: none; }
  .main-layout { grid-template-columns: 1fr; }
}
