/* ===== Complaints & Suggestions Portal ===== */
:root {
  --primary: #0b4f8a; --secondary: #0e7c86; --accent: #f5a623;
  --bg: #f3f5f8; --card: #fff; --text: #1d2733; --muted: #6b7785; --line: #e2e7ee;
  --danger: #c0392b; --success: #1e8449; --warning: #b9770e; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; }
.muted { color: var(--muted); }
code { background: #eef1f5; padding: 1px 6px; border-radius: 4px; }

/* ---------- Forms ---------- */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd7e1; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid #cfd7e1; border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
label { display: block; font-weight: 500; margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.span-2 { grid-column: span 2; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; margin: 0; }
.help { font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 3px; }

.btn { display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 8px; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 16px; }
.btn-block { display: block; width: 100%; }
.btn-light { background: #e9edf2; color: var(--text); }
.btn-secondary { background: var(--secondary); }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-danger { background: #fdecea; color: #8e2a1f; border-color: #f5c6c0; }
.alert-success { background: #e8f6ee; color: #155d33; border-color: #bfe6cf; }
.alert-warning { background: #fff6e5; color: #7a5208; border-color: #f6dfa9; }
.alert-info { background: #e8f1fb; color: #0c3c6a; border-color: #c4dbf3; }

/* ---------- Public form ---------- */
.public-header { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; text-align: center; padding: 28px 16px 70px; }
.public-logo { max-height: 72px; max-width: 220px; background: #fff; padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; }
.public-site { font-size: 22px; font-weight: 700; }
.public-site-ar { font-size: 18px; opacity: .92; }
.public-wrap { max-width: 760px; margin: -50px auto 40px; padding: 0 14px; }
.public-card { background: var(--card); border-radius: 14px; box-shadow: 0 10px 30px rgba(16, 38, 64, .1); padding: 28px; }
.form-title { text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 22px; }
.form-title h1 { margin: 0; font-size: 22px; color: var(--primary); }
.form-title .ar { font-size: 19px; color: var(--secondary); font-weight: 600; margin-top: 2px; }
.field { margin-bottom: 18px; }
.lbl { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 600; margin-bottom: 7px; }
.lbl span[dir=rtl] { color: var(--secondary); }
.req { color: var(--danger); font-style: normal; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { margin: 0; font-weight: 400; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; border: 1px solid #cfd7e1; border-radius: 30px; padding: 8px 14px; background: #fff; transition: .15s; user-select: none; }
.chip span em { font-style: normal; color: var(--muted); }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip input:checked + span em { color: rgba(255,255,255,.85); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.chip input:checked + span::before { content: "✓ "; }
.rating-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px 6px; margin: 0 0 18px; background: #fafbfd; }
.rating-box legend { font-weight: 700; padding: 0 6px; color: var(--primary); }
.rating-row { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.rating-row:last-child { border-bottom: 0; }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 34px; line-height: 1; color: #d4d9e0; cursor: pointer; margin: 0; transition: transform .1s; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: var(--accent); }
.star-input label:active { transform: scale(.9); }
.star-input input:focus-visible + label { outline: 2px solid var(--primary); border-radius: 4px; }
.counter { text-align: right; font-size: 12px; margin-top: 3px; }
.thanks { text-align: center; padding: 10px 0; }
.thanks-icon { width: 70px; height: 70px; border-radius: 50%; background: var(--success); color: #fff; font-size: 38px; line-height: 70px; margin: 0 auto 14px; }
.ref-box { display: inline-block; border: 2px dashed var(--primary); border-radius: 10px; padding: 10px 24px; margin: 8px 0 20px; color: var(--muted); }
.ref-box strong { display: block; font-size: 24px; color: var(--primary); letter-spacing: 1px; }
.public-footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.auth-box { background: #fff; width: 100%; max-width: 400px; border-radius: 14px; padding: 30px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.auth-box .logo { text-align: center; margin-bottom: 12px; }
.auth-box .logo img { max-height: 64px; max-width: 200px; }

/* ---------- Admin layout ---------- */
.admin { display: flex; min-height: 100vh; }
.sidebar { width: 245px; background: #14202e; color: #c9d3de; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .brand { padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.sidebar .brand img { max-height: 38px; max-width: 60px; background: #fff; border-radius: 6px; padding: 3px; }
.sidebar .brand div { font-weight: 600; color: #fff; font-size: 14px; line-height: 1.3; }
.sidebar nav { padding: 10px 0; flex: 1; }
.sidebar nav a { display: flex; gap: 10px; align-items: center; padding: 10px 18px; color: #c9d3de; text-decoration: none; border-left: 3px solid transparent; font-size: 14px; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.08); color: #fff; border-left-color: var(--accent); }
.sidebar nav .sec { padding: 14px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #6f8193; }
.sidebar .ico { width: 18px; text-align: center; opacity: .9; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar h1 { font-size: 19px; margin: 0; }
.topbar .user { font-size: 14px; color: var(--muted); }
.menu-toggle { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }
.content { padding: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 14px; font-size: 17px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-top: 3px solid var(--primary); }
.stat .n { font-size: 28px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
.bars .bar-row { display: grid; grid-template-columns: 170px 1fr 44px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.bars .track { background: #eef1f5; border-radius: 20px; height: 12px; overflow: hidden; }
.bars .fill { background: var(--secondary); height: 100%; border-radius: 20px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f7f9fb; font-weight: 600; color: #3c4a59; white-space: nowrap; }
.table tr:hover td { background: #fafcfe; }
.table-wrap { overflow-x: auto; }
.actions { white-space: nowrap; }
.actions form { display: inline; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef1f5; white-space: nowrap; }
.badge-new { background: #e3effc; color: #0c4a8a; }
.badge-in-progress { background: #fff3dc; color: #8a5a00; }
.badge-resolved { background: #e3f5ea; color: #19693a; }
.badge-closed { background: #ebedf0; color: #4a5562; }
.badge-on { background: #e3f5ea; color: #19693a; }
.badge-off { background: #fbe9e7; color: #9a2b1f; }
.stars { color: var(--accent); letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #d4d9e0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { margin: 0; font-size: 13px; }
.filters input, .filters select { padding: 7px 9px; min-width: 140px; }
.pagination { display: flex; gap: 5px; margin-top: 14px; flex-wrap: wrap; }
.pagination a { padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: #fff; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

dl.details { display: grid; grid-template-columns: 220px 1fr; margin: 0; }
dl.details dt, dl.details dd { padding: 9px 0; border-bottom: 1px solid var(--line); margin: 0; }
dl.details dt { color: var(--muted); }
.msg-box { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 12px 14px; position: relative; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--secondary); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 16px; }
.color-row { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.color-row input[type=text] { max-width: 130px; }
.logo-preview { max-height: 70px; max-width: 220px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

@media (min-width: 641px) {
  .grid-2 > .field > .lbl { min-height: 3.1em; align-content: flex-start; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-toggle { display: inline-block; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .public-card { padding: 18px; }
  .content { padding: 14px; }
  dl.details { grid-template-columns: 1fr; }
  dl.details dt { border-bottom: 0; padding-bottom: 0; }
  .bars .bar-row { grid-template-columns: 110px 1fr 36px; }
  .star-input label { font-size: 30px; }
}
@media print {
  .sidebar, .topbar, .no-print, .menu-toggle { display: none !important; }
  .content { padding: 0; }
  .card { border: 0; }
  body { background: #fff; }
}
