/* ===== WhatsApp Glass — Reminders Style (RTL Hebrew) ===== */
:root {
  /* iOS Safari / home indicator — keeps scrollable content above the bar */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --wa: #25d366;
  --wa-ink: #e9f5ec;
  --ink: #e6ece8;
  --ink-muted: #b7c2ba;
  --bg-dark: #0b0c0d;
  --bg-grad-1: #101414;
  --bg-grad-2: #0b0f0c;
  --panel: rgba(20, 22, 21, 0.55);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  --radius-lg: 18px;
  --radius-pill: 42px;
  --blur: 24px;
  --speed: 0.25s;
  --control-h: 48px;
  --danger: #ff4d4f;
  --warning: #ffc107;
  --success: #25d366;
}

* {
  font-family: "Fredoka", sans-serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-style: normal;
  font-variation-settings: "wdth" 100;
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  direction: rtl;
}

body {
  margin: 0;
  display: flex;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 20% -10%, rgba(37, 211, 102, 0.08), transparent 60%), 
              radial-gradient(900px 700px at 120% 110%, rgba(37, 211, 102, 0.06), transparent 60%),
              linear-gradient(135deg, var(--bg-grad-1), var(--bg-grad-2));
}

/* ===== Layout ===== */
#left {
  width: 280px;
  min-width: 280px;
  padding: 16px;
  overflow-y: auto;
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#right {
  flex: 1;
  min-height: 0;
  padding: 28px;
  padding-bottom: calc(28px + var(--safe-bottom));
  overflow-y: auto;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, rgba(16, 20, 17, 0.45), rgba(10, 12, 11, 0.35));
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
}

/* ===== App Header ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  gap: 8px;
  align-items: baseline;
  letter-spacing: 0.3px;
  user-select: none;
}

.brand-strong {
  font-family: "Archivo Black", system-ui, sans-serif;
  font-size: 24px;
  color: var(--wa-ink);
}

.brand-light {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-muted);
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
}

.status-dot.is-online {
  background: radial-gradient(circle at 30% 30%, #fff, var(--wa));
  box-shadow: 0 0 8px rgba(37, 211, 102, 0.8);
}

/* ===== Navigation Menu ===== */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
  color: var(--wa-ink);
  cursor: pointer;
  transition: all var(--speed) ease;
  text-decoration: none;
  font-size: 15px;
}

.nav-btn:hover {
  background: rgba(37, 211, 102, 0.16);
  border-color: var(--wa);
  transform: translateX(-4px);
}

.nav-btn.active {
  background: rgba(37, 211, 102, 0.22);
  border-color: var(--wa);
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.2);
}

.nav-icon {
  font-size: 20px;
}

.nav-text {
  flex: 1;
}

.nav-link {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.04);
}

/* ===== Screen Title ===== */
.screen-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 24px;
  padding: 14px 16px;
  background: linear-gradient(-30deg, #25d366, #b2ffc2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom: 2px solid rgba(37, 211, 102, 0.35);
}

/* ===== Tabs ===== */
.tabs-container {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--glass);
  color: var(--wa-ink);
  cursor: pointer;
  transition: all var(--speed) ease;
  font-size: 14px;
}

.tab-btn:hover {
  background: rgba(37, 211, 102, 0.16);
  border-color: var(--wa);
}

.tab-btn.active {
  background: var(--wa);
  color: #0b2b17;
  border-color: transparent;
}

/* ===== AI tab: contact search panel (toggle, default closed) ===== */
#aiContactsTab {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.ai-contacts-picker-toggle {
  width: 100%;
  box-sizing: border-box;
}

#aiContactsMainRow.ai-contacts-main-row {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
  /* כפתור הפתיחה למעלה — מורידים גובה כדי שלא יגלוש */
  height: calc(100vh - 320px);
}

#aiContactsPickerPanel.ai-contacts-picker-panel {
  flex: 0 0 350px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#aiContactsPickerPanel.ai-contacts-picker-panel[hidden] {
  display: none !important;
}

#aiContactsMainRow.ai-contacts-picker-open .ai-contacts-content-column {
  padding-left: 20px;
}

/* ===== Section Cards ===== */
.section-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  backdrop-filter: blur(14px);
}

.section-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--wa-ink);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--wa-ink);
  font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
  color: var(--wa-ink);
  font-size: 14px;
  outline: none;
  transition: all var(--speed) ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--wa);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
  background: var(--glass-strong);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-group select option {
  background-color: var(--bg-grad-2);
  color: var(--wa-ink);
}

/* ===== Checkbox Groups ===== */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all var(--speed) ease;
  margin-bottom: 0;
  font-size: 14px;
}

.checkbox-group label:hover {
  background: rgba(37, 211, 102, 0.12);
  border-color: var(--wa);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--wa);
}

.checkbox-group input[type="checkbox"]:checked + span,
.checkbox-group label:has(input[type="checkbox"]:checked) {
  background: rgba(37, 211, 102, 0.2);
  color: var(--wa-ink);
}

/* ===== Days Selection ===== */
.days-selection-container {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
}

.day-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all var(--speed) ease;
  margin-bottom: 8px;
  font-size: 14px;
}

.day-option:hover {
  background: rgba(37, 211, 102, 0.12);
}

.day-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--wa);
}

.day-option:has(input[type="checkbox"]:checked) {
  background: rgba(37, 211, 102, 0.2);
  color: var(--wa-ink);
}

.day-before-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.day-before-item .day-option {
  flex: 1;
  margin-bottom: 0;
}

/* ===== Time Selection ===== */
.time-selection-container {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all var(--speed) ease;
  margin-bottom: 12px;
  font-size: 14px;
}

.radio-option:hover {
  background: rgba(37, 211, 102, 0.12);
}

.radio-option input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--wa);
}

.radio-option:has(input[type="radio"]:checked) {
  background: rgba(37, 211, 102, 0.2);
  color: var(--wa-ink);
}

.time-input-container {
  margin-top: 12px;
}

.time-input-container input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
  color: var(--wa-ink);
  font-size: 14px;
  outline: none;
  transition: all var(--speed) ease;
}

.time-input-container input[type="number"]:focus {
  border-color: var(--wa);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
  background: var(--glass-strong);
}

/* ===== Package Reminders List ===== */
.package-reminders-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
  max-height: 500px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.package-reminders-list::-webkit-scrollbar {
  width: 8px;
}

.package-reminders-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.package-reminders-list::-webkit-scrollbar-thumb {
  background: rgba(37, 211, 102, 0.3);
  border-radius: 4px;
}

.package-reminders-list::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 211, 102, 0.5);
}

.package-reminder-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.package-reminder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.package-reminder-header h4 {
  margin: 0;
  font-size: 16px;
  color: var(--wa-ink);
}

.package-reminder-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group small {
  display: block;
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 12px;
}

/* ===== Image Upload ===== */
.image-upload-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image-upload-container input[type="file"] {
  padding: 12px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--glass);
  color: var(--wa-ink);
  cursor: pointer;
}

.image-upload-container input[type="file"]:hover {
  border-color: var(--wa);
}

.image-preview {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Buttons ===== */
.btn-primary {
  padding: 14px 28px;
  font-size: 16px;
  border: 1px solid rgba(37, 211, 102, 0.55);
  border-radius: var(--radius-pill);
  cursor: pointer;
  background: linear-gradient(180deg, rgba(37, 211, 102, 0.24), rgba(37, 211, 102, 0.18));
  color: var(--wa-ink);
  transition: all var(--speed) ease;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: var(--wa);
  color: #0b2b17;
  border-color: transparent;
  transform: translateY(-2px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-send {
  width: 100%;
  margin-top: 16px;
  font-size: 18px;
  padding: 16px;
}

.btn-danger {
  background: linear-gradient(180deg, rgba(255, 77, 79, 0.24), rgba(255, 77, 79, 0.18));
  border-color: rgba(255, 77, 79, 0.55);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: linear-gradient(180deg, rgba(37, 211, 102, 0.24), rgba(37, 211, 102, 0.18));
  border-color: rgba(37, 211, 102, 0.55);
}

.btn-success:hover {
  background: var(--success);
  color: #0b2b17;
  border-color: transparent;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--border-strong);
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
  margin: 4px;
}

/* ===== Items List (Templates) ===== */
.items-list {
  max-height: 400px;
  overflow-y: auto;
}

.template-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 12px;
  transition: all var(--speed) ease;
}

.template-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.template-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: rgba(37, 211, 102, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.template-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.template-info {
  flex: 1;
}

.template-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--wa-ink);
  margin-bottom: 4px;
}

.template-preview {
  font-size: 13px;
  color: var(--ink-muted);
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-actions {
  display: flex;
  gap: 8px;
}

/* ===== Users List ===== */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  margin-top: 8px;
}

.users-list::-webkit-scrollbar {
  width: 8px;
}

.users-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.users-list::-webkit-scrollbar-thumb {
  background: rgba(37, 211, 102, 0.3);
  border-radius: 4px;
}

.users-list::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 211, 102, 0.5);
}

.user-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.user-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border);
}

.user-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-info {
  flex: 1;
}

.user-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--wa-ink);
}

.user-contact {
  font-size: 13px;
  color: var(--ink-muted);
}

.user-actions {
  display: flex;
  gap: 8px;
}

.user-reminders {
  padding: 16px;
}

.user-reminders-title {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition: color 0.2s;
}

.user-reminders-title:hover {
  color: var(--wa-ink);
}

.reminder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.reminder-item.sent {
  opacity: 0.6;
  border-color: rgba(37, 211, 102, 0.3);
}

.reminder-icon {
  font-size: 20px;
}

.reminder-info {
  flex: 1;
}

.reminder-template-name {
  font-size: 14px;
  color: var(--wa-ink);
}

.reminder-datetime {
  font-size: 12px;
  color: var(--ink-muted);
}

.reminder-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.reminder-status.pending {
  background: rgba(255, 193, 7, 0.2);
  color: var(--warning);
}

.reminder-status.sent {
  background: rgba(37, 211, 102, 0.2);
  color: var(--success);
}

.reminder-status.failed {
  background: rgba(255, 77, 79, 0.2);
  color: var(--danger);
}

/* ===== Search Results ===== */
/* ===== Recipients List ===== */
.recipients-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.recipients-list::-webkit-scrollbar {
  width: 6px;
}

.recipients-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.recipients-list::-webkit-scrollbar-thumb {
  background: rgba(37, 211, 102, 0.3);
  border-radius: 3px;
}

.recipient-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.recipient-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.recipient-item span {
  flex: 1;
  color: var(--wa-ink);
}

.recipient-item .remove-recipient {
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  background: rgba(255, 77, 79, 0.2);
  border: 1px solid rgba(255, 77, 79, 0.4);
  border-radius: 6px;
  color: var(--danger);
  transition: all var(--speed) ease;
}

.recipient-item .remove-recipient:hover {
  background: var(--danger);
  color: #fff;
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
  margin-top: 8px;
  display: none;
  padding: 4px;
}

.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(37, 211, 102, 0.3);
  border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 211, 102, 0.5);
}

.search-results.show {
  display: block;
}

.search-result-item {
  padding: 12px 14px;
  cursor: pointer;
  transition: background var(--speed) ease;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(37, 211, 102, 0.14);
}

.search-result-item img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* ===== Preview Box ===== */
.preview-box {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  margin-top: 16px;
}

.preview-box h4 {
  margin: 0 0 12px;
  color: var(--wa-ink);
  font-size: 14px;
}

#previewContent {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

#previewContent img {
  max-width: 200px;
  border-radius: 8px;
  margin-top: 12px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-grad-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 450px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  margin: 0 0 20px;
  color: var(--wa-ink);
  font-size: 20px;
}

.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 28px;
  cursor: pointer;
  color: var(--ink-muted);
  transition: color var(--speed) ease;
}

.modal-close:hover {
  color: var(--danger);
}

/* ===== Empty Message ===== */
.empty-message {
  text-align: center;
  color: var(--ink-muted);
  padding: 30px;
  font-size: 15px;
}

.coming-soon {
  text-align: center;
  color: var(--ink-muted);
  padding: 60px;
  font-size: 20px;
}

/* ===== Scrollbars ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--glass);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(37, 211, 102, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 211, 102, 0.5);
}

/* ===== Toast Notifications ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  background: var(--bg-grad-1);
  border: 1px solid var(--border);
  color: var(--wa-ink);
  font-size: 15px;
  z-index: 2000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

.toast.success {
  border-color: rgba(37, 211, 102, 0.5);
  background: linear-gradient(180deg, rgba(37, 211, 102, 0.2), rgba(37, 211, 102, 0.1));
}

.toast.error {
  border-color: rgba(255, 77, 79, 0.5);
  background: linear-gradient(180deg, rgba(255, 77, 79, 0.2), rgba(255, 77, 79, 0.1));
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ===== Chat Styles ===== */
.chat-message {
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  text-align: right;
}

.bot-message {
  text-align: right;
}

#chatMessages {
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 211, 102, 0.3) transparent;
}

#chatMessages::-webkit-scrollbar {
  width: 6px;
}

#chatMessages::-webkit-scrollbar-thumb {
  background: rgba(37, 211, 102, 0.3);
  border-radius: 3px;
}

#chatInput:focus {
  outline: none;
  border-color: var(--wa);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

#sendChatBtn:hover {
  background: #20c55e;
  transform: scale(1.02);
}

#sendChatBtn:active {
  transform: scale(0.98);
}

#sendChatBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* ===== Day Buttons (Modal) ===== */
.day-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
}

.day-btn {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  color: var(--wa-ink);
  cursor: pointer;
  transition: all var(--speed) ease;
  font-size: 14px;
  font-family: inherit;
}

.day-btn:hover {
  background: rgba(37, 211, 102, 0.16);
  border-color: var(--wa);
}

.day-btn.active {
  background: var(--wa);
  color: #0b2b17;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.3);
}

/* ===== Time Buttons (Modal) ===== */
.time-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
  margin-bottom: 12px;
}

.time-btn {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  color: var(--wa-ink);
  cursor: pointer;
  transition: all var(--speed) ease;
  font-size: 14px;
  font-family: inherit;
  min-width: 70px;
}

.time-btn:hover {
  background: rgba(37, 211, 102, 0.16);
  border-color: var(--wa);
}

.time-btn.active {
  background: var(--wa);
  color: #0b2b17;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.3);
}

/* ===== Custom Time Input ===== */
.custom-time-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
}

.custom-time-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--wa-ink);
  font-size: 14px;
}

.custom-time-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--wa);
}

.custom-time-container input[type="time"] {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--glass);
  color: var(--wa-ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--speed) ease;
  min-width: 120px;
}

.custom-time-container input[type="time"]:focus {
  border-color: var(--wa);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
  background: var(--glass-strong);
}

.custom-time-container input[type="time"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== AI Auto Messages ===== */
.ai-tab-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auto-message-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 12px;
  transition: all var(--speed) ease;
}

.auto-message-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  transform: translateX(-4px);
}

.auto-message-index {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--wa), #20c55e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #0b2b17;
  flex-shrink: 0;
}

.auto-message-content {
  flex: 1;
  min-width: 0;
}

.auto-message-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.auto-message-type.text {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.auto-message-type.image {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.auto-message-type.text_image {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
}

.auto-message-text {
  color: var(--wa-ink);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
  word-break: break-word;
}

.auto-message-image-preview {
  max-width: 150px;
  max-height: 100px;
  border-radius: 8px;
  object-fit: cover;
  margin-top: 8px;
  border: 1px solid var(--border);
}

.auto-message-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auto-message-actions button {
  padding: 8px 12px;
  font-size: 13px;
  margin: 0;
}

.btn-edit {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.24), rgba(59, 130, 246, 0.18));
  border-color: rgba(59, 130, 246, 0.55);
}

.btn-edit:hover {
  background: #3b82f6;
  color: #fff;
  border-color: transparent;
}

/* Edit Mode */
.auto-message-item.editing {
  background: rgba(37, 211, 102, 0.1);
  border-color: var(--wa);
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.2);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    /* Column stack: fill real viewport so #right can scroll inside it */
    min-height: 0;
  }
  
  #left {
    width: 100%;
    min-width: auto;
    flex-shrink: 0;
    border-left: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  
  .nav-menu {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .nav-btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }
  
  #right {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    padding: 16px;
    padding-bottom: calc(24px + var(--safe-bottom));
  }
  
  /* Make reminder items display all columns on mobile */
  .reminder-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }
  
  .reminder-item > * {
    width: 100%;
  }
  
  .reminder-icon {
    align-self: flex-start;
    margin-bottom: 4px;
  }
  
  .reminder-info {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .reminder-template-name {
    font-size: 16px;
    margin-bottom: 6px;
  }
  
  .reminder-datetime {
    font-size: 14px;
    margin-bottom: 4px;
  }
  
  .reminder-meeting {
    font-size: 13px !important;
    margin-top: 6px !important;
    margin-bottom: 4px !important;
  }
  
  .reminder-additional-recipients {
    font-size: 13px !important;
    margin-top: 6px !important;
  }
  
  .reminder-status {
    align-self: flex-start;
    margin-bottom: 8px;
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .reminder-item > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
  }
  
  .reminder-item > div:last-child button {
    flex: 1;
    min-width: 80px;
    font-size: 12px;
    padding: 8px 12px;
  }
  
  /* User card adjustments for mobile */
  .user-card {
    margin-bottom: 16px;
  }
  
  .user-header {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .user-actions {
    flex-wrap: wrap;
    width: 100%;
    margin-top: 8px;
  }
  
  .user-actions button {
    flex: 1;
    min-width: 100px;
    font-size: 12px;
    padding: 8px 12px;
  }
  
  /* Ensure all reminder information is visible */
  .reminders-list-container {
    display: block !important;
  }
  
  .user-reminders-title {
    font-size: 15px;
    padding: 12px;
  }

  /* AI Auto Reply Screen - Mobile adjustments */
  #aiContactsMainRow.ai-contacts-main-row {
    flex-direction: column !important;
    height: auto !important;
    gap: 16px !important;
  }

  #aiContactsMainRow > .ai-contacts-picker-panel:not([hidden]) {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: auto !important;
    border-right: none !important;
    padding-right: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    padding-bottom: 16px !important;
    margin-bottom: 16px !important;
  }

  #aiContactsMainRow > .ai-contacts-content-column {
    flex: 1 1 auto !important;
    width: 100% !important;
    padding-left: 0 !important;
  }

  #aiAutoMessagesTab > div:first-child {
    flex-direction: column !important;
    height: auto !important;
    gap: 16px !important;
  }

  #aiAutoMessagesTab > div:first-child > div:first-child {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #aiAutoMessagesTab > div:first-child > div:last-child {
    flex: 1 1 auto !important;
    width: 100% !important;
  }

  /* Follow Up Screen - Mobile adjustments */
  #followUpListTab > div:first-child {
    flex-direction: column !important;
    height: auto !important;
    gap: 16px !important;
  }

  #followUpListTab > div:first-child > div:first-child {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #followUpListTab > div:first-child > div:last-child {
    flex: 1 1 auto !important;
    width: 100% !important;
  }

  #followUpMessagesTab > div:first-child {
    flex-direction: column !important;
    height: auto !important;
    gap: 16px !important;
  }

  #followUpMessagesTab > div:first-child > div:first-child {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #followUpMessagesTab > div:first-child > div:last-child {
    flex: 1 1 auto !important;
    width: 100% !important;
  }

  /* Auto message items mobile adjustments */
  .auto-message-item {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .auto-message-actions {
    width: 100% !important;
    flex-direction: row !important;
  }

  .auto-message-actions button {
    flex: 1 !important;
  }

  /* Follow up items mobile adjustments */
  .followup-item {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .followup-item > div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  /* Active conversations and finished users lists mobile */
  #activeConversationsList,
  #finishedUsersList,
  #followUpsList,
  #followUpMessagesList,
  #autoMessagesList {
    max-height: 300px !important;
    min-height: 200px !important;
  }
}

/* ===== Specific List Containers ===== */
/* Limit height of users list in users tab */
#usersList {
  max-height: 500px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Limit height of unsaved contacts list in AI tab */
#unsavedContactsList {
  max-height: 500px !important;
  min-height: 200px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  flex: 1 1 auto !important;
}

/* Ensure parent container limits height properly (picker open) */
#aiContactsPickerPanel.ai-contacts-picker-panel:not([hidden]) {
  max-height: 600px !important;
  overflow: hidden !important;
}

/* Ensure search results are scrollable */
#userSearchResults,
#followUpContactSearchResults,
#editFollowUpContactSearchResults,
#additionalRecipientSearchResults,
#manageRecipientsSearchResults {
  max-height: 300px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Ensure all scrollable lists have proper padding for scrollbar */
.users-list,
.search-results,
#unsavedContactsList,
#activeConversationsList,
#finishedUsersList,
#followUpsList,
#followUpMessagesList,
#autoMessagesList {
  padding-bottom: 12px !important;
  padding-right: 4px !important;
  padding-top: 4px !important;
}

/* Fix scrollbar visibility and ensure content is fully scrollable */
.users-list > *:last-child,
.search-results > *:last-child,
#unsavedContactsList > *:last-child,
#activeConversationsList > *:last-child,
#finishedUsersList > *:last-child,
#followUpsList > *:last-child,
#followUpMessagesList > *:last-child,
#autoMessagesList > *:last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Ensure scrollable containers allow scrolling to the very end */
.users-list,
.search-results,
#unsavedContactsList,
#activeConversationsList,
#finishedUsersList,
#followUpsList,
#followUpMessagesList,
#autoMessagesList,
.reminders-list-container {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* Ensure last child has proper spacing for full visibility when scrolled */
.users-list > .user-card:last-child,
.users-list > .empty-message:last-child,
.search-results > .search-result-item:last-child,
.search-results > .empty-message:last-child {
  margin-bottom: 0;
}

/* Ensure reminder lists inside user cards are scrollable */
.reminders-list-container {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  margin-top: 8px;
}

.reminders-list-container::-webkit-scrollbar {
  width: 6px;
}

.reminders-list-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.reminders-list-container::-webkit-scrollbar-thumb {
  background: rgba(37, 211, 102, 0.3);
  border-radius: 3px;
}

.backup-restore-card {
  max-width: 760px;
}

.backup-restore-description {
  margin: 0 0 18px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.backup-restore-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.backup-restore-upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.backup-progress-modal {
  max-width: 560px;
}

.backup-progress-bar-wrap {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 16px 0 10px;
}

.backup-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1fa855, var(--wa));
  transition: width 0.25s ease;
}

.backup-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-muted);
  font-size: 14px;
}

.backup-progress-current {
  margin: 14px 0 8px;
  color: var(--wa-ink);
}

.backup-progress-completed {
  margin: 0;
  padding: 0 18px 0 0;
  max-height: 180px;
  overflow-y: auto;
  color: var(--ink-muted);
  font-size: 13px;
}

.backup-progress-error {
  margin: 12px 0 0;
  color: var(--danger);
}

/* ===== Exam Settings ===== */
.exam-settings-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.exam-form-card,
.exam-list-card {
  flex: 1;
  min-width: 0;
}

.exam-form-card {
  flex: 0 0 420px;
}

.exam-category-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.exam-questions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.exam-questions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exam-question-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.exam-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.exam-question-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.exam-question-text {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  resize: vertical;
  margin-bottom: 10px;
}

.exam-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exam-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-correct-radio {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}

.exam-correct-radio input {
  display: none;
}

.exam-correct-radio span {
  font-size: 14px;
  color: var(--ink-muted);
}

.exam-correct-radio input:checked + span {
  color: var(--success);
  font-weight: 700;
}

.exam-option-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
}

.exam-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.exam-form-status {
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
}

.exam-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.exams-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.exam-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.exam-list-item-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.exam-list-item-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--ink-muted);
}

.exam-category-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.exam-category-speaking {
  background: rgba(37, 211, 102, 0.15);
  color: var(--success);
}

.exam-category-grammar {
  background: rgba(255, 193, 7, 0.15);
  color: var(--warning);
}

.exam-category-unseen {
  background: rgba(100, 149, 237, 0.15);
  color: #8eb4ff;
}

.exam-list-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 960px) {
  .exam-settings-layout {
    flex-direction: column;
  }

  .exam-form-card {
    flex: 1;
    width: 100%;
  }
}

.exam-admin-link-bar {
  margin-bottom: 16px;
}

.exam-link-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.exam-link-row input {
  flex: 1;
  min-width: 200px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--glass);
  color: var(--ink);
}

.exam-link-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.exam-admin-tabs {
  margin-bottom: 16px;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--accent, #25d366);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.tab-badge.hidden {
  display: none;
}

.exam-results-count {
  color: var(--ink-muted);
  font-size: 0.85em;
  font-weight: 500;
}

.exam-results-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.exam-results-search {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-family: inherit;
  font-size: 15px;
}

.exam-results-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--ink-muted);
  font-size: 13px;
}

.exam-results-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.08), rgba(255, 255, 255, 0.02));
  border-bottom: 1px solid var(--border);
}

.result-card-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.result-student-icon {
  font-size: 28px;
  line-height: 1;
}

.result-card-title h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.result-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 13px;
}

.result-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.result-stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.result-stat-pill.score {
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.25);
}

.result-stat-pill.recording {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

.result-card-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card-footer {
  padding: 0 18px 16px;
}

.result-section {
  margin: 0;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.result-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.result-section-header h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.result-mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.result-mini-badge.good {
  background: rgba(37, 211, 102, 0.15);
  color: #1b8f4d;
}

.result-mini-badge.warn {
  background: rgba(255, 193, 7, 0.15);
  color: #9a7200;
}

.result-mini-badge.info {
  background: rgba(59, 130, 246, 0.12);
}

.result-block-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink-muted);
}

.result-recording-block,
.result-reading-block,
.result-answers-block,
.result-feedback-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.result-recording-block:first-child,
.result-reading-block:first-child,
.result-answers-block:first-child,
.result-feedback-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.result-reading-text {
  padding: 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
}

.result-audio-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent, #25d366);
  text-decoration: none;
}

.result-audio-link:hover {
  text-decoration: underline;
}

.result-section-score {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 211, 102, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.result-answers-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-feedback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.result-feedback-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  font-size: 13px;
}

.result-feedback-row span {
  color: var(--ink-muted);
}

.result-missing-recording {
  color: #c0392b;
}

.result-item {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.result-item summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  list-style: none;
}

.result-item summary::-webkit-details-marker {
  display: none;
}

.result-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.result-section h4 {
  margin: 0 0 8px;
}

.result-sub {
  color: var(--ink-muted);
  font-size: 13px;
  margin: 6px 0;
}

.result-answer {
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid transparent;
}

.result-answer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.result-answer-num {
  font-weight: 700;
  color: var(--ink-muted);
  font-size: 12px;
}

.result-answer-status {
  font-size: 16px;
  font-weight: 700;
}

.result-answer-q {
  font-weight: 600;
  margin-bottom: 8px;
}

.result-answer-picked,
.result-answer-correct {
  margin-top: 4px;
}

.result-answer-picked span,
.result-answer-correct span {
  color: var(--ink-muted);
  margin-left: 6px;
}

.result-answer.correct {
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.2);
}

.result-answer.wrong {
  background: rgba(255, 77, 79, 0.1);
  border-color: rgba(255, 77, 79, 0.18);
}

.result-audio {
  width: 100%;
  margin: 4px 0;
}

.exam-delete-result-btn {
  margin-top: 0;
}

@media (max-width: 640px) {
  .result-card-header {
    flex-direction: column;
  }

  .result-card-stats {
    width: 100%;
  }
}

