/* =========================================================
   qiboo.ai — Dashboard Styles
   User-specific dashboard components
   ========================================================= */

/* =========================================================
   USER AVATAR & DROPDOWN
   ========================================================= */
.nav__user-menu {
  position: relative;
}

.nav__user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gfill-2), var(--gfill-3));
  color: white;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 2px solid var(--primary-pale);
  transition: all .2s ease;
}

.nav__user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 4px rgba(74, 124, 47, 0.12);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 280px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all .2s ease;
  z-index: 1000;
}

.user-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown__header {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--slate-50);
  border-radius: var(--r-md);
  margin-bottom: 8px;
}

.user-dropdown__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gfill-2), var(--gfill-3));
  color: white;
  font-size: 18px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-dropdown__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 4px;
}

.user-dropdown__email {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 2px;
}

.user-dropdown__divider {
  height: 1px;
  background: var(--slate-200);
  margin: 8px 0;
}

.user-dropdown__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--ink-soft);
  transition: background .15s ease;
  cursor: pointer;
}

.user-dropdown__item:hover {
  background: var(--slate-50);
  color: var(--primary-dark);
}

.user-dropdown__item svg {
  color: var(--slate-400);
  flex-shrink: 0;
}

.user-dropdown__item:hover svg {
  color: var(--primary-dark);
}

.user-dropdown__item--danger {
  color: var(--error);
}

.user-dropdown__item--danger:hover {
  background: rgba(198, 40, 40, 0.06);
  color: var(--error);
}

.user-dropdown__item--danger svg {
  color: var(--error);
}

/* =========================================================
   DASHBOARD HERO
   ========================================================= */
.dashboard-hero {
  background: linear-gradient(180deg, var(--sage) 0%, var(--cream) 100%);
  padding-block: clamp(48px, 6vw, 80px);
  border-bottom: 1px solid var(--slate-200);
}

.dashboard-hero__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-8);
  align-items: center;
}

.dashboard-hero__greeting {
  font-size: 15px;
  color: var(--slate-500);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-hero__greeting strong {
  color: var(--primary-darker);
  font-weight: 600;
}

.dashboard-hero__time {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--r-pill);
  border: 1px solid var(--slate-200);
}

.dashboard-hero h1 {
  font-size: clamp(32px, 4vw, 48px);
  margin-bottom: 16px;
  color: var(--ink);
}

.dashboard-hero__subtitle {
  font-size: 16px;
  color: var(--slate-700);
  max-width: 60ch;
  line-height: 1.6;
}

.dashboard-hero__subtitle strong {
  color: var(--primary-dark);
  font-weight: 600;
}

.dashboard-stats-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--slate-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--slate-200);
}

.stat-mini {
  background: var(--white);
  padding: 20px;
  text-align: center;
}

.stat-mini__value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  color: var(--primary-darker);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-mini__label {
  font-size: 12px;
  color: var(--slate-500);
  letter-spacing: 0.02em;
}

/* =========================================================
   QUICK ACTIONS
   ========================================================= */
.section--compact {
  padding-block: clamp(32px, 4vw, 48px);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.quick-action-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: all .2s ease;
  cursor: pointer;
  position: relative;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.quick-action-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  transition: transform .25s ease;
}

.quick-action-card:hover .quick-action-card__icon {
  transform: scale(1.05);
}

.quick-action-card__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.quick-action-card__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--gfill-1);
  color: white;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-pill);
}

/* =========================================================
   TOPIC CARDS
   ========================================================= */
.topic-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-5);
}

.topic-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all .25s ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.topic-card__header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.topic-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.topic-card__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.topic-card__count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-pale);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.topic-card__preview {
  font-size: 14px;
  line-height: 1.5;
  color: var(--slate-700);
  border-left: 2px solid var(--slate-200);
  padding-left: 14px;
}

.topic-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--slate-500);
  padding-top: 12px;
  border-top: 1px solid var(--slate-100);
}

.topic-card__link {
  color: var(--primary-dark);
  font-weight: 500;
  transition: color .15s ease;
}

.topic-card__link:hover {
  color: var(--primary-darker);
}

/* =========================================================
   ARTICLE MATCH BADGE
   ========================================================= */
.article-card__match {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--gfill-g), var(--gfill-gd));
  color: var(--primary-darker);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* =========================================================
   SAVED LIST
   ========================================================= */
.saved-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.saved-item {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  padding: 20px;
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 20px;
  align-items: center;
  transition: all .2s ease;
}

.saved-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.saved-item__img {
  width: 120px;
  height: 80px;
  border-radius: var(--r-md);
  background-size: cover;
  background-position: center;
}

.saved-item__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-item__meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.saved-item__title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.saved-item__footer {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.saved-item__date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate-500);
  letter-spacing: 0.04em;
}

.saved-item__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  background: var(--slate-100);
  color: var(--slate-600);
  border-radius: var(--r-sm);
  letter-spacing: 0.04em;
}

.saved-item__actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--slate-100);
  color: var(--slate-500);
  display: grid;
  place-items: center;
  transition: all .15s ease;
}

.icon-btn:hover {
  background: var(--gfill-1);
  color: white;
}

/* =========================================================
   ACTIVITY CARDS
   ========================================================= */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
}

.activity-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all .25s ease;
}

.activity-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.activity-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary-pale);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.activity-card__value {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 500;
  color: var(--primary-darker);
  line-height: 1;
  letter-spacing: -0.02em;
}

.activity-card__label {
  font-size: 14px;
  color: var(--slate-600);
  line-height: 1.4;
}

.activity-card__change {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  width: max-content;
  margin-top: 4px;
}

.activity-card__change.positive {
  background: rgba(46, 125, 50, 0.08);
  color: var(--success);
}

.activity-card__change.neutral {
  background: var(--slate-100);
  color: var(--slate-600);
}

/* =========================================================
   PROFESSIONAL TOOLS GRID
   ========================================================= */
.pro-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--space-5);
}

.pro-tool-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: all .3s ease;
  position: relative;
  overflow: hidden;
}

.pro-tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.pro-tool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gfill-2), var(--primary-light));
  opacity: 0;
  transition: opacity .3s ease;
}

.pro-tool-card:hover::before {
  opacity: 1;
}

.pro-tool-card__header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}

.pro-tool-card__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.pro-tool-card__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.pro-tool-card__subtitle {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 2px;
}

.notification-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(198, 40, 40, 0.3);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.beta-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #6a1b9a, #9c27b0);
  color: white;
  box-shadow: 0 2px 8px rgba(106, 27, 154, 0.3);
}

/* Tool Stats */
.pro-tool-card__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 16px;
  background: var(--slate-50);
  border-radius: var(--r-md);
}

.mini-stat {
  text-align: center;
}

.mini-stat__value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--primary-darker);
  line-height: 1;
  display: block;
  margin-bottom: 4px;
}

.mini-stat__label {
  font-size: 11px;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Tool Buttons */
.pro-tool-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-btn {
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--slate-100);
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.tool-btn:hover {
  background: var(--slate-200);
  transform: translateY(-1px);
}

.tool-btn--primary {
  background: var(--gfill-1);
  color: white;
}

.tool-btn--primary:hover {
  background: var(--gfill-2);
  box-shadow: 0 4px 12px rgba(74, 124, 47, 0.3);
}

.tool-btn--block {
  width: 100%;
  justify-content: center;
}

/* Format Tags */
.pro-tool-card__formats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--slate-100);
}

.format-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 10px;
  background: var(--slate-100);
  color: var(--slate-600);
  border-radius: var(--r-sm);
  letter-spacing: 0.04em;
  font-weight: 500;
}

/* Alert List */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 12px;
  background: var(--slate-50);
  border-radius: var(--r-md);
  border-left: 3px solid var(--accent);
  transition: all .2s ease;
  cursor: pointer;
}

.alert-item:hover {
  background: var(--slate-100);
  transform: translateX(4px);
}

.alert-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.2);
  animation: pulse-dot 2s ease-in-out infinite;
}

.alert-item__dot.inactive {
  background: var(--slate-300);
  box-shadow: none;
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(198, 40, 40, 0.1); }
}

.alert-item__content {
  flex: 1;
}

.alert-item__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}

.alert-item__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 2px;
}

/* Notes Preview */
.notes-preview {
  background: var(--slate-50);
  border-radius: var(--r-md);
  padding: 16px;
  border-left: 3px solid var(--secondary);
}

.note-snippet__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.note-snippet__text {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--slate-700);
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-snippet__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate-500);
}

/* CME Progress */
.cme-progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cme-progress__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cme-progress__label {
  font-size: 13px;
  color: var(--slate-600);
  font-weight: 500;
}

.cme-progress__value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-darker);
}

.progress-bar {
  height: 12px;
  background: var(--slate-100);
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gfill-gd), var(--gfill-g));
  border-radius: var(--r-pill);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.cme-progress__footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cme-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  font-weight: 500;
}

.cme-tag--complete {
  background: rgba(46, 125, 50, 0.1);
  color: var(--success);
}

.cme-tag--progress {
  background: rgba(212, 175, 55, 0.15);
  color: var(--secondary-dark);
}

/* AI Features */
.pro-tool-card--ai {
  background: linear-gradient(135deg, rgba(106, 27, 154, 0.02) 0%, rgba(156, 39, 176, 0.02) 100%);
  border-color: rgba(106, 27, 154, 0.2);
}

.ai-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--slate-700);
  padding: 8px 12px;
  background: var(--white);
  border-radius: var(--r-md);
  border: 1px solid var(--slate-100);
}

.ai-feature svg {
  color: var(--success);
  flex-shrink: 0;
}

/* Protocol List */
.protocol-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.protocol-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--slate-50);
  border-radius: var(--r-md);
  border: 1px solid var(--slate-100);
  transition: all .2s ease;
  cursor: pointer;
}

.protocol-item:hover {
  background: var(--slate-100);
  transform: translateX(4px);
}

.protocol-item__icon {
  font-size: 22px;
}

.protocol-item__content {
  flex: 1;
}

.protocol-item__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

.protocol-item__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 2px;
}

/* Export Options */
.export-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.export-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .2s ease;
}

.export-btn:hover {
  background: var(--primary-pale);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.export-btn svg {
  color: var(--slate-500);
}

.export-btn:hover svg {
  color: var(--primary-dark);
}

.export-btn span {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.export-recent {
  padding-top: 12px;
  border-top: 1px solid var(--slate-100);
  font-size: 12px;
}

.export-recent__label {
  color: var(--slate-500);
}

.export-recent__value {
  color: var(--ink-soft);
  font-weight: 500;
  margin-left: 6px;
}

/* =========================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================= */
@media (max-width: 1100px) {
  .dashboard-hero__inner {
    grid-template-columns: 1fr;
  }

  .dashboard-stats-mini {
    max-width: 520px;
  }

  .topic-cards {
    grid-template-columns: 1fr;
  }

  .pro-tools-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  .saved-item {
    grid-template-columns: 100px 1fr;
  }

  .saved-item__actions {
    grid-column: 2;
    justify-self: end;
  }
}

@media (max-width: 640px) {
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-stats-mini {
    grid-template-columns: 1fr;
  }

  .saved-item {
    grid-template-columns: 1fr;
  }

  .saved-item__img {
    width: 100%;
    height: 140px;
  }

  .saved-item__actions {
    justify-self: start;
  }

  .activity-grid {
    grid-template-columns: 1fr;
  }
}
