/* Dashboard App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--cyan);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-img {
  height: 30px;
  width: auto;
  display: block;
  /* Invert dark logo for dark sidebar background */
  filter: invert(1) brightness(1.1);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.sidebar-link:hover { background: var(--bg-card); color: var(--fg); }
.sidebar-link.active { background: var(--cyan-dim); color: var(--cyan); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cyan-dim);
  color: var(--cyan);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.btn-logout {
  width: 100%;
  padding: 0.55rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 2.5rem;
  max-width: 1100px;
}

.notice {
  padding: 0.9rem 1.2rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.notice-success { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.2); color: var(--green); }
.notice-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: var(--blue); }

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.content-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.content-sub { font-size: 0.85rem; color: var(--fg-muted); }

.btn-generate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  background: var(--cyan);
  color: #0a0e17;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-generate:hover { opacity: 0.9; }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-upgrade {
  padding: 0.7rem 1.3rem;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #0a0e17;
  border-radius: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
}

/* SCORE HERO */
.score-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  display: flex;
  align-items: center;
  gap: 3rem;
  margin-bottom: 2rem;
  box-shadow: var(--glow);
}

.score-hero-ring {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.score-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.1);
  stroke-width: 8;
}

.score-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  transition: stroke-dashoffset 1s ease;
  filter: drop-shadow(0 0 8px currentColor);
}

.score-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-num {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
}

.score-lbl {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin-top: 0.3rem;
}

.score-hero-info { flex: 1; }

.score-status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 0.3rem 0.9rem;
  border-radius: 100px;
  margin-bottom: 1rem;
}

.score-status-score-low { background: rgba(52,211,153,0.15); color: var(--green); border: 1px solid rgba(52,211,153,0.2); }
.score-status-score-medium { background: rgba(251,191,36,0.15); color: var(--yellow); border: 1px solid rgba(251,191,36,0.2); }
.score-status-score-high { background: rgba(248,113,113,0.15); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }

.score-summary {
  font-size: 0.95rem;
  color: var(--fg-dim);
  line-height: 1.6;
  margin-bottom: 1.2rem;
}

.score-metrics {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.metric-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  text-align: center;
  min-width: 80px;
}

.metric-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cyan);
}

.metric-lbl {
  display: block;
  font-size: 0.72rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
}

.report-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: rgba(34,211,238,0.3); color: var(--cyan); }

.score-empty { color: var(--fg-dim); }
.score-empty p { margin-bottom: 0.5rem; }
.score-empty-sub { font-size: 0.88rem; color: var(--fg-muted); }
.btn-primary-sm {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.65rem 1.2rem;
  background: var(--cyan);
  color: #0a0e17;
  border-radius: 9px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
}

/* UPSELL BANNER */
.upsell-banner {
  background: linear-gradient(135deg, rgba(34,211,238,0.06), rgba(59,130,246,0.06));
  border: 1px solid rgba(34,211,238,0.15);
  border-radius: 16px;
  padding: 1.8rem 2rem;
  margin-bottom: 2rem;
}

.upsell-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.upsell-icon { font-size: 2rem; }
.upsell-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; margin-bottom: 0.3rem; }
.upsell-desc { font-size: 0.88rem; color: var(--fg-dim); }

.btn-upgrade-lg {
  margin-left: auto;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #0a0e17;
  border-radius: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* SECTION TITLE */
.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  margin-top: 2rem;
  color: var(--fg);
}

/* CATEGORIES */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
}

.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.cat-name {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
}

.cat-status {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.cat-good { background: rgba(52,211,153,0.15); color: var(--green); }
.cat-warn { background: rgba(251,191,36,0.15); color: var(--yellow); }
.cat-bad { background: rgba(248,113,113,0.15); color: var(--red); }
.cat-detail { font-size: 0.82rem; color: var(--fg-muted); }

/* RECOMMENDATIONS */
.recs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.rec-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  font-size: 0.9rem;
}

.rec-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.rec-high .rec-badge { background: rgba(248,113,113,0.15); color: var(--red); }
.rec-medium .rec-badge { background: rgba(251,191,36,0.15); color: var(--yellow); }
.rec-low .rec-badge { background: rgba(52,211,153,0.15); color: var(--green); }
.rec-text { color: var(--fg-dim); }

/* HISTORY TABLE */
.history-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.history-table table { width: 100%; border-collapse: collapse; }
.history-table th {
  text-align: left;
  padding: 0.85rem 1.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.history-table td {
  padding: 0.85rem 1.2rem;
  font-size: 0.88rem;
  color: var(--fg-dim);
  border-bottom: 1px solid rgba(148,163,184,0.05);
}
.history-table tr:last-child td { border-bottom: none; }

.score-pill {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
}
.score-green { background: rgba(52,211,153,0.15); color: var(--green); }
.score-yellow { background: rgba(251,191,36,0.15); color: var(--yellow); }
.score-red { background: rgba(248,113,113,0.15); color: var(--red); }

.link-view { color: var(--cyan); text-decoration: none; font-size: 0.82rem; }
.link-view:hover { text-decoration: underline; }

/* PROFILE CARD */
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.profile-desc {
  font-size: 0.9rem;
  color: var(--fg-dim);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

.form-group { display: flex; flex-direction: column; }
.form-label { font-size: 0.82rem; font-weight: 500; color: var(--fg-dim); margin-bottom: 0.5rem; }
.form-textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.88rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.form-textarea:focus { border-color: rgba(34,211,238,0.35); }
.form-hint { font-size: 0.75rem; color: var(--fg-muted); margin-top: 0.35rem; }

.btn-save {
  padding: 0.65rem 1.4rem;
  background: var(--cyan);
  color: #0a0e17;
  border: none;
  border-radius: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-save:hover { opacity: 0.9; }
.btn-save:disabled { opacity: 0.5; }
.save-status { margin-left: 0.75rem; font-size: 0.85rem; }

/* SCAN OVERLAY */
.scan-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.scan-modal {
  background: var(--bg-card);
  border: 1px solid rgba(34,211,238,0.2);
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
  max-width: 400px;
  box-shadow: var(--glow);
}

.scan-icon {
  margin-bottom: 1.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.95); }
}

.scan-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--cyan);
}

.scan-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
}

.scan-step {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--fg-muted);
  background: var(--bg-elevated);
  transition: color 0.3s, background 0.3s;
}

.scan-step.active {
  color: var(--green);
  background: rgba(52,211,153,0.08);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 1.5rem; }
  .score-hero { flex-direction: column; gap: 1.5rem; align-items: flex-start; }
  .categories-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .history-table { overflow-x: auto; }
  .upsell-content { flex-direction: column; }
  .btn-upgrade-lg { margin-left: 0; }
  .report-actions { flex-wrap: wrap; }
}
