/* =====================================================
   100bal.az — Advanced Components v3B
   ===================================================== */

/* ===== TOAST NOTIFICATION ===== */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
  max-width: 360px;
  width: 100%;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-4);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn 0.3s var(--ease-bounce);
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
}
.toast.toast-success::before { background: var(--color-success); }
.toast.toast-danger::before  { background: var(--color-danger); }
.toast.toast-warning::before { background: var(--color-warning); }
.toast.toast-info::before    { background: var(--color-secondary); }
.toast-icon { font-size: 1.2rem; flex-shrink: 0; line-height: 1.4; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: var(--text-sm); font-weight: 700; color: var(--text); margin-bottom: 2px; }
.toast-msg   { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-subtle);
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  padding: 2px;
  border-radius: 4px;
  transition: var(--ease);
}
.toast-close:hover { color: var(--text); background: var(--bg-alt); }
@keyframes toastIn {
  from { opacity:0; transform:translateX(100%); }
  to   { opacity:1; transform:translateX(0); }
}
.toast.leaving {
  animation: toastOut 0.25s ease forwards;
}
@keyframes toastOut {
  to { opacity:0; transform:translateX(120%); margin-bottom: -60px; }
}

/* ===== LOADING SKELETON ===== */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-alt) 50%, var(--border) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}
.skeleton-text {
  height: 14px;
  border-radius: var(--radius-full);
  margin-bottom: var(--sp-2);
}
.skeleton-text.w-3\/4 { width: 75%; }
.skeleton-text.w-1\/2 { width: 50%; }
.skeleton-title  { height: 22px; width: 60%; border-radius: var(--radius-full); margin-bottom: var(--sp-3); }
.skeleton-circle { border-radius: 50%; }
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}

/* ===== SCORE DONUT (SVG-based) ===== */
.score-donut-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
}
.score-donut-wrap svg {
  position: absolute;
  top: 0; left: 0;
  transform: rotate(-90deg);
}
.score-donut-track { fill: none; stroke: var(--border); stroke-width: 10; }
.score-donut-fill  {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s ease;
}
.score-donut-fill.success { stroke: var(--color-success); }
.score-donut-fill.warning { stroke: var(--color-warning); }
.score-donut-fill.danger  { stroke: var(--color-danger); }
.score-donut-inner {
  position: relative;
  text-align: center;
  z-index: 1;
}
.score-donut-num {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -2px;
  line-height: 1;
}
.score-donut-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== WEAKNESS HEATMAP ===== */
.heatmap {
  display: grid;
  gap: var(--sp-2);
}
.heatmap-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-sm);
}
.heatmap-label { width: 140px; flex-shrink: 0; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heatmap-bar-wrap { flex: 1; height: 24px; background: var(--bg-alt); border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.heatmap-bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--sp-2);
}
.heatmap-bar span { font-size: var(--text-xs); font-weight: 800; color: #fff; }
.heatmap-bar.level-90 { background: linear-gradient(90deg, var(--color-success), #86efac); }
.heatmap-bar.level-70 { background: linear-gradient(90deg, #84cc16, #bef264); }
.heatmap-bar.level-50 { background: linear-gradient(90deg, var(--color-warning), #fcd34d); }
.heatmap-bar.level-30 { background: linear-gradient(90deg, #f97316, #fdba74); }
.heatmap-bar.level-0  { background: linear-gradient(90deg, var(--color-danger), #fca5a5); }

/* ===== INVITE CODE CARD ===== */
.invite-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  transition: var(--ease);
}
.invite-card:hover { border-color: var(--color-primary); }
.invite-card.used     { opacity: 0.55; }
.invite-card.expired  { opacity: 0.45; }
.invite-code-str {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text);
}
.invite-status { flex-shrink: 0; }

/* ===== NOTIFICATION BELL ===== */
.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--ease);
  text-decoration: none;
}
.notif-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ===== PROFILE DROPDOWN ===== */
.profile-menu {
  position: relative;
}
.profile-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: var(--ease);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text);
}
.profile-trigger:hover { border-color: var(--color-primary); }
.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.profile-menu.open .profile-dropdown { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.65rem var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text);
  cursor: pointer;
  transition: var(--ease);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--bg-alt); color: var(--color-primary); text-decoration: none; }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-item.danger:hover { background: var(--color-danger-light); }
.dropdown-divider { border-top: 1px solid var(--border); margin: var(--sp-1) 0; }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--sp-3);
  gap: var(--sp-2);
  transition: var(--ease);
}
.search-bar:focus-within { border-color: var(--color-primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb),0.1); }
.search-bar svg { color: var(--text-subtle); width: 16px; height: 16px; flex-shrink: 0; }
.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-size: var(--text-sm);
  color: var(--text);
  width: 100%;
  padding: 0.6rem 0;
  box-shadow: none;
}

/* ===== FILTER TAGS ===== */
.filter-tags {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid rgba(var(--color-primary-rgb),0.2);
}
.filter-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
}

/* ===== RISK STUDENT CARD ===== */
.risk-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--color-danger);
  transition: var(--ease);
}
.risk-card:hover { box-shadow: var(--shadow-sm); }
.risk-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-danger-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-danger-dark);
  flex-shrink: 0;
}
.risk-info { flex: 1; min-width: 0; }
.risk-name  { font-size: var(--text-sm); font-weight: 600; }
.risk-score { font-size: var(--text-xs); color: var(--text-muted); }
.risk-score strong { color: var(--color-danger); }

/* ===== QUESTION REVIEW ACCORDION ===== */
.review-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.review-item.correct { border-left: 3px solid var(--color-success); }
.review-item.wrong   { border-left: 3px solid var(--color-danger); }
.review-item.empty   { border-left: 3px solid var(--text-subtle); }
.review-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  text-align: left;
  color: var(--text);
  transition: var(--ease);
}
.review-toggle:hover { background: var(--bg-alt); }
.review-q-num { font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.review-q-text { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-status { flex-shrink: 0; }
.review-chevron { flex-shrink: 0; transition: transform var(--ease); color: var(--text-subtle); }
.review-item.open .review-chevron { transform: rotate(180deg); }
.review-body {
  display: none;
  padding: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-alt);
}
.review-item.open .review-body { display: block; }

/* ===== SCORE DISTRIBUTION CHART ===== */
.dist-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-1);
  height: 80px;
  padding: var(--sp-2) 0;
}
.dist-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.dist-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--color-primary-light);
  transition: height 0.6s ease;
  min-height: 4px;
}
.dist-bar.active { background: var(--color-primary); }
.dist-label { font-size: 0.65rem; color: var(--text-subtle); }

/* ===== ASSIGNMENT COMPLETION RING ===== */
.completion-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}
.completion-ring svg { position: absolute; top:0; left:0; transform: rotate(-90deg); }
.completion-track { fill:none; stroke: var(--border); stroke-width: 4; }
.completion-fill  { fill:none; stroke: var(--color-primary); stroke-width:4; stroke-linecap:round; transition: stroke-dashoffset 0.8s ease; }
.completion-pct { font-size: var(--text-xs); font-weight: 800; }

/* ===== WHATSAPP SHARE ===== */
.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: #25d366;
  color: #fff;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: var(--ease);
}
.wa-btn:hover { background: #128c7e; text-decoration: none; }

/* ===== DEMO LOGIN CARDS (local only) ===== */
.demo-cards {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px dashed var(--border);
}
.demo-cards-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-subtle);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-3);
}
.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}
.demo-role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-2);
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: var(--ease);
  text-align: center;
}
.demo-role-btn:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.demo-role-icon { font-size: 1.3rem; }
.demo-role-name { font-size: var(--text-xs); font-weight: 700; color: var(--text); }
.demo-role-email { font-size: 0.65rem; color: var(--text-subtle); }

/* ===== SYSTEM STATUS INDICATORS ===== */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--color-success); box-shadow: 0 0 0 2px rgba(34,197,94,0.25); }
.status-dot.offline { background: var(--color-danger); }
.status-dot.warning { background: var(--color-warning); }
.status-dot.unknown { background: var(--text-subtle); }

/* ===== EXAM BUILDER LAYOUT ===== */
.builder-layout {
  display: flex;
  gap: var(--sp-6);
  align-items: flex-start;
}
.builder-summary {
  flex: 0 0 260px;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  position: sticky;
  top: 80px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-muted);
  gap: var(--sp-2);
}
.summary-row:last-of-type { border-bottom: none; }
.summary-row .font-bold { color: var(--text); text-align: right; }
.summary-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
  text-align: center;
  padding-top: var(--sp-3);
}
@media (max-width: 768px) {
  .builder-layout { flex-direction: column; }
  .builder-summary { flex: none; width: 100%; position: static; }
}

/* ===== TIER BADGE ===== */
.tier-free { background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border); }
.tier-standard { background: var(--color-secondary-light); color: var(--color-secondary-hover); }
.tier-premium  { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.tier-custom   { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* ===== RESPONSIVE HELPERS ===== */
@media (max-width: 768px) {
  .toast-container { bottom: var(--sp-4); right: var(--sp-4); left: var(--sp-4); max-width: none; }
  .demo-grid { grid-template-columns: 1fr; }
  .completion-ring { width: 36px; height: 36px; }
}
