@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&family=Tajawal:wght@300;400;500;700&display=swap');

/* ── Variables ──────────────────────────────── */
:root {
  --bg:           #0d0f14;
  --bg2:          #13161e;
  --bg3:          #1a1e28;
  --card:         #1e2230;
  --border:       #2a2f42;
  --accent:       #f0a500;
  --accent2:      #e07b00;
  --accent-soft:  rgba(240,165,0,.12);
  --text:         #e8eaf0;
  --text-muted:   #7a82a0;
  --green:        #22c97a;
  --red:          #e84b4b;
  --radius:       14px;
  --radius-sm:    8px;
  --shadow:       0 8px 32px rgba(0,0,0,.45);
  --font-main:    'Cairo', sans-serif;
}

/* ── Reset ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

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

/* ── Survey Page Layout ─────────────────────── */
.survey-page {
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(240,165,0,.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(0,120,255,.06) 0%, transparent 60%);
  padding: 2rem 1rem 4rem;
}

.survey-container {
  max-width: 720px;
  margin: 0 auto;
}

/* ── Survey Header ──────────────────────────── */
.survey-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.survey-header .logo {
  font-size: 3rem;
  margin-bottom: .5rem;
  filter: drop-shadow(0 0 20px rgba(240,165,0,.4));
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.survey-header h1 {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -.5px;
}

.survey-header p {
  color: var(--text-muted);
  margin-top: .4rem;
  font-size: .95rem;
}

/* ── Progress Bar ───────────────────────────── */
.progress-wrap {
  background: var(--bg3);
  border-radius: 50px;
  height: 6px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 50px;
  transition: width .5s ease;
  width: 0%;
}

/* ── Section Cards ──────────────────────────── */
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  display: none;
  animation: fadeSlide .4s ease;
}

.section-card.active { display: block; }

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

.section-title {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.5rem;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--border);
}

.section-title .icon { font-size: 1.4rem; }

/* ── Questions ──────────────────────────────── */
.question-block {
  margin-bottom: 1.4rem;
}

.question-label {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .6rem;
  color: var(--text);
}

.question-label span.req { color: var(--accent); margin-right: 2px; }

/* ── Radio / Toggle Buttons ─────────────────── */
.btn-group {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

.btn-radio {
  display: none;
}

.btn-radio + label {
  padding: .55rem 1.4rem;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .2s;
  user-select: none;
}

.btn-radio + label:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-radio:checked + label {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0f14;
}

/* ── Checkbox (multi-select) ────────────────── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .6rem;
}

.check-item input[type="checkbox"] { display: none; }

.check-item label {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .88rem;
  color: var(--text-muted);
  transition: all .2s;
}

.check-item label::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  transition: all .2s;
}

.check-item input:checked + label {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.check-item input:checked + label::before {
  background: var(--accent);
  border-color: var(--accent);
  content: '✓';
  color: #0d0f14;
  font-size: .7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ── Select & Input ─────────────────────────── */
.field-group {
  margin-bottom: 1rem;
}

.field-group label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .4rem;
  color: var(--text-muted);
}

.field-input,
.field-select {
  width: 100%;
  padding: .7rem 1rem;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-main);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
  appearance: none;
  -webkit-appearance: none;
}

/* Date picker: make calendar icon appear white */
input[type="date"] {
  color: var(--text);
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* WebKit-based browsers (Chrome, Safari) */
input[type="date"]::-webkit-calendar-picker-indicator {
  -webkit-appearance: none;
  appearance: none;
  width: 1.6em;
  height: 1.6em;
  margin: 0 .6rem 0 0;
  filter: invert(1) brightness(2) saturate(0);
  -webkit-filter: invert(1) brightness(2) saturate(0);
}

/* Fallback: for browsers that don't support styling the indicator, use an inline SVG as background */
input[type="date"].field-select-fallback {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M7 10h5v5H7z'/%3E%3Cpath fill='%23ffffff' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v13c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 15H5V9h14v10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
}

.field-input:focus,
.field-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240,165,0,.15);
}

.field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a82a0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  padding-left: 2.5rem;
}

/* ── Star Rating ────────────────────────────── */
.stars-wrap {
  display: flex;
  gap: .3rem;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.stars-wrap input { display: none; }

.stars-wrap label {
  font-size: 2.2rem;
  cursor: pointer;
  color: var(--border);
  transition: color .15s, transform .15s;
  line-height: 1;
}

.stars-wrap input:checked ~ label,
.stars-wrap label:hover,
.stars-wrap label:hover ~ label {
  color: var(--accent);
}

.stars-wrap label:hover {
  transform: scale(1.2);
}

/* ── Navigation Buttons ─────────────────────── */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  gap: 1rem;
}

.btn-next, .btn-prev, .btn-submit {
  padding: .75rem 2rem;
  border: none;
  border-radius: 50px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}

.btn-next, .btn-submit {
  background: var(--accent);
  color: #0d0f14;
}

.btn-next:hover, .btn-submit:hover {
  background: var(--accent2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(240,165,0,.3);
}

.btn-prev {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

.btn-prev:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.step-indicator {
  font-size: .85rem;
  color: var(--text-muted);
}

/* ── Conditional section ────────────────────── */
.conditional { display: none; margin-top: .8rem; }
.conditional.visible { display: block; }

/* ── Thanks Page ────────────────────────────── */
.btn-back {
  display: inline-block;
  padding: .7rem 2rem;
  background: var(--accent);
  color: #0d0f14;
  border-radius: 50px;
  font-weight: 700;
  margin-top: .5rem;
  transition: background .2s;
}
.btn-back:hover { background: var(--accent2); text-decoration: none; }

/* ── Alert ──────────────────────────────────── */
.alert-error {
  background: rgba(232,75,75,.15);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  padding: .7rem 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}

/* ============================================
   ADMIN STYLES
   ============================================ */

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-logo { font-size: 3rem; margin-bottom: 1rem; }
.login-box h2 { font-size: 1.4rem; color: var(--accent); margin-bottom: 1.5rem; }

/* Admin layout */
.admin-body { background: var(--bg); }

.admin-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-logo { font-size: 1.1rem; font-weight: 700; color: var(--accent); }

.admin-nav { display: flex; gap: .8rem; align-items: center; }

.btn-export {
  padding: .45rem 1.2rem;
  background: var(--green);
  color: #0d0f14;
  border-radius: 50px;
  font-weight: 700;
  font-size: .85rem;
}

.btn-logout {
  padding: .45rem 1.2rem;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  color: var(--text-muted);
  font-size: .85rem;
}

.admin-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.stat-num { font-size: 1.8rem; font-weight: 900; color: var(--accent); }
.stat-label { font-size: .8rem; color: var(--text-muted); }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.filter-bar input,
.filter-bar select {
  padding: .55rem 1rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-main);
  font-size: .9rem;
  outline: none;
}

.filter-bar input { flex: 1; min-width: 200px; }
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--accent); }

.btn-filter {
  padding: .55rem 1.4rem;
  background: var(--accent);
  color: #0d0f14;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
}

.btn-reset {
  padding: .55rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .85rem;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  white-space: nowrap;
}

.admin-table th {
  background: var(--bg3);
  color: var(--text-muted);
  font-weight: 600;
  padding: .7rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
}

.admin-table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,.03); }

/* Pagination */
.pagination {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.page-link {
  padding: .4rem .9rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .85rem;
}

.page-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0f14;
  font-weight: 700;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 600px) {
  .survey-header h1 { font-size: 1.5rem; }
  .section-card { padding: 1.2rem; }
  .nav-buttons { flex-wrap: wrap; }
  .admin-main { padding: 1rem; }
  .filter-bar { flex-direction: column; }
}
