/* ===== COSTA Industries — Dashboard Layout & Skeleton Screens ===== */

/* ===== APP SHELL (no page scroll) ===== */
html.dashboard-page,
html.dashboard-page body {
  height: 100%;
  overflow: hidden;
}

html.dashboard-page body {
  display: flex;
  flex-direction: column;
}

/* site-header is a flex child — don't grow */
html.dashboard-page site-header {
  flex-shrink: 0;
}

html.dashboard-page site-footer {
  flex-shrink: 0;
}

/* ===== DASHBOARD WRAPPER ===== */
.dashboard-wrapper {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== PANELS AREA ===== */
.dashboard-panels {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-5);
  padding: var(--space-5);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ===== SINGLE PANEL ===== */
.dashboard-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--divider);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-medium) var(--ease-elegant);
}

.dashboard-panel:hover {
  box-shadow: var(--shadow-md);
}

/* ===== PANEL HEADER ===== */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.panel-link-all {
  font-size: var(--text-sm);
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: 0 var(--space-2);
  border-radius: 8px;
  transition: all var(--duration-fast) var(--ease-elegant);
}

.panel-link-all:hover {
  background: var(--bg-tertiary);
  color: var(--accent-secondary);
}

/* ===== PANEL BODY (scrolls independently) ===== */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  overscroll-behavior: contain;
}

/* Custom scrollbar */
.panel-body::-webkit-scrollbar {
  width: 4px;
}

.panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.panel-body::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 2px;
}

/* ===== SKELETON SCREENS ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--divider) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 1.8s infinite linear;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: var(--bg-tertiary);
  }
}

/* Feed skeleton — article card shape */
.skeleton-article {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--divider);
}

.skeleton-article:last-child {
  border-bottom: none;
}

.skeleton-tag {
  height: 16px;
  width: 60px;
  border-radius: 10px;
}

.skeleton-title-lg {
  height: 20px;
  width: 85%;
}

.skeleton-title-md {
  height: 20px;
  width: 65%;
}

.skeleton-meta {
  height: 13px;
  width: 40%;
}

/* Health skeleton — metric row shape */
.skeleton-profile-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--divider);
}

.skeleton-profile-row:last-child {
  border-bottom: none;
}

.skeleton-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-text-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.skeleton-label {
  height: 12px;
  width: 40%;
}

.skeleton-value {
  height: 18px;
  width: 55%;
}

/* ===== ARTICLE LIST (feed panel) ===== */
.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  animation: fadeInUp var(--duration-medium) var(--ease-elegant);
}

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

.article-category-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-primary);
  background: rgba(193, 165, 123, 0.12);
  padding: 2px var(--space-2);
  border-radius: 10px;
  width: fit-content;
}

.article-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.4;
  transition: color var(--duration-fast);
}

.article-title:hover {
  color: var(--accent-primary);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.article-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent-primary);
}

/* ===== HEALTH PROFILE (health panel) ===== */
.health-profile-summary {
  animation: fadeInUp var(--duration-medium) var(--ease-elegant);
}

.health-identity {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--divider);
}

.health-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.health-name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.health-sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.health-metrics-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.health-metric-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--divider);
}

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

.health-metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.health-metric-text {
  flex: 1;
}

.health-metric-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.health-metric-value {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

/* ===== EMPTY STATE ===== */
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  text-align: center;
  gap: var(--space-4);
  height: 100%;
}

.panel-empty-icon {
  font-size: 2.5rem;
  opacity: 0.5;
}

.panel-empty-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
}

.panel-empty-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 220px;
  line-height: 1.6;
}

.panel-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  text-decoration: none;
  border-radius: 24px;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--duration-medium) var(--ease-elegant);
  min-height: 44px;
}

.panel-empty-cta:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* ===== ERROR STATE ===== */
.panel-error {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: 10px;
  font-size: var(--text-sm);
  color: #c0392b;
}

[data-theme='dark'] .panel-error {
  color: #e57373;
  background: rgba(220, 53, 69, 0.12);
  border-color: rgba(220, 53, 69, 0.3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .dashboard-panels {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  html.dashboard-page,
  html.dashboard-page body {
    height: auto;
    overflow: auto;
    display: block;
  }

  html.dashboard-page body {
    display: block;
  }

  .dashboard-wrapper {
    flex: unset;
    display: block;
  }

  .dashboard-panel {
    max-height: 70vh;
  }
}

@media (max-width: 480px) {
  .dashboard-panels {
    padding: var(--space-3);
    gap: var(--space-3);
  }

  .panel-header {
    padding: var(--space-4) var(--space-4) var(--space-3);
  }

  .panel-body {
    padding: var(--space-3) var(--space-4);
  }
}
