/* ============================================================
   Core by Uncles&Co — Component Styles
   components.css
   ============================================================ */

/* ============================================================
   1. CARD COMPONENT
   ============================================================ */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  transition: background-color var(--duration) var(--ease-default),
              border-color var(--duration) var(--ease-default);
  overflow: hidden;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.card__title {
  font-family: var(--font-heading);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin: 0;
}

.card__subtitle {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.card__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card__body {
  padding: var(--space-6);
}

.card__body--flush {
  padding: 0;
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
}

.card--interactive {
  cursor: pointer;
}

.card--interactive:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card--flat {
  box-shadow: none;
}

.card--brand {
  border-left: 3px solid var(--brand);
}


/* ============================================================
   2. TABLE COMPONENT (extended)
   ============================================================ */

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.table-toolbar__search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.table-toolbar__search .form-control {
  padding-left: var(--space-10);
}

.table-toolbar__search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: var(--fs-base);
  pointer-events: none;
}

.table-toolbar__filters {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.table-footer__info {
  font-family: var(--font-mono);
}

/* sorting indicators */
.data-table th[data-sort] {
  cursor: pointer;
  position: relative;
  padding-right: var(--space-6);
}

.data-table th[data-sort]::after {
  content: '\2195';
  position: absolute;
  right: var(--space-3);
  opacity: .3;
  font-size: var(--fs-xs);
}

.data-table th[data-sort="asc"]::after {
  content: '\2191';
  opacity: 1;
  color: var(--brand);
}

.data-table th[data-sort="desc"]::after {
  content: '\2193';
  opacity: 1;
  color: var(--brand);
}

/* table row selection */
.data-table tbody tr.is-selected {
  background: var(--brand-muted);
}

.data-table tbody tr.is-selected:hover {
  background: var(--brand-subtle);
}

/* table row actions */
.table-row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--duration) var(--ease-default);
}

.data-table tbody tr:hover .table-row-actions {
  opacity: 1;
}

.table-row-actions .btn {
  padding: var(--space-1) var(--space-2);
}

/* pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--duration) var(--ease-default);
  text-decoration: none;
}

.pagination__btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.pagination__btn.is-active {
  background: var(--brand);
  color: var(--text-on-brand);
  border-color: var(--brand);
}

.pagination__btn:disabled {
  opacity: .4;
  pointer-events: none;
}

.pagination__ellipsis {
  padding: 0 var(--space-2);
  color: var(--text-tertiary);
}


/* ============================================================
   3. PILL / BADGE COMPONENT (extended)
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  font-family: var(--font-mono);
  line-height: 1;
}

.badge--brand {
  background: var(--brand);
  color: var(--text-on-brand);
}

.badge--success {
  background: var(--success);
  color: #FFFFFF;
}

.badge--warning {
  background: var(--warning);
  color: #FFFFFF;
}

.badge--danger {
  background: var(--danger);
  color: #FFFFFF;
}

.badge--subtle {
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
}

.badge--dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  padding: 0;
  border-radius: 50%;
}

.badge--dot-success { background: var(--success); }
.badge--dot-warning { background: var(--warning); }
.badge--dot-danger  { background: var(--danger); }
.badge--dot-brand   { background: var(--brand); }

/* pill with close */
.pill--closable {
  padding-right: var(--space-1);
}

.pill__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 10px;
  opacity: .7;
  transition: opacity var(--duration) var(--ease-default);
}

.pill__close:hover {
  opacity: 1;
}


/* ============================================================
   4. MODAL COMPONENT (extended)
   ============================================================ */

.modal--sm  { max-width: 400px; }
.modal--md  { max-width: 520px; }
.modal--lg  { max-width: 720px; }
.modal--xl  { max-width: 960px; }
.modal--full {
  max-width: calc(100vw - var(--space-8));
  max-height: calc(100vh - var(--space-8));
}

.modal__body--scroll {
  max-height: 60vh;
  overflow-y: auto;
}

/* confirmation dialog */
.modal--confirm .modal__body {
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.modal--confirm .modal__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2xl);
  margin: 0 auto var(--space-4);
}

.modal--confirm .modal__icon--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.modal--confirm .modal__icon--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal--confirm .modal__footer {
  justify-content: center;
}


/* ============================================================
   5. TOAST COMPONENT (extended)
   ============================================================ */

.toast--bordered {
  border-left: 3px solid;
}

.toast--bordered.toast--success { border-left-color: var(--success); }
.toast--bordered.toast--warning { border-left-color: var(--warning); }
.toast--bordered.toast--danger  { border-left-color: var(--danger); }
.toast--bordered.toast--info    { border-left-color: var(--info); }

.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--brand);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: toast-progress linear forwards;
}

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0; }
}


/* ============================================================
   6. FORM WIZARD / STEPS
   ============================================================ */

.wizard {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.wizard__steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 var(--space-4);
}

.wizard__step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  position: relative;
}

.wizard__step + .wizard__step::before {
  content: '';
  display: block;
  width: 48px;
  height: 2px;
  background: var(--border-default);
  margin: 0 var(--space-3);
  transition: background-color var(--duration) var(--ease-default);
}

.wizard__step.is-completed + .wizard__step::before {
  background: var(--brand);
}

.wizard__step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  border: 2px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-tertiary);
  transition: all var(--duration) var(--ease-default);
  flex-shrink: 0;
}

.wizard__step.is-active .wizard__step-number {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--text-on-brand);
}

.wizard__step.is-completed .wizard__step-number {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--text-on-brand);
}

.wizard__step-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  white-space: nowrap;
}

.wizard__step.is-active .wizard__step-label {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}

.wizard__step.is-completed .wizard__step-label {
  color: var(--brand);
}

.wizard__panel {
  display: none;
}

.wizard__panel.is-active {
  display: block;
  animation: fade-in 0.25s var(--ease-default);
}

.wizard__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}


/* ============================================================
   7. LOADING SKELETON
   ============================================================ */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-md);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--bg-surface-hover) 50%,
    transparent 100%
  );
  animation: skeleton-wave 1.8s ease-in-out infinite;
}

@keyframes skeleton-wave {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton--text {
  height: 14px;
  width: 100%;
  margin-bottom: var(--space-2);
}

.skeleton--text-sm {
  height: 12px;
  width: 60%;
}

.skeleton--heading {
  height: 24px;
  width: 40%;
  margin-bottom: var(--space-4);
}

.skeleton--avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton--card {
  height: 120px;
}

.skeleton--table-row {
  height: 44px;
  margin-bottom: var(--space-2);
}

.skeleton--btn {
  height: 36px;
  width: 100px;
  border-radius: var(--radius-md);
}

.skeleton--kpi {
  height: 140px;
  border-radius: var(--radius-lg);
}


/* ============================================================
   8. EMPTY STATE
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  min-height: 300px;
}

.empty-state__icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-4xl);
  background: var(--bg-surface-alt);
  color: var(--text-tertiary);
  margin-bottom: var(--space-6);
}

.empty-state__title {
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state__description {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  max-width: 360px;
  margin-bottom: var(--space-6);
}

.empty-state__action {
  display: flex;
  gap: var(--space-3);
}


/* ============================================================
   9. CALENDAR COMPONENT
   ============================================================ */

.calendar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.calendar__title {
  font-family: var(--font-heading);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}

.calendar__nav {
  display: flex;
  gap: var(--space-1);
}

.calendar__nav-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  transition: all var(--duration) var(--ease-default);
}

.calendar__nav-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: var(--space-3);
  gap: 2px;
}

.calendar__day-label {
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  padding: var(--space-2) 0;
}

.calendar__day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration) var(--ease-default);
  position: relative;
}

.calendar__day:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.calendar__day--today {
  font-weight: var(--fw-bold);
  color: var(--brand);
  background: var(--brand-muted);
}

.calendar__day--selected {
  background: var(--brand);
  color: var(--text-on-brand);
  font-weight: var(--fw-bold);
}

.calendar__day--outside {
  color: var(--text-tertiary);
  opacity: .4;
}

.calendar__day--has-event::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand);
}

.calendar__day--weekend {
  color: var(--text-tertiary);
}

.calendar__day--disabled {
  opacity: .3;
  pointer-events: none;
}


/* ============================================================
   10. DROPDOWN MENU
   ============================================================ */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__trigger {
  cursor: pointer;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  display: none;
  z-index: 1100;
}

.dropdown__menu--right {
  left: auto;
  right: 0;
}

.dropdown__menu--up {
  top: auto;
  bottom: calc(100% + var(--space-1));
}

.dropdown__menu.is-open {
  display: block;
  animation: dropdown-in 0.15s var(--ease-default);
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease-default);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown__item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.dropdown__item--active {
  background: var(--brand-muted);
  color: var(--brand);
}

.dropdown__item--danger:hover {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.dropdown__item i {
  width: 16px;
  text-align: center;
  font-size: var(--fs-base);
}

.dropdown__divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2) 0;
}

.dropdown__label {
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dropdown__item-shortcut {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}


/* ============================================================
   11. QUICK ACTIONS GRID
   ============================================================ */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration) var(--ease-default);
}

.quick-action:hover {
  border-color: var(--brand);
  background: var(--brand-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.quick-action__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--brand-muted);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xl);
  transition: all var(--duration) var(--ease-default);
}

.quick-action:hover .quick-action__icon {
  background: var(--brand);
  color: var(--text-on-brand);
}

.quick-action__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-align: center;
}


/* ============================================================
   12. SECTION HEADINGS
   ============================================================ */

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

.section-header__title {
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin: 0;
}

.section-header__subtitle {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}


/* ============================================================
   13. OBLIGATION LIST (semaphore)
   ============================================================ */

.obligation-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.obligation-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: background-color var(--duration) var(--ease-default);
}

.obligation-item:hover {
  background: var(--bg-surface-hover);
}

.obligation-item__status {
  flex-shrink: 0;
}

.obligation-item__info {
  flex: 1;
}

.obligation-item__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}

.obligation-item__date {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.obligation-item__action {
  flex-shrink: 0;
}


/* ============================================================
   14. CHART PLACEHOLDER
   ============================================================ */

.chart-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chart-container__placeholder {
  text-align: center;
  color: var(--text-tertiary);
}

.chart-container__placeholder i {
  font-size: var(--fs-4xl);
  margin-bottom: var(--space-3);
  display: block;
  opacity: .4;
}


/* ============================================================
   15. TABS
   ============================================================ */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-6);
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--duration) var(--ease-default);
  text-decoration: none;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.tab.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: var(--fw-semibold);
}


/* ============================================================
   16. AVATAR GROUP
   ============================================================ */

.avatar-group {
  display: flex;
  align-items: center;
}

.avatar-group__item {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  font-family: var(--font-heading);
  color: var(--text-on-brand);
  background: var(--brand-gradient);
  margin-left: -8px;
}

.avatar-group__item:first-child {
  margin-left: 0;
}

.avatar-group__more {
  background: var(--bg-surface-alt);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
