:root {
  --primary: #2c3e50;
  --secondary: #34495e;
  --accent: #3498db;
  --success: #27ae60;
  --warning: #f1690f;
  --danger: #e74c3c;
  --light: #ecf0f1;
  --line: #e2e8f0;
  --radius: 10px;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background: #f5f7fa;
  color: var(--primary);
}
a { color: var(--accent); }
.container { max-width: 860px; margin: 1.5rem auto; padding: 0 18px; }
.wide { max-width: 1180px; }

.header {
  text-align: center; padding: 1.2rem; background: var(--primary); color: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.header h1 { font-size: 1.5rem; }
.header .meta { opacity: .85; font-size: .92rem; margin-top: .3rem; }

.card {
  background: #fff; padding: 1.6rem; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 1.4rem;
}
.section {
  margin-bottom: 1.4rem; padding: 1.3rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff;
}
.section-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 1rem;
  padding-bottom: .5rem; border-bottom: 2px solid var(--accent);
}
.section-header h2 { font-size: 1.15rem; }
.icon { font-size: 1.2rem; }

.form-group { margin-bottom: 1.2rem; }
label { display: block; margin-bottom: .4rem; color: var(--secondary); font-weight: 600; }
.hint { font-weight: 400; color: #7a8794; font-size: .82rem; margin-top: .15rem; }
input[type="number"], input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; padding: .75rem; border: 1px solid #d6dde4; border-radius: var(--radius);
  font-size: 1rem; font-family: inherit; transition: border-color .2s, box-shadow .2s; background: #fff;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52,152,219,.18);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.btn {
  background: var(--accent); color: #fff; padding: .75rem 1.3rem; border: none;
  border-radius: var(--radius); cursor: pointer; font-size: 1rem; font-weight: 600;
  transition: background .2s, opacity .2s;
}
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-ghost { background: #fff; color: var(--secondary); border: 1px solid #d6dde4; }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; }

.alert { padding: .9rem 1rem; border-radius: var(--radius); margin: .8rem 0; }
.alert-warning { background: #fff3cd; border-left: 4px solid var(--warning); color: #7a4b00; }
.alert-danger  { background: #f8d7da; border-left: 4px solid var(--danger); color: #842029; }
.alert-success { background: #d4edda; border-left: 4px solid var(--success); color: #15602b; }
.alert-info    { background: #e7f1fb; border-left: 4px solid var(--accent); color: #1c4e80; }

/* AI feedback blocks */
.analysis-container { margin-top: 1.4rem; }
.problem-item { padding: .6rem .8rem; margin: .5rem 0; background: #fff3cd; border-left: 4px solid var(--warning); border-radius: 6px; }
.action-item  { padding: .6rem .8rem; margin: .5rem 0; background: #d4edda; border-left: 4px solid var(--success); border-radius: 6px; }
.alert-green  { color: var(--success); font-weight: bold; }
.alert-yellow { color: var(--warning); font-weight: bold; }
.alert-red    { color: var(--danger);  font-weight: bold; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1rem; margin-top: 1rem; }
.stat-card { background: var(--light); padding: 1rem; border-radius: var(--radius); text-align: center; }
.stat-value { font-size: 1.6rem; font-weight: bold; color: var(--accent); }

.loader-overlay {
  display: none; position: fixed; inset: 0; background: rgba(255,255,255,.75);
  justify-content: center; align-items: center; z-index: 1000; flex-direction: column; gap: 1rem;
}
.loader-overlay.show { display: flex; }
.loader { width: 48px; height: 48px; border: 5px solid var(--light); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* admin */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tabs { display: flex; gap: .4rem; margin: 1rem 0 1.4rem; flex-wrap: wrap; }
.tab { padding: .55rem 1rem; border-radius: var(--radius); cursor: pointer; background: #fff; border: 1px solid var(--line); font-weight: 600; color: var(--secondary); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .6rem; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: top; }
th { color: #6b7785; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-on { background: #d4edda; color: #15602b; }
.badge-off { background: #f1f3f5; color: #868e96; }
.muted { color: #868e96; font-size: .85rem; }
.url-pill { font-family: monospace; background: #f1f3f5; padding: .2rem .45rem; border-radius: 6px; font-size: .82rem; }
.subcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; background: #fafbfc; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 900; padding: 2rem 1rem; overflow: auto; }
.modal-overlay.show { display: block; }
.modal { max-width: 920px; margin: 0 auto; background: #fff; border-radius: var(--radius); padding: 1.6rem; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.small { font-size: .82rem; }
.right { text-align: right; }
[dir="rtl"] { direction: rtl; }
