:root {
  --primary: #2f6fed;
  --primary-dark: #1f4fbf;
  --bg: #f6f8fb;
  --card-bg: #ffffff;
  --text: #1c2430;
  --text-muted: #6b7686;
  --border: #e4e8ef;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: inherit; text-decoration: none; }

.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.logo { font-size: 20px; font-weight: 800; color: var(--primary); }

.main-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.main-nav a { color: var(--text-muted); font-weight: 500; }
.main-nav a:hover { color: var(--primary); }

.hero {
  text-align: center;
  padding: 56px 20px 40px;
}
.hero h1 { font-size: 30px; font-weight: 800; margin-bottom: 12px; }
.hero p { color: var(--text-muted); font-size: 16px; max-width: 620px; margin: 0 auto; }

.category-block { margin: 36px 0; }
.category-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tool-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: box-shadow .15s, transform .15s;
  display: block;
}
.tool-card:hover {
  box-shadow: 0 8px 24px rgba(47,111,237,.12);
  transform: translateY(-2px);
}
.tool-icon { font-size: 28px; margin-bottom: 10px; display: block; }
.tool-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.tool-card p { margin: 0; font-size: 13px; color: var(--text-muted); }

.breadcrumbs { font-size: 13px; color: var(--text-muted); margin: 20px 0; }
.breadcrumbs a { color: var(--primary); }

.tool-page-header { padding: 30px 0 10px; }
.tool-page-header h1 { font-size: 26px; font-weight: 800; margin: 0 0 8px; }
.tool-page-header p { color: var(--text-muted); margin: 0; }

.tool-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 24px 0 40px;
}

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-row .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  background: #fbfcfe;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); background: #fff; }

textarea { resize: vertical; min-height: 140px; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 26px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #eef2fb; color: var(--primary); }

.result-box {
  margin-top: 20px;
  padding: 18px;
  border-radius: 10px;
  background: #eef4ff;
  border: 1px solid #d9e6fb;
  display: none;
}
.result-box.show { display: block; }
.result-box .result-item { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; }
.result-box .result-item b { color: var(--primary-dark); }

.inline-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .inline-fields { grid-template-columns: 1fr 1fr 1fr; } }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  margin-top: 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Admin */
.admin-body { background: #f2f4f8; }
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 230px; background: #171d2b; color: #cfd6e4; padding: 20px 0; flex-shrink: 0;
}
.admin-sidebar .brand { padding: 0 20px 20px; font-weight: 800; font-size: 17px; color: #fff; }
.admin-sidebar a { display: block; padding: 11px 20px; color: #cfd6e4; font-size: 14px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: #232b3d; color: #fff; }
.admin-main { flex: 1; padding: 28px 32px; }
.admin-card {
  background: #fff; border-radius: 12px; border: 1px solid var(--border); padding: 22px; margin-bottom: 20px;
}
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
.admin-table th { color: var(--text-muted); font-weight: 600; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.on { background: #e4f7ea; color: #1f9d55; }
.badge.off { background: #fdeaea; color: #d64545; }
.actions a { margin-left: 10px; font-size: 13px; color: var(--primary); }
.actions a.danger { color: #d64545; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: #fff; padding: 36px; border-radius: 16px; width: 100%; max-width: 360px; border: 1px solid var(--border); }
.login-box h1 { font-size: 20px; text-align: center; margin-bottom: 22px; }
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert.error { background: #fdeaea; color: #b23a3a; }
.alert.success { background: #e4f7ea; color: #1f9d55; }
