/**
 * ILACM Application Styling
 * Consumes design-tokens.css variables
 */

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  margin: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* App Layout Shell */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: width 0.2s ease, background-color 0.2s ease;
}

.sidebar-brand {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.75rem;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--brand-primary), #6366F1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 1.1rem;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.75rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

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

.nav-link.active {
  background-color: var(--brand-primary-subtle);
  color: var(--brand-primary);
  font-weight: 600;
}

.nav-link i {
  font-size: 1.1rem;
}

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

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: 64px;
  background-color: var(--bg-topbar);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.app-content {
  flex: 1;
  padding: 1.75rem;
}

/* Cards & Surfaces */
.card-executive {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-executive:hover {
  border-color: var(--border-strong);
}

.kpi-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-subtext {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

/* Tables */
.table-executive {
  width: 100%;
  color: var(--text-primary);
  margin-bottom: 0;
}

.table-executive th {
  background-color: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.table-executive td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 0.9rem;
}

.table-executive tbody tr:hover {
  background-color: var(--bg-surface-hover);
}

/* Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-status.active, .badge-status.opted_in, .badge-status.approved {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.badge-status.pending_review, .badge-status.scheduled, .badge-status.unconfirmed {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-status.paused, .badge-status.draft, .badge-status.disconnected {
  background-color: var(--bg-surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-status.failed, .badge-status.opted_out, .badge-status.dead_letter {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-status.connected {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.badge-status.unavailable {
  background-color: var(--bg-surface-hover);
  color: var(--text-muted);
}

/* Buttons */
.btn-brand {
  background-color: var(--brand-primary);
  color: #FFFFFF;
  border: none;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  transition: background-color 0.15s ease;
}

.btn-brand:hover {
  background-color: var(--brand-primary-hover);
  color: #FFFFFF;
}

.btn-danger-kill {
  background-color: var(--color-danger);
  color: #FFFFFF;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
}

.btn-danger-kill:hover {
  background-color: #B91C1C;
  color: #FFFFFF;
}

/* Form Controls */
.form-control, .form-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
}

.form-control:focus, .form-select:focus {
  background-color: var(--bg-surface);
  border-color: var(--brand-primary);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-subtle);
}

/* Dropzone for Bulk Uploads */
.upload-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background-color: var(--bg-surface-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--brand-primary);
  background-color: var(--brand-primary-subtle);
}

/* Responsive */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-main {
    margin-left: 0;
  }
}
