/* ============================================
   DASHBOARD COMPONENTS STYLES
   High Quality SaaS Dashboard Components
   ============================================ */

/* ==========================================
   GRID SYSTEM (CSS Grid based)
   ========================================== */

/* Spacing Scale */
:root {
  --grid-gap: 24px;
  --grid-padding: 24px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--grid-gap);
  padding: var(--grid-padding);
  background: #f8fafc;
  min-height: 100%;
  align-content: start;
}

/* Grid Columns - CSS Grid based */
.grid-col-1 {
  grid-column: span 1;
}
.grid-col-2 {
  grid-column: span 2;
}
.grid-col-3 {
  grid-column: span 3;
}
.grid-col-4 {
  grid-column: span 4;
}
.grid-col-5 {
  grid-column: span 5;
}
.grid-col-6 {
  grid-column: span 6;
}
.grid-col-7 {
  grid-column: span 7;
}
.grid-col-8 {
  grid-column: span 8;
}
.grid-col-9 {
  grid-column: span 9;
}
.grid-col-10 {
  grid-column: span 10;
}
.grid-col-11 {
  grid-column: span 11;
}
.grid-col-12 {
  grid-column: span 12;
}

/* ==========================================
   CARD BASE
   ========================================== */

.db-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: var(--space-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.db-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  flex-shrink: 0;
  gap: var(--space-md);
}

.db-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.db-card-action {
  font-size: 13px;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
}

.db-card-action:hover {
  text-decoration: underline;
}

/* ==========================================
   STATS CARDS
   ========================================== */

.stats-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
  width: 100%;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: var(--space-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  min-width: 0;
}

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.stat-card-title {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.4;
  white-space: nowrap;
}

.stat-card-value {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  white-space: nowrap;
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon svg {
  width: 22px;
  height: 22px;
}

.stat-card-icon.blue {
  background: #dbeafe;
  color: #2563eb;
}

.stat-card-icon.green {
  background: #d1fae5;
  color: #059669;
}

.stat-card-icon.purple {
  background: #ede9fe;
  color: #7c3aed;
}

.stat-card-icon.orange {
  background: #fef3c7;
  color: #d97706;
}

.stat-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.stat-trend.up {
  color: #059669;
  background: #d1fae5;
}

.stat-trend.down {
  color: #dc2626;
  background: #fee2e2;
}

.stat-period {
  font-size: 13px;
  color: #94a3b8;
  white-space: nowrap;
}

/* ==========================================
   CHART CONTAINERS
   ========================================== */

.chart-container {
  height: 220px;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 180px;
}

.chart-placeholder {
  text-align: center;
  color: #94a3b8;
  padding: 20px;
}

.chart-placeholder svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.chart-placeholder p {
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}

/* ==========================================
   DATA TABLE
   ========================================== */

.data-table-wrapper {
  overflow-x: auto;
  flex: 1;
  margin: 0 -4px;
  padding: 0 4px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

.data-table thead {
  background: #f8fafc;
}

.data-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.data-table td {
  padding: 14px;
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

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

.table-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.table-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.table-status.active {
  background: #d1fae5;
  color: #059669;
}

.table-status.pending {
  background: #fef3c7;
  color: #d97706;
}

.table-status.inactive {
  background: #f1f5f9;
  color: #64748b;
}

/* ==========================================
   KPI CARD
   ========================================== */

.kpi-card {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.kpi-card-content {
  position: relative;
  z-index: 1;
}

.kpi-card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.kpi-card-value {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1;
}

.kpi-card-change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
}

.kpi-card-change svg {
  width: 16px;
  height: 16px;
}

/* ==========================================
   PROGRESS CARD
   ========================================== */

.progress-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  min-width: 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.progress-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-percentage {
  font-size: 20px;
  font-weight: 700;
  color: #3b82f6;
  flex-shrink: 0;
}

.progress-bar-container {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #64748b;
  gap: 12px;
}

.progress-details span {
  white-space: nowrap;
}

/* ==========================================
   ACTIVITY FEED
   ========================================== */

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow: hidden;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  transition: background 0.15s ease;
  min-width: 0;
}

.activity-item:hover {
  background: #f8fafc;
}

.activity-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg {
  width: 18px;
  height: 18px;
}

.activity-icon.blue {
  background: #dbeafe;
  color: #2563eb;
}

.activity-icon.green {
  background: #d1fae5;
  color: #059669;
}

.activity-icon.orange {
  background: #fef3c7;
  color: #d97706;
}

.activity-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.activity-title {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  margin: 0 0 4px 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-time {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}

/* ==========================================
   ALERT BANNER
   ========================================== */

.alert-banner {
  padding: 16px;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.alert-banner .alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-banner span:last-child {
  flex: 1;
  min-width: 0;
}

.alert-banner.info {
  background: #dbeafe;
  color: #1e40af;
}

.alert-banner.success {
  background: #d1fae5;
  color: #065f46;
}

.alert-banner.warning {
  background: #fef3c7;
  color: #92400e;
}

.alert-banner.error {
  background: #fee2e2;
  color: #991b1b;
}

/* ==========================================
   USER PROFILE CARD
   ========================================== */

.user-profile-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: var(--space-lg);
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.user-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  margin: 0 auto 16px;
}

.user-name {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 20px;
}

.user-stats {
  display: flex;
  justify-content: space-around;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  gap: 8px;
}

.user-stat-item {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.user-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

.user-stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

/* ==========================================
   FORM COMPONENTS
   ========================================== */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  background: #ffffff;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.search-bar {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #ffffff;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* ==========================================
   ACTION BUTTONS
   ========================================== */

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  white-space: nowrap;
}

.action-btn.primary {
  background: #3b82f6;
  color: white;
}

.action-btn.primary:hover {
  background: #2563eb;
}

.action-btn.secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.action-btn.secondary:hover {
  background: #e2e8f0;
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================
   RESPONSIVE - TABLET
   ========================================== */

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-lg);
  }

  .grid-col-3,
  .grid-col-4 {
    grid-column: span 3;
  }

  .grid-col-5,
  .grid-col-6 {
    grid-column: span 6;
  }

  .grid-col-7,
  .grid-col-8,
  .grid-col-9,
  .grid-col-10,
  .grid-col-11,
  .grid-col-12 {
    grid-column: span 6;
  }

  .stats-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */

@media (max-width: 768px) {
  :root {
    --grid-gap: 16px;
    --grid-padding: 16px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    padding: var(--grid-padding);
    gap: var(--grid-gap);
  }

  .grid-col-1,
  .grid-col-2,
  .grid-col-3,
  .grid-col-4,
  .grid-col-5,
  .grid-col-6,
  .grid-col-7,
  .grid-col-8,
  .grid-col-9,
  .grid-col-10,
  .grid-col-11,
  .grid-col-12 {
    grid-column: span 1;
  }

  .stats-card-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-card-value {
    font-size: 22px;
  }

  .stat-card-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .stat-card-icon svg {
    width: 20px;
    height: 20px;
  }

  .kpi-card-value {
    font-size: 28px;
  }

  .data-table {
    min-width: 320px;
  }

  .data-table th,
  .data-table td {
    padding: var(--space-sm) var(--space-sm);
    font-size: 13px;
  }

  .user-stats {
    flex-direction: column;
    gap: var(--space-md);
  }

  .user-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding: 0 var(--space-sm);
  }

  .user-stat-value {
    order: 2;
  }

  .user-stat-label {
    order: 1;
    margin-top: 0;
  }
}

/* ==========================================
   INLINE EDITING STYLES
   ========================================== */

/* Editable hover state */
.db-editable-hover {
  outline: 2px dashed rgba(59, 130, 246, 0.5) !important;
  outline-offset: 2px;
  cursor: text !important;
  border-radius: 4px;
}

/* Active editing state */
.db-inline-editing {
  outline: 2px solid #3b82f6 !important;
  outline-offset: 2px;
  background: rgba(59, 130, 246, 0.05) !important;
  min-width: 50px;
  cursor: text !important;
  border-radius: 4px;
}

.db-inline-editing:focus {
  outline: 2px solid #2563eb !important;
}

/* Edit hint tooltip */
.db-edit-hint {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: dbHintFadeIn 0.3s ease-out;
}

.db-edit-hint .hint-key {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Roboto Mono', monospace;
  font-size: 12px;
}

.db-edit-hint .hint-sep {
  opacity: 0.5;
}

@keyframes dbHintFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Image editable indicator */
#dashboardCanvas img {
  cursor: pointer;
  transition: outline 0.2s ease;
}

#dashboardCanvas img:hover {
  outline: 2px dashed rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* Selected component highlight */
.dashboard-component-wrapper.selected {
  outline: 2px solid #3b82f6;
  outline-offset: 4px;
  border-radius: 8px;
}

/* ==========================================
   ATOMIC DESIGN - ATOMS
   ========================================== */

/* ----- Ghost Button ----- */
.action-btn.ghost {
  background: transparent;
  color: #64748b;
  border: none;
}

.action-btn.ghost:hover {
  background: #f1f5f9;
  color: #334155;
}

/* ----- Icon Button ----- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

/* ----- Badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
}

.badge.success {
  background: #d1fae5;
  color: #059669;
}

.badge.warning {
  background: #fef3c7;
  color: #d97706;
}

.badge.danger {
  background: #fee2e2;
  color: #dc2626;
}

.badge.info {
  background: #dbeafe;
  color: #2563eb;
}

/* ----- Avatar Sizes ----- */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.avatar-md {
  width: 40px;
  height: 40px;
  font-size: 15px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

/* ----- Checkbox ----- */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #334155;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  accent-color: #3b82f6;
}

/* ----- Toggle Switch ----- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.2s;
  border-radius: 24px;
}

.toggle-slider::before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #3b82f6;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ----- Typography ----- */
.db-heading-1 {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  margin: 0;
}

.db-heading-2 {
  font-size: 22px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
  margin: 0;
}

.db-heading-3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
  margin: 0;
}

.db-text {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  margin: 0;
}

.db-caption {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

/* ----- Divider ----- */
.db-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 16px 0;
}

/* ----- Icon Container ----- */
.db-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.db-icon.blue {
  background: #dbeafe;
  color: #2563eb;
}

.db-icon.green {
  background: #d1fae5;
  color: #059669;
}

.db-icon.purple {
  background: #ede9fe;
  color: #7c3aed;
}

.db-icon.orange {
  background: #fef3c7;
  color: #d97706;
}

/* ==========================================
   ATOMIC DESIGN - MOLECULES
   ========================================== */

/* ----- Avatar with Info ----- */
.avatar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-info-text {
  min-width: 0;
}

.avatar-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-email {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----- Form Helper ----- */
.form-helper {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
}

/* ----- Button Group ----- */
.button-group {
  display: inline-flex;
  gap: 0;
}

.button-group .action-btn {
  border-radius: 0;
  margin-left: -1px;
}

.button-group .action-btn:first-child {
  border-radius: 8px 0 0 8px;
  margin-left: 0;
}

.button-group .action-btn:last-child {
  border-radius: 0 8px 8px 0;
}

.button-group .action-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

/* ----- Breadcrumb ----- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.breadcrumb-item {
  color: #64748b;
  text-decoration: none;
}

.breadcrumb-item:hover:not(.active) {
  color: #3b82f6;
}

.breadcrumb-item.active {
  color: #334155;
  font-weight: 500;
}

.breadcrumb-separator {
  color: #cbd5e1;
}

/* ----- Pagination ----- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled):not(.active) {
  background: #f1f5f9;
  color: #334155;
}

.pagination-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-dots {
  color: #94a3b8;
  padding: 0 8px;
}

/* ----- Tabs ----- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: -1px;
}

.tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
}

.tab-btn:hover:not(.active) {
  color: #334155;
}

.tab-btn.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

/* ----- Search Compact ----- */
.search-bar.compact {
  max-width: 280px;
}

.search-bar.compact .search-input {
  padding: 8px 10px 8px 36px;
  font-size: 13px;
}

.search-bar.compact .search-icon {
  left: 10px;
  width: 16px;
  height: 16px;
}

/* ----- Notification Badge ----- */
.notification-icon {
  position: relative;
  display: inline-flex;
  color: #64748b;
  cursor: pointer;
}

.notification-icon:hover {
  color: #334155;
}

.notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----- List Item ----- */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.list-item:hover {
  background: #f8fafc;
}

.list-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-item-icon.blue {
  background: #dbeafe;
  color: #2563eb;
}

.list-item-icon.green {
  background: #d1fae5;
  color: #059669;
}

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

.list-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

/* ----- Metric Mini ----- */
.metric-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
}

.metric-label {
  font-size: 13px;
  color: #64748b;
}

.metric-value {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-left: auto;
}

.metric-change {
  font-size: 12px;
  font-weight: 600;
}

.metric-change.up {
  color: #059669;
}

.metric-change.down {
  color: #dc2626;
}

/* ----- Empty State ----- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
}

.empty-state-icon {
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 8px 0;
}

.empty-state-text {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 20px 0;
}

/* ----- Tooltip ----- */
.tooltip-container {
  position: relative;
  display: inline-flex;
}

.tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: #1e293b;
  color: white;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  z-index: 100;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

.tooltip-container:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* ==========================================
   ADDITIONAL ATOMS
   ========================================== */

/* ----- Button Sizes ----- */
.action-btn.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.action-btn.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.action-btn.danger {
  background: #dc2626;
  color: white;
}

.action-btn.danger:hover {
  background: #b91c1c;
}

.action-btn.success {
  background: #059669;
  color: white;
}

.action-btn.success:hover {
  background: #047857;
}

/* ----- Form Elements ----- */
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #334155;
}

.form-radio {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

.form-input-number {
  width: 100px;
}

.form-range {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  accent-color: #3b82f6;
}

/* ----- Spinner ----- */
.spinner {
  display: inline-flex;
  animation: spin 1s linear infinite;
  color: #3b82f6;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ----- Skeleton Loading ----- */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
}

.skeleton-text.skeleton-short {
  width: 60%;
}

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

.skeleton-image {
  height: 120px;
  width: 100%;
  margin-bottom: 12px;
}

.skeleton-container {
  padding: 16px;
}

.skeleton-card {
  padding: 16px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

/* ----- Status Dots ----- */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-dot.offline {
  background: #94a3b8;
}

.status-dot.busy {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* ----- Links ----- */
.text-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.text-link:hover {
  text-decoration: underline;
}

.text-link.external svg {
  opacity: 0.7;
}

/* ----- Tags ----- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}

.tag.blue {
  background: #dbeafe;
  color: #2563eb;
}

.tag.green {
  background: #d1fae5;
  color: #059669;
}

.tag.purple {
  background: #ede9fe;
  color: #7c3aed;
}

.tag-remove {
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0.6;
  font-size: 14px;
  padding: 0;
  margin: -2px -4px -2px 0;
}

.tag-remove:hover {
  opacity: 1;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ----- Image Placeholder ----- */
.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 2px dashed #e2e8f0;
  border-radius: 8px;
  padding: 40px;
  color: #94a3b8;
}

/* ----- Separators ----- */
.separator-vertical {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  margin: 0 12px;
}

.separator-text {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #94a3b8;
  font-size: 13px;
}

.separator-text::before,
.separator-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* ==========================================
   LAYOUT MOLECULES
   ========================================== */

/* ----- Flex Layouts ----- */
.flex-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-item {
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* ----- Grid Layouts ----- */
.layout-grid {
  display: grid;
  gap: 16px;
}

.layout-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.layout-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.layout-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-item {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

/* ----- Split Layout ----- */
.layout-split {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

.split-left,
.split-right {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

/* ----- Stack Layout ----- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-item {
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* ----- Inline Layout ----- */
.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-item {
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 13px;
}

/* ----- Section Layout ----- */
.layout-section {
  margin-bottom: 32px;
}

.section-heading {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.section-content {
  padding: 16px 0;
}

/* ----- Panel Layout ----- */
.panel {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.panel-body {
  padding: 20px;
}

.panel-footer {
  padding: 16px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ----- Box Layout ----- */
.box {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
}

.box.bordered {
  background: white;
  border: 1px solid #e2e8f0;
}

.box.shadowed {
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ----- Card Content ----- */
.card-content {
  min-height: 60px;
  color: #64748b;
  font-size: 14px;
}
