/* ==========================================================================
   CAPO Dashboard UI - Component Styles
   Reusable CSS classes for dashboard components
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Open+Sans:wght@400&family=Poppins:wght@400;500;600&display=swap');

/* -----------------------------------------------------------------------
   BASE RESET & GLOBALS
   ----------------------------------------------------------------------- */

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

body {
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  color: var(--color-grey-900);
  background-color: var(--color-surface-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -----------------------------------------------------------------------
   TYPOGRAPHY UTILITIES
   ----------------------------------------------------------------------- */

.text-4xl-semibold {
  font-family: var(--font-primary);
  font-size: var(--fs-4xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-4xl);
}

.text-3xl-semibold {
  font-family: var(--font-primary);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-3xl);
}

.text-2xl-semibold {
  font-family: var(--font-primary);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-2xl);
}

.text-xl-semibold {
  font-family: var(--font-primary);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-xl);
}

.text-lg-semibold {
  font-family: var(--font-primary);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: normal;
}

.text-base-semibold {
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-base);
}

.text-base-medium {
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: var(--lh-base);
}

.text-base-regular {
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-loose);
}

.text-sm-medium {
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-sm);
}

.text-sm-regular {
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  line-height: var(--lh-sm);
}

.text-xs-semibold {
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-xs);
}

.text-xs-medium {
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: var(--lh-xs);
}

.text-xs-regular {
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-regular);
  line-height: var(--lh-xs);
}

/* -----------------------------------------------------------------------
   COLOR UTILITIES
   ----------------------------------------------------------------------- */

.color-primary      { color: var(--color-primary-900); }
.color-primary-dark { color: var(--color-primary-dark-shade); }
.color-grey-700     { color: var(--color-grey-700); }
.color-grey-800     { color: var(--color-grey-800); }
.color-grey-900     { color: var(--color-grey-900); }
.color-black        { color: var(--color-black); }
.color-muted        { color: var(--color-text-muted); }
.color-secondary    { color: var(--color-text-secondary); }
.color-success      { color: var(--color-success); }
.color-error        { color: var(--color-error); }
.color-yellow       { color: var(--color-yellow); }
.color-chart-blue   { color: var(--color-chart-blue); }

/* -----------------------------------------------------------------------
   LAYOUT: DASHBOARD GRID
   ----------------------------------------------------------------------- */

.dashboard {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  min-height: 100vh;
  width: 100%;
  max-width: var(--dashboard-width);
}

.dashboard__sidebar {
  grid-row: 1 / -1;
  grid-column: 1;
  background: var(--color-white);
  padding: 50px 0;
  position: relative;
}

.dashboard__topbar {
  grid-column: 2;
  grid-row: 1;
  background: var(--color-white);
  display: flex;
  align-items: center;
  padding: 0 40px;
  gap: var(--space-xl);
}

.dashboard__content {
  grid-column: 2;
  grid-row: 2;
  padding: var(--space-3xl);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--content-gap);
  align-content: start;
}

/* -----------------------------------------------------------------------
   COMPONENT: SIDEBAR
   ----------------------------------------------------------------------- */

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  padding: 0 43px;
  margin-bottom: 50px;
}

.sidebar__logo {
  width: 56px;
  height: 56px;
  background: var(--color-primary-900);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar__brand-name {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  color: var(--color-grey-900);
  line-height: var(--lh-3xl);
}

.sidebar__nav {
  list-style: none;
  padding: 0 46px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  padding: 16px 24px;
  border-radius: var(--radius-xl);
  color: var(--color-grey-700);
  font-size: var(--fs-lg);
  font-weight: var(--fw-regular);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar__nav-item:hover {
  background: var(--color-surface-secondary);
}

.sidebar__nav-item--active {
  background: var(--color-primary-900);
  color: var(--color-white);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-elevated);
}

.sidebar__nav-icon {
  width: var(--icon-lg);
  height: var(--icon-lg);
  flex-shrink: 0;
}

/* -----------------------------------------------------------------------
   COMPONENT: TOP BAR
   ----------------------------------------------------------------------- */

.topbar__title {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-semibold);
  color: var(--color-grey-900);
  line-height: var(--lh-4xl);
  margin-right: auto;
}

.topbar__search {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--color-surface-secondary);
  border-radius: var(--radius-xl);
  padding: 2px 32px 2px 24px;
  height: 60px;
  width: 513px;
}

.topbar__search-icon {
  width: var(--icon-lg);
  height: var(--icon-lg);
  flex-shrink: 0;
  opacity: 0.5;
}

.topbar__search-input {
  border: none;
  background: transparent;
  font-family: var(--font-primary);
  font-size: var(--fs-lg);
  color: var(--color-grey-900);
  outline: none;
  width: 100%;
}

.topbar__search-input::placeholder {
  color: var(--color-grey-700);
}

.topbar__language {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 var(--space-md);
  height: 60px;
  cursor: pointer;
}

.topbar__language-flag {
  width: 24px;
  height: 24px;
}

.topbar__language-text {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-black);
}

.topbar__notification {
  width: var(--icon-avatar);
  height: var(--icon-avatar);
  background: var(--color-notification-bg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.topbar__notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--color-error);
  border-radius: 50%;
}

.topbar__profile {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.topbar__avatar {
  width: var(--icon-profile);
  height: var(--icon-profile);
  border-radius: var(--radius-xl);
  object-fit: cover;
}

.topbar__user-info {
  display: flex;
  flex-direction: column;
}

.topbar__user-name {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--color-grey-900);
  line-height: var(--lh-base);
}

.topbar__user-role {
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  color: var(--color-grey-700);
  line-height: var(--lh-sm);
}

/* -----------------------------------------------------------------------
   COMPONENT: CARD (Base)
   ----------------------------------------------------------------------- */

.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
  padding: var(--space-xl);
  overflow: hidden;
}

.card--rounded-lg {
  border-radius: var(--radius-3xl);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.card__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--color-primary-dark-shade);
  line-height: var(--lh-xl);
}

.card__subtitle {
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  color: var(--color-grey-700);
  line-height: var(--lh-loose);
}

/* -----------------------------------------------------------------------
   COMPONENT: STAT CARDS (Today's Sales)
   ----------------------------------------------------------------------- */

.stat-cards {
  grid-column: 1 / 3;
}

.stat-cards__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3xl);
  margin-top: var(--space-lg);
}

.stat-card {
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: 184px;
}

.stat-card--pink   { background: var(--color-card-pink); }
.stat-card--orange  { background: var(--color-card-orange); }
.stat-card--green   { background: var(--color-card-green); }
.stat-card--purple  { background: var(--color-card-purple); }

.stat-card__icon {
  width: var(--icon-xl);
  height: var(--icon-xl);
}

.stat-card__value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  color: var(--color-grey-900);
  line-height: var(--lh-2xl);
}

.stat-card__label {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
  line-height: var(--lh-base);
}

.stat-card__change {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--color-primary-800);
  line-height: var(--lh-xs);
}

/* -----------------------------------------------------------------------
   COMPONENT: EXPORT BUTTON
   ----------------------------------------------------------------------- */

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 16px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: transparent;
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: #0F3659;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-export:hover {
  background: var(--color-surface-secondary);
}

.btn-export__icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

/* -----------------------------------------------------------------------
   COMPONENT: CHART CARD
   ----------------------------------------------------------------------- */

.chart-card {
  position: relative;
}

.chart-card__legend {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-top: var(--space-md);
}

.chart-card__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: #222B45;
}

.chart-card__legend-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-base);
  flex-shrink: 0;
}

.chart-card__legend-dot--blue   { background: var(--color-chart-blue); }
.chart-card__legend-dot--green  { background: var(--color-chart-green); }
.chart-card__legend-dot--purple { background: var(--color-chart-violet); }
.chart-card__legend-dot--red    { background: var(--color-chart-red); }
.chart-card__legend-dot--teal   { background: var(--color-chart-teal); }
.chart-card__legend-dot--yellow { background: var(--color-chart-yellow); }

/* Chart axis labels */
.chart-card__axis-label {
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-regular);
  color: var(--color-primary-200);
  line-height: var(--lh-xs);
}

.chart-card__axis-line {
  background: var(--color-axis);
  height: 1px;
  width: 100%;
}

/* -----------------------------------------------------------------------
   COMPONENT: BAR CHART
   ----------------------------------------------------------------------- */

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 200px;
  padding-bottom: var(--space-xl);
}

.bar-chart__group {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.bar-chart__bar {
  width: 16px;
  border-radius: var(--radius-md);
  transition: opacity 0.2s;
}

.bar-chart__bar:hover {
  opacity: 0.8;
}

.bar-chart__bar--blue   { background: var(--color-chart-blue); }
.bar-chart__bar--green  { background: var(--color-chart-green); }
.bar-chart__bar--yellow { background: var(--color-chart-yellow); }
.bar-chart__bar--teal   { background: var(--color-chart-teal); }

/* -----------------------------------------------------------------------
   COMPONENT: STATS ROW (Customer Satisfaction footer)
   ----------------------------------------------------------------------- */

.stats-row {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-divider);
}

.stats-row__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-row__label {
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  color: var(--color-text-muted);
  line-height: var(--lh-loose);
}

.stats-row__value {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: #222B45;
  line-height: var(--lh-sm);
}

.stats-row__divider {
  width: 1px;
  height: 24px;
  background: #BDC9D3;
}

/* -----------------------------------------------------------------------
   COMPONENT: TABLE (Top Products)
   ----------------------------------------------------------------------- */

.products-table {
  width: 100%;
  border-collapse: collapse;
}

.products-table th {
  font-family: var(--font-secondary);
  font-size: 13px;
  font-weight: var(--fw-regular);
  color: var(--color-text-muted);
  text-align: left;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-divider);
}

.products-table td {
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  color: var(--color-grey-800);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}

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

/* -----------------------------------------------------------------------
   COMPONENT: PROGRESS BAR
   ----------------------------------------------------------------------- */

.progress-bar {
  width: 180px;
  height: 4px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.progress-bar__track {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-lg);
  position: absolute;
  top: 0;
  left: 0;
}

.progress-bar--blue   .progress-bar__track { background: var(--color-progress-blue-track); }
.progress-bar--blue   .progress-bar__fill  { background: var(--color-chart-blue); }
.progress-bar--green  .progress-bar__track { background: var(--color-progress-green-track); }
.progress-bar--green  .progress-bar__fill  { background: var(--color-chart-green); }
.progress-bar--purple .progress-bar__track { background: var(--color-progress-purple-track); }
.progress-bar--purple .progress-bar__fill  { background: var(--color-chart-purple); }
.progress-bar--orange .progress-bar__track { background: var(--color-progress-orange-track); }
.progress-bar--orange .progress-bar__fill  { background: var(--color-chart-orange); }

/* -----------------------------------------------------------------------
   COMPONENT: BADGE
   ----------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: var(--radius-lg);
  font-family: var(--font-secondary);
  font-size: 13px;
  font-weight: var(--fw-regular);
  border: 1px solid;
}

.badge--blue   { background: var(--color-badge-blue-bg);   color: var(--color-chart-blue);   border-color: var(--color-chart-blue); }
.badge--green  { background: var(--color-badge-green-bg);  color: #00E58F;                   border-color: #00E58F; }
.badge--purple { background: var(--color-badge-purple-bg); color: var(--color-chart-purple);  border-color: var(--color-chart-purple); }
.badge--orange { background: var(--color-badge-orange-bg); color: #FF8900;                    border-color: #FF8900; }

/* -----------------------------------------------------------------------
   COMPONENT: AVATAR (Target vs Reality legend items)
   ----------------------------------------------------------------------- */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar--green  { background: var(--color-green-shade); }
.avatar--yellow { background: var(--color-card-orange); }

/* -----------------------------------------------------------------------
   COMPONENT: CTA CARD (Get Pro)
   ----------------------------------------------------------------------- */

.cta-card {
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xl);
  background: linear-gradient(135deg, var(--color-primary-900) 0%, #4ADE80 100%);
  color: var(--color-white);
  position: relative;
  overflow: hidden;
}

.cta-card__logo {
  width: 48px;
  height: 48px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cta-card__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-xl);
}

.cta-card__text {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: var(--lh-xs);
  opacity: 0.8;
}

.cta-card__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs);
  width: 136px;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: none;
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--color-primary-900);
  line-height: var(--lh-base);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cta-card__button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* -----------------------------------------------------------------------
   COMPONENT: MAP CARD
   ----------------------------------------------------------------------- */

.map-card__image {
  width: 100%;
  height: auto;
  margin-top: var(--space-md);
}
