/* ================================================================
   Pharmacy Feature Selection Form — Professional Light Theme
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --bg: #F5F7FA;
  --bg-alt: #EEF1F6;
  --surface: #FFFFFF;
  --surface-hover: #FAFBFD;

  --primary: #2B5B82;
  --primary-light: #3A7CB8;
  --primary-lighter: #E8F0F8;
  --primary-dark: #1E3F5C;

  --accent: #B8913A;
  --accent-light: #D4AB52;
  --accent-bg: #FBF6EC;

  --success: #2A8E64;
  --success-light: #E6F5EE;
  --red: #C9413F;
  --red-light: #FDECEC;

  --text: #1A2332;
  --text-secondary: #5A6B7F;
  --text-muted: #8A96A6;
  --border: #DDE3EC;
  --border-light: #EDF0F5;

  --font-ar: 'Noto Kufi Arabic', system-ui, sans-serif;
  --font-num: 'Inter', system-ui, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.08);

  --transition: 250ms ease;
}

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

html, body {
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: rgba(43, 91, 130, 0.1);
  touch-action: manipulation;
}

body {
  font-family: var(--font-ar);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-ar);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.num {
  font-family: var(--font-num);
  font-weight: 600;
  direction: ltr;
}

/* ── Layout ────────────────────────────────────────────────────── */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

/* ── Header ────────────────────────────────────────────────────── */
.header {
  text-align: center;
  padding: 44px 0 20px;
}

.header h1 {
  font-size: 1.65rem;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 400;
}

/* ── Progress Bar ──────────────────────────────────────────────── */
.progress-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 247, 250, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 14px 0;
  margin: 0 -24px 24px;
  padding-inline: 24px;
  border-bottom: 1px solid var(--border-light);
  transition: box-shadow var(--transition);
}

.progress-wrapper.scrolled {
  box-shadow: var(--shadow-sm);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.progress-count {
  font-family: var(--font-num);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
}

.progress-track {
  width: 100%;
  height: 5px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 3px;
  transition: width 450ms ease;
}

/* ── Form Sections ─────────────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

/* ── Customer Info Grid ────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-label .required {
  color: var(--red);
  margin-inline-start: 2px;
}

.form-input {
  width: 100%;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-ar);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(43, 91, 130, 0.1);
}

.form-input.input-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(201, 65, 63, 0.08);
}

.error-message {
  font-size: 0.8rem;
  color: var(--red);
  min-height: 0;
}

/* ── Category Cards ────────────────────────────────────────────── */
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.category-card:hover {
  box-shadow: var(--shadow-sm);
}

.category-card.has-selected {
  border-color: var(--primary-light);
  border-inline-start: 3px solid var(--primary);
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.category-header:hover {
  background: var(--surface-hover);
}

.category-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.category-number {
  font-family: var(--font-num);
  font-size: 0.75rem;
  font-weight: 700;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-lighter);
  color: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
}

.category-card.has-selected .category-number {
  background: var(--primary);
  color: #fff;
}

.category-name {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text);
}

.category-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-badge {
  font-family: var(--font-num);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-alt);
  color: var(--text-muted);
  transition: all var(--transition);
}

.category-badge.has-selected {
  background: var(--success-light);
  color: var(--success);
}

.chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.chevron.rotated {
  transform: rotate(-180deg);
}

[dir="rtl"] .chevron.rotated {
  transform: rotate(180deg);
}

/* Category body collapse */
.category-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

.category-body.expanded {
  max-height: 3000px;
}

.category-body-inner {
  padding: 0 22px 18px;
}

/* Select all */
.select-all-row {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}

.btn-select-all {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-ar);
  font-size: 0.85rem;
  padding: 8px 18px;
  min-height: 44px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-select-all:hover {
  background: var(--primary-lighter);
  border-color: var(--primary-light);
  color: var(--primary);
}

/* ── Priority Legend ───────────────────────────────────────────── */
.priority-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}

.priority-legend-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.priority-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.high { background: var(--red); }
.legend-dot.medium { background: var(--accent); }
.legend-dot.low { background: var(--text-muted); }

/* ── Feature Rows ──────────────────────────────────────────────── */
.feature-row {
  border-bottom: 1px solid var(--border-light);
}

.feature-row:last-child {
  border-bottom: none;
}

.feature-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 8px;
  gap: 12px;
}

.feature-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.feature-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.feature-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.feature-row.selected .feature-name {
  color: var(--text);
  font-weight: 500;
}

.feature-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 4px;
  padding-inline-start: 14px;
}

/* Priority Badge */
.priority-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.priority-badge.high {
  background: var(--red-light);
  color: var(--red);
}

.priority-badge.medium {
  background: var(--accent-bg);
  color: var(--accent);
}

.priority-badge.low {
  background: var(--bg-alt);
  color: var(--text-muted);
}

/* Essential indicator */
.essential-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  flex-shrink: 0;
}

.feature-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Notes button */
.btn-notes {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.btn-notes:hover,
.btn-notes.active {
  color: var(--primary);
}

.btn-notes svg {
  width: 17px;
  height: 17px;
}

/* ── Toggle Switch ─────────────────────────────────────────────── */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}

.toggle::before {
  content: '';
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: -4px;
  right: -4px;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle.active {
  background: var(--success);
}

.toggle.active::after {
  transform: translateX(20px);
}

.toggle:active {
  transform: scale(0.95);
}

/* ── Active States for Touch Feedback ─────────────────────────── */
.category-header:active {
  background: var(--bg-alt);
}

.btn-notes:active {
  background: var(--primary-lighter);
}

.btn-select-all:active {
  background: var(--primary-lighter);
  border-color: var(--primary-light);
  color: var(--primary);
}

/* ── Notes Expand ──────────────────────────────────────────────── */
.notes-wrapper {
  max-height: 0;
  overflow: hidden;
  transition: max-height 250ms ease;
}

.notes-wrapper.open {
  max-height: 120px;
}

.notes-inner {
  padding: 0 8px 12px;
}

.notes-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-ar);
  font-size: 1rem;
  color: var(--text);
  resize: vertical;
  min-height: 52px;
  max-height: 100px;
  outline: none;
  transition: border-color var(--transition);
}

.notes-textarea::placeholder {
  color: var(--text-muted);
}

.notes-textarea:focus {
  border-color: var(--primary-light);
}

/* ── General Notes ─────────────────────────────────────────────── */
.general-notes-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-ar);
  font-size: 1rem;
  color: var(--text);
  resize: vertical;
  min-height: 90px;
  outline: none;
  transition: border-color var(--transition);
}

.general-notes-textarea:focus {
  border-color: var(--primary-light);
}

/* ── Submit Button ─────────────────────────────────────────────── */
.submit-section {
  padding: 20px 0;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-ar);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-submit:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-submit .btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Scroll Reveal ─────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 400ms ease, transform 400ms ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 7px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    padding: 14px 16px 60px;
  }

  .header {
    padding: 28px 0 16px;
  }

  .header h1 {
    font-size: 1.35rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-section {
    padding: 20px 18px;
  }

  .category-header {
    padding: 14px 16px;
  }

  .category-body-inner {
    padding: 0 16px 14px;
  }

  .category-name {
    font-size: 0.92rem;
  }

  .feature-name {
    font-size: 0.875rem;
  }

  .progress-wrapper {
    margin: 0 -16px 20px;
    padding-inline: 16px;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.2rem;
  }

  .category-meta {
    gap: 8px;
  }

  .category-badge {
    font-size: 0.78rem;
    padding: 2px 8px;
  }

  .feature-actions {
    gap: 8px;
  }
}

/* ================================================================
   Thank You Page
   ================================================================ */

.thanks-container {
  text-align: center;
  padding: 60px 20px;
  max-width: 650px;
  margin: 0 auto;
}

/* Animated Checkmark */
.checkmark-wrapper {
  margin: 0 auto 28px;
  width: 80px;
  height: 80px;
}

.checkmark-svg {
  width: 80px;
  height: 80px;
}

.checkmark-circle {
  fill: none;
  stroke: var(--success);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-linecap: round;
  animation: checkStroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkStroke 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}

@keyframes checkStroke {
  100% { stroke-dashoffset: 0; }
}

.thanks-title {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.thanks-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 36px;
}

.thanks-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  text-align: start;
  margin-bottom: 24px;
  box-shadow: var(--shadow-xs);
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.summary-stat:last-child {
  border-bottom: none;
}

.summary-stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.summary-stat-value {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.summary-stat-value .num {
  color: var(--primary);
}

.summary-categories {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.summary-category {
  margin-bottom: 14px;
}

.summary-category-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-features-list {
  list-style: none;
  padding-inline-start: 20px;
}

.summary-features-list li {
  color: var(--text-secondary);
  font-size: 0.84rem;
  padding: 2px 0;
  position: relative;
}

.summary-features-list li::before {
  content: '';
  position: absolute;
  inset-inline-start: -16px;
  top: 10px;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-ar);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.btn-back:hover {
  background: var(--bg-alt);
  color: var(--text);
}
