/* ComplAI Demo Mock-up - Design System */
/* Color scheme: Gold, Silver, Gray (matching demo.complai.us) */
:root {
  /* Gold - primary accent */
  --gold-light: #FFE55C;
  --gold: #FFD700;
  --gold-dark: #C9A227;
  --gold-deep: #B8860B;
  --accent-gradient: linear-gradient(90deg, #FFE55C 0%, #FFD700 50%, #B8860B 100%);
  /* Silver - secondary elements, icons, borders */
  --silver-light: #E8E8E8;
  --silver: #C0C0C0;
  --silver-muted: #A0A0A0;
  /* Gray - backgrounds */
  --gray-darkest: #0a0a0a;
  --gray-dark: #141414;
  --gray-card: #1e1e1e;
  --gray-elevated: #252525;
  --gray-input: #171717;
  /* Semantic */
  --bg-dark: var(--gray-darkest);
  --bg-card: var(--gray-card);
  --bg-input: var(--gray-input);
  --border-subtle: rgba(192, 192, 192, 0.15);
  --border-silver: rgba(192, 192, 192, 0.2);
  --text-primary: #ffffff;
  --text-secondary: var(--silver-muted);
  --text-muted: #707070;
  --text-bright: #ffffff;
  --text-soft: #e0e0e0;
  --text-dim: #d0d0d0;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-glow: 0 0 60px rgba(255, 215, 0, 0.06);
  --shadow-card: none;
  --overlay-hover: rgba(255, 255, 255, 0.05);
  --overlay-gold: rgba(255, 215, 0, 0.08);
  --overlay-gold-strong: rgba(255, 215, 0, 0.12);
  --bar-fill-silver: linear-gradient(90deg, #707070 0%, var(--silver) 100%);
  --bar-fill-low: linear-gradient(90deg, #4A4A4A 0%, #808080 100%);
  --tooltip-bg: #1a1a1a;
  --tooltip-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  --focus-ring: rgba(255, 215, 0, 0.4);
  --btn-text: #1a1a1a;
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
  --gold-light: #FFE55C;
  --gold: #B8960B;
  --gold-dark: #9A7B00;
  --gold-deep: #7A6200;
  --accent-gradient: linear-gradient(90deg, #C9A227 0%, #B8860B 50%, #7A6200 100%);
  --silver-light: #666666;
  --silver: #555555;
  --silver-muted: #666666;
  --gray-darkest: #f4f5f7;
  --gray-dark: #ebedf0;
  --gray-card: #ffffff;
  --gray-elevated: #f8f9fa;
  --gray-input: #f0f1f3;
  --bg-dark: var(--gray-darkest);
  --bg-card: var(--gray-card);
  --bg-input: var(--gray-input);
  --border-subtle: rgba(0, 0, 0, 0.1);
  --border-silver: rgba(0, 0, 0, 0.12);
  --text-primary: #1a1a2e;
  --text-secondary: #555566;
  --text-muted: #888899;
  --text-bright: #1a1a2e;
  --text-soft: #333344;
  --text-dim: #555566;
  --shadow-glow: none;
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.08), 0 2px 12px rgba(0, 0, 0, 0.04);
  --overlay-hover: rgba(0, 0, 0, 0.04);
  --overlay-gold: rgba(184, 150, 11, 0.08);
  --overlay-gold-strong: rgba(184, 150, 11, 0.12);
  --bar-fill-silver: linear-gradient(90deg, #999999 0%, #777777 100%);
  --bar-fill-low: linear-gradient(90deg, #bbbbbb 0%, #999999 100%);
  --tooltip-bg: #ffffff;
  --tooltip-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  --focus-ring: rgba(184, 150, 11, 0.5);
  --btn-text: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Subtle background texture */
.login-page,
.dashboard-page {
  min-height: 100vh;
  background: 
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 215, 0, 0.03) 0%, transparent 50%),
    var(--bg-dark);
}

/* ========== LOGIN PAGE ========== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 3rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-glow);
  border: 1px solid var(--border-subtle);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 2rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
}

.logo-img {
  height: 40px;
  width: auto;
  display: block;
}

.logo-text {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 2rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-group input {
  width: 100%;
  padding: 14px 18px 14px 48px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group input:focus {
  outline: none;
  border-color: var(--focus-ring);
}

.input-group .toggle-password {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
}

.input-group .toggle-password:hover {
  color: var(--text-secondary);
}

.eye-icon {
  width: 20px;
  height: 20px;
}

.login-error {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #ff6b7a;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  text-align: center;
}

.sign-in-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.sign-in-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius);
  color: var(--btn-text);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: 0.5rem;
}

.sign-in-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.sign-in-btn:active {
  transform: translateY(0);
}

.copyright {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2rem;
}

/* ========== DASHBOARD PAGE ========== */
.dashboard-layout {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-subtle);
  padding: 1.5rem 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}

.sidebar .logo {
  justify-content: flex-start;
  margin-bottom: 0;
}

.sidebar .logo-text {
  font-size: 1.35rem;
}

.sidebar .logo-img {
  height: 32px;
}

.nav-menu {
  list-style: none;
}

.nav-item {
  margin: 0.25rem 0.75rem;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text-soft);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: all 0.2s;
}

.nav-item a:hover {
  color: var(--text-primary);
  background: var(--overlay-hover);
}

.nav-item a.active {
  color: var(--gold);
  background: var(--overlay-gold);
}

.nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

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

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.kpi-chart {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

/* Vertical bar chart (for SPRS Score 0–110) */
.kpi-chart-vertical {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.kpi-chart-vertical .vertical-track {
  width: 12px;
  height: 100%;
  background: rgba(192, 192, 192, 0.12);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.kpi-chart-vertical .vertical-fill {
  width: 100%;
  border-radius: 6px;
  transition: height 0.5s ease;
  min-height: 4px;
}

.kpi-chart-vertical.kpi-chart-good .vertical-fill {
  background: linear-gradient(to top, #B8860B 0%, #FFE55C 100%);
}

.kpi-chart-vertical.kpi-chart-medium .vertical-fill {
  background: linear-gradient(to top, #808080 0%, #E8E8E8 100%);
}

.kpi-chart-vertical.kpi-chart-warning .vertical-fill {
  background: linear-gradient(to top, #6B5B2E 0%, #C9A227 100%);
}

.kpi-chart-vertical.kpi-chart-low .vertical-fill {
  background: linear-gradient(to top, #4A4A4A 0%, #A0A0A0 100%);
}

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

.kpi-chart .ring-bg {
  fill: none;
  stroke: rgba(192, 192, 192, 0.12);
  stroke-width: 4;
}

.kpi-chart .ring-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease, stroke 0.3s ease;
}

.ring-fill-good {
  stroke: url(#grad-good);
}

.ring-fill-medium {
  stroke: url(#grad-medium);
}

.ring-fill-warning {
  stroke: url(#grad-warning);
}

.ring-fill-low {
  stroke: url(#grad-low);
}

.kpi-content {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: 0.9rem;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
}

.kpi-value.accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.kpi-trend {
  font-size: 0.9rem;
  margin-top: 0.25rem;
  color: var(--text-bright);
}

.kpi-trend.positive { color: var(--gold); }
.kpi-trend.negative { color: var(--silver-muted); }

/* Chart / Content areas */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--gold);
}

/* Compliance status bars */
.compliance-list {
  list-style: none;
}

.compliance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.compliance-item:last-child {
  border-bottom: none;
}

.compliance-name {
  font-size: 1rem;
  color: var(--text-bright);
}

.compliance-bar-wrap {
  flex: 1;
  max-width: 120px;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 12px;
}

.compliance-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.compliance-bar.high { background: linear-gradient(90deg, var(--gold-dark) 0%, var(--gold) 100%); }
.compliance-bar.medium { background: var(--bar-fill-silver); }
.compliance-bar.low { background: var(--bar-fill-low); }

.compliance-pct {
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 36px;
  text-align: right;
  color: var(--text-bright);
}

/* CARA / Insights card */
.insight-item {
  display: flex;
  gap: 12px;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 1rem;
  color: var(--text-bright);
  position: relative;
}

.insight-item .dd-kpi-badge {
  position: static;
  flex-shrink: 0;
  align-self: flex-start;
}

.insight-item:last-child {
  border-bottom: none;
}

.insight-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px;
  background: var(--overlay-gold-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.insight-content strong {
  display: block;
  margin-bottom: 0.25rem;
}

.insight-content span {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Data discovery table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  color: var(--text-bright);
}

.data-table th {
  text-align: left;
  padding: 0.75rem 0;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.compliant { background: rgba(255, 215, 0, 0.2); color: var(--gold); }
.status-badge.review { background: rgba(192, 192, 192, 0.2); color: var(--silver); }
.status-badge.gap { background: rgba(128, 128, 128, 0.25); color: var(--silver-muted); }

/* Light theme card & component overrides */
[data-theme="light"] .card,
[data-theme="light"] .kpi-card,
[data-theme="light"] .login-card {
  box-shadow: var(--shadow-card);
}

[data-theme="light"] .sidebar {
  background: #ffffff;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .login-page,
[data-theme="light"] .dashboard-page {
  background: var(--bg-dark);
}

[data-theme="light"] .status-badge.compliant { background: rgba(184, 150, 11, 0.12); }
[data-theme="light"] .status-badge.review { background: rgba(0, 0, 0, 0.06); }
[data-theme="light"] .status-badge.gap { background: rgba(0, 0, 0, 0.08); }
