/* ============================================================
   avcc-styles.css — Shared stylesheet for all AVCC pages
   ============================================================ */

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

:root {
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Georgia', 'Times New Roman', serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  --blue-50:  #eff6ff; --blue-100: #dbeafe; --blue-200: #bfdbfe;
  --blue-400: #60a5fa; --blue-600: #2563eb; --blue-700: #1d4ed8;
  --blue-800: #1e40af; --blue-900: #1e3a8a;
  --gray-50:  #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-300: #d1d5db; --gray-400: #9ca3af; --gray-500: #6b7280;
  --gray-600: #4b5563; --gray-700: #374151; --gray-800: #1f2937;
  --gray-900: #111827;
  --green-50: #f0fdf4; --green-100: #dcfce7; --green-600: #16a34a; --green-700: #15803d;
  --red-50:   #fef2f2; --red-100:   #fee2e2; --red-600:   #dc2626; --red-700:   #b91c1c;
  --yellow-50:#fefce8; --yellow-100:#fef9c3; --yellow-600:#ca8a04; --yellow-700:#a16207;
  --orange-600: #ea580c;
  --white: #ffffff;

  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --sidebar-w: 220px;
  --header-h:  56px;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
}

/* ── LAYOUT ───────────────────────────────────────────────── */
.avcc-app { display: flex; min-height: 100vh; }

.avcc-sidebar {
  width: var(--sidebar-w);
  background: var(--blue-900);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.avcc-sidebar-logo {
  padding: 14px 16px 12px;
  border-bottom: 3px solid var(--blue-900);
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
}

.avcc-sidebar-logo img { display: block; height: 120px; width: auto; max-width: 200px; }
.avcc-sidebar-logo a { text-decoration: none; }
.product-name {
  font-size: 13px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.avcc-sidebar-logo .org-name {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avcc-nav { padding: 12px 0; flex: 1; }

.avcc-nav-section {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 14px 5px 18px;
  margin-top: 2px;
  user-select: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.avcc-nav-section:hover {
  color: rgba(255,255,255,.95);
}
.avcc-nav-section .nav-chevron {
  font-size: 9px;
  opacity: .5;
  flex-shrink: 0;
  transition: transform 0.2s;
  font-style: normal;
}
.avcc-nav-group {
  overflow: hidden;
  transition: max-height 0.22s ease;
}
.avcc-nav-group .avcc-nav-link {
  padding-left: 28px;
  font-size: 12px;
}

.avcc-nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.avcc-nav-link:hover { background: rgba(255,255,255,.08); color: white; }
.avcc-nav-link.active { background: rgba(255,255,255,.12); color: white; border-left-color: var(--blue-400); }
.avcc-nav-link .nav-icon { font-size: 15px; flex-shrink: 0; }

/* ── NAV ACCORDION GROUPS ─────────────────────── */
.avcc-nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  color: rgba(255,255,255,.82);
  font-size: 13px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  user-select: none;
}
.avcc-nav-group-toggle:hover { background: rgba(255,255,255,.08); color: white; }
.avcc-nav-group-toggle .nav-icon { font-size: 14px; }
.avcc-nav-group-chevron {
  font-size: 9px;
  opacity: .5;
  transition: transform 0.2s;
  margin-left: auto;
  padding-left: 4px;
}
.avcc-nav-group-toggle.open .avcc-nav-group-chevron { transform: rotate(90deg); }

.avcc-nav-group-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}
.avcc-nav-group-items.open { max-height: 600px; }
.avcc-nav-group-items .avcc-nav-link {
  padding-left: 38px;
  font-size: 12px;
}

/* Search bar in nav */
#avcc-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 10px 2px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  padding: 7px 10px;
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
}
#avcc-search-bar:hover { background: rgba(255,255,255,.18); }

/* ── USER PROFILE IN SIDEBAR FOOTER ─────────────────────── */
.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background .15s;
  margin-bottom: 8px;
}
.sidebar-user-btn:hover { background: rgba(255,255,255,.15); }
.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-600);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; text-align: left; }
.sidebar-user-name  { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role  { font-size: 10px; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .04em; }
.sidebar-signout { font-size: 11px; color: rgba(255,255,255,.35); text-decoration: none; display: block; text-align: center; }
.sidebar-signout:hover { color: rgba(255,255,255,.6); }

.avcc-sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: rgba(255,255,255,.45);
}

.avcc-sidebar-footer a { color: rgba(255,255,255,.6); text-decoration: none; }
.avcc-sidebar-footer a:hover { color: white; }

.avcc-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.avcc-topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.avcc-topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
}

.avcc-content { padding: 24px; max-width: 1280px; }

/* ── CARDS ────────────────────────────────────────────────── */
.avcc-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.avcc-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.avcc-card-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 16px;
}

/* ── STAT CARDS ───────────────────────────────────────────── */
.avcc-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.avcc-stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.avcc-stat-label { font-size: 11px; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.avcc-stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.avcc-stat-sub   { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.avcc-stat-card.blue  .avcc-stat-value { color: var(--blue-600); }
.avcc-stat-card.green .avcc-stat-value { color: var(--green-600); }
.avcc-stat-card.red   .avcc-stat-value { color: var(--red-600); }
.avcc-stat-card.yellow .avcc-stat-value { color: var(--yellow-600); }

/* ── HEALTH INDEX ─────────────────────────────────────────── */
.avcc-health-hero {
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  color: white;
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.avcc-score-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 3px solid rgba(255,255,255,.3);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}

.avcc-score-number { font-size: 32px; font-weight: 700; line-height: 1; }
.avcc-score-denom  { font-size: 12px; opacity: 0.6; }

.avcc-score-breakdown { flex: 1; min-width: 280px; }
.avcc-score-breakdown-title { font-size: 12px; opacity: 0.6; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.avcc-score-bars { display: flex; flex-direction: column; gap: 7px; }

.avcc-score-bar-row { display: flex; align-items: center; gap: 10px; }
.avcc-score-bar-label { font-size: 12px; opacity: 0.85; width: 160px; flex-shrink: 0; }
.avcc-score-bar-track { flex: 1; height: 6px; background: rgba(255,255,255,.2); border-radius: 3px; overflow: hidden; }
.avcc-score-bar-fill  { height: 100%; border-radius: 3px; background: white; transition: width 0.6s ease; }
.avcc-score-bar-val   { font-size: 12px; opacity: 0.85; width: 28px; text-align: right; }

/* ── TABLES ───────────────────────────────────────────────── */
.avcc-table-wrap { overflow-x: auto; }

.avcc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.avcc-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}

.avcc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

.avcc-table tr:hover td { background: var(--gray-50); }
.avcc-table tr:last-child td { border-bottom: none; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-green  { background: var(--green-100); color: var(--green-700); }
.badge-red    { background: var(--red-100);   color: var(--red-700);   }
.badge-yellow { background: var(--yellow-100); color: var(--yellow-700); }
.badge-blue   { background: var(--blue-100);  color: var(--blue-700);  }
.badge-gray   { background: var(--gray-100);  color: var(--gray-600);  }
.badge-orange { background: #ffedd5;           color: var(--orange-600);}

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  border: none; cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary   { background: var(--blue-600); color: white; }
.btn-primary:hover { background: var(--blue-700); }
.btn-secondary { background: white; color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger    { background: var(--red-600); color: white; }
.btn-danger:hover { background: var(--red-700); }
.btn-ghost     { background: transparent; color: var(--gray-600); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm        { padding: 5px 10px; font-size: 12px; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; }

/* ── FORMS ────────────────────────────────────────────────── */
.avcc-field { margin-bottom: 16px; }
.avcc-label { display: block; font-size: 12px; font-weight: 500; color: var(--gray-700); margin-bottom: 5px; }
.avcc-label .req { color: var(--red-600); margin-left: 2px; }

.avcc-input, .avcc-select, .avcc-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--gray-800);
  background: white;
  transition: border-color 0.15s;
}

.avcc-input:focus, .avcc-select:focus, .avcc-textarea:focus {
  outline: none;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(96,165,250,.15);
}

.avcc-textarea { resize: vertical; min-height: 100px; }
.avcc-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.avcc-form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── GRID LAYOUTS ─────────────────────────────────────────── */
.avcc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.avcc-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.avcc-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── SECTION HEADER ───────────────────────────────────────── */
.avcc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.avcc-section-title { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.avcc-section-sub   { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ── MODAL ────────────────────────────────────────────────── */
.avcc-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.avcc-modal-overlay.open { display: flex; }

.avcc-modal-box {
  background: white;
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.avcc-modal-title { font-size: 17px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.avcc-modal-sub   { font-size: 13px; color: var(--gray-500); margin-bottom: 20px; }
.avcc-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--gray-100); }

/* ── TOAST ────────────────────────────────────────────────── */
.avcc-toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.25s;
  z-index: 999;
  max-width: 360px;
}

.avcc-toast.show { transform: translateY(0); opacity: 1; }
.avcc-toast-success { background: var(--green-600); color: white; }
.avcc-toast-error   { background: var(--red-600);   color: white; }
.avcc-toast-info    { background: var(--blue-600);  color: white; }

/* ── LOADING / EMPTY STATES ───────────────────────────────── */
.avcc-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 40px; color: var(--gray-500);
}

.avcc-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: avcc-spin 0.7s linear infinite;
}

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

.avcc-empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--gray-400); font-size: 13px;
}

.avcc-empty-state > div:first-child { font-size: 28px; margin-bottom: 8px; }

.avcc-error-state {
  padding: 20px; color: var(--red-600);
  background: var(--red-50); border-radius: var(--radius-md);
  font-size: 13px; text-align: center;
}

/* ── DELIVERABLE PRINT STYLES ─────────────────────────────── */
@media print {
  .avcc-sidebar, .avcc-topbar, .no-print { display: none !important; }
  .avcc-main { margin-left: 0; }
  .avcc-content { padding: 0; max-width: none; }
  .avcc-card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  body { font-size: 11px; }
  .avcc-table th, .avcc-table td { padding: 6px 8px; }
  .deliverable-header { margin-bottom: 24px; border-bottom: 2px solid var(--blue-600); padding-bottom: 12px; }
}

/* ── RISK / PRIORITY INDICATORS ───────────────────────────── */
.priority-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.priority-1 { background: var(--red-600); }
.priority-2 { background: var(--orange-600); }
.priority-3 { background: var(--yellow-600); }
.priority-4 { background: var(--blue-400); }
.priority-5 { background: var(--gray-400); }

/* ── SCORE BANDS ──────────────────────────────────────────── */
.score-band-advanced     { color: #065f46; }
.score-band-scaling      { color: var(--green-600); }
.score-band-operationalizing { color: var(--blue-600); }
.score-band-emerging     { color: var(--yellow-600); }
.score-band-fragmented   { color: var(--red-600); }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .avcc-sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .avcc-sidebar.open { transform: translateX(0); }
  .avcc-main { margin-left: 0; }
  .avcc-grid-2, .avcc-grid-3, .avcc-grid-4 { grid-template-columns: 1fr; }
  .avcc-form-row, .avcc-form-row-3 { grid-template-columns: 1fr; }
}

/* ── LOGIN PAGE ───────────────────────────────────────────── */
.avcc-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
  padding: 20px;
}

.avcc-login-box {
  background: white;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.avcc-login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.avcc-login-logo .product-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-800);
}

.avcc-login-logo .product-sub {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 3px;
}

.avcc-login-error {
  background: var(--red-50);
  border: 1px solid var(--red-100);
  color: var(--red-700);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
