/* Custom Dashboard Styles */

/* Light Theme (Default) */
:root {
  --background-color: #f0f2f5;
  --widget-background-color: #ffffff;
  --text-color: #333333;
  --header-color: #1a1a1a;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Dark Theme */
[data-theme="dark"] {
  --background-color: #121212;
  --widget-background-color: #1e1e1e;
  --text-color: #e0e0e0;
  --header-color: #ffffff;
  --border-color: #333333;
  --shadow-color: rgba(0, 0, 0, 0.5);
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
}

.dashboard-container {
  padding: 20px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.dashboard-header h1 {
  color: var(--header-color);
  font-size: 24px;
}

.theme-switcher {
  cursor: pointer;
  background: var(--widget-background-color);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 6px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.dashboard-widget {
  background-color: var(--widget-background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.dashboard-widget h3 {
  color: var(--header-color);
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 15px;
}

.dashboard-widget .widget-content {
  flex-grow: 1;
}

.sortable-ghost {
  opacity: 0.4;
  background: #4a90e2;
}

/* Custom Dashboards index */
.dashboards-page {
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08) 0%, rgba(248, 250, 252, 0) 320px),
    #f6f8fb;
  color: #172033;
}

.dashboards-page .container-xl {
  max-width: 1320px;
}

.dashboard-hero,
.filter-panel,
.content-panel,
.hero-panel,
.insight-panel {
  border: 1px solid rgba(100, 116, 139, 0.16);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.hero-panel,
.insight-panel,
.filter-panel,
.content-panel {
  border-radius: 8px;
}

.dashboard-hero {
  border-radius: 10px;
  padding: 18px;
}

.hero-panel {
  padding: clamp(22px, 3vw, 34px);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(14, 165, 233, 0.08)),
    #ffffff;
}

.hero-kicker,
.section-kicker,
.panel-kicker {
  color: #0f766e;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-title {
  color: #0f172a;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 800;
  line-height: 1.02;
}

.hero-copy {
  max-width: 760px;
  color: #526071;
  font-size: 1rem;
  line-height: 1.55;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.24);
}

.hero-btn:hover {
  background: #115e59;
}

.hero-stat-card {
  min-height: 112px;
  padding: 16px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  background: #ffffff;
}

.hero-stat-label,
.dashboard-meta,
.hero-stat-meta,
.insight-label,
.widget-group-subtitle,
.widget-card-key,
.widget-library-note,
.empty-copy {
  color: #64748b;
}

.hero-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-stat-value {
  color: #0f172a;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 8px;
}

.hero-stat-meta {
  margin-top: 4px;
  font-size: 0.84rem;
}

.insight-panel {
  padding: 24px;
}

.panel-title {
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 800;
  margin: 8px 0 0;
}

.insight-list {
  display: grid;
  gap: 14px;
}

.insight-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.insight-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
}

.insight-primary { background: #0ea5e9; }
.insight-success { background: #16a34a; }
.insight-warning { background: #f59e0b; }

.insight-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.insight-value {
  color: #1e293b;
  font-weight: 700;
}

.filter-panel {
  padding: 14px;
}

.filter-label {
  color: #334155;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-right: 4px;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #dbe3ed;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.type-pill:hover {
  border-color: #0f766e;
  color: #0f766e;
}

.type-pill.active {
  border-color: #0f766e;
  background: #ccfbf1;
  color: #115e59;
}

.content-panel {
  padding: clamp(18px, 2.6vw, 28px);
}

.section-header {
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.section-title {
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 800;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.8rem;
  font-weight: 800;
}

.section-badge.accent {
  background: #ecfeff;
  color: #0e7490;
}

.dashboard-stack,
.widget-group-stack {
  display: grid;
  gap: 14px;
}

.dashboard-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-card-main {
  display: flex;
  gap: 14px;
  min-width: 0;
}

.dashboard-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #fef2f2;
  color: #dc2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.dashboard-copy {
  min-width: 0;
}

.dashboard-name {
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 800;
}

.dashboard-facts {
  color: #475569;
  font-size: 0.84rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-pill.success { background: #dcfce7; color: #166534; }
.status-pill.info { background: #dbeafe; color: #1d4ed8; }
.status-pill.muted { background: #f1f5f9; color: #475569; }

.dashboard-actions {
  align-content: start;
}

.action-btn {
  border-radius: 8px;
  font-weight: 700;
}

.action-btn-primary {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
}

.action-btn-light {
  background: #f8fafc;
  border-color: #dbe3ed;
  color: #334155;
}

.action-btn-success {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.action-btn-danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.empty-state {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 34px 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.empty-state.compact {
  padding: 24px 16px;
}

.empty-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: #e0f2fe;
  color: #0369a1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
}

.empty-title {
  color: #0f172a;
  font-size: 1.12rem;
  font-weight: 800;
}

.empty-copy {
  max-width: 520px;
}

.widget-library-panel {
  position: sticky;
  top: 92px;
}

.widget-library-note {
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.9rem;
  line-height: 1.45;
}

.widget-group-card {
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.widget-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.widget-group-title {
  color: #0f172a;
  font-weight: 800;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.widget-card {
  min-height: 132px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.widget-card-top {
  display: grid;
  gap: 7px;
}

.widget-card-name {
  color: #111827;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.25;
}

.widget-category-pill,
.widget-type-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.widget-category-pill {
  padding: 5px 7px;
  background: #ede9fe;
  color: #6d28d9;
}

.widget-card-key {
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.widget-card-types {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.widget-type-chip {
  padding: 4px 6px;
  background: #ffffff;
  color: #475569;
  border: 1px solid #dbe3ed;
}

.widget-type-chip.active {
  background: #ccfbf1;
  border-color: #99f6e4;
  color: #115e59;
}

@media (max-width: 1199px) {
  .widget-library-panel {
    position: static;
  }
}

@media (max-width: 767px) {
  .dashboard-hero {
    padding: 12px;
  }

  .dashboard-card,
  .dashboard-card-main {
    display: grid;
  }

  .dashboard-actions {
    justify-content: start !important;
  }

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

  .hero-stat-card {
    min-height: auto;
  }
}
