/* Pipelane Portal — App-specific Styles */
/* Layered on top of Tailwind CSS CDN */

/* ---- Base ---- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #111827;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #f9fafb;
}

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

.app-sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.2s ease;
}

.app-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 35;
}

.app-main {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

.app-topbar {
  display: none;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 1rem;
  height: 56px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-content {
  padding: 2rem;
  max-width: 1120px;
}

/* Mobile sidebar */
@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-sidebar-overlay.open {
    display: block;
  }
  .app-main {
    margin-left: 0;
  }
  .app-topbar {
    display: flex;
  }
  .app-content {
    padding: 1rem;
  }
}

/* ---- Nav items ---- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  margin: 0.125rem 0.75rem;
  border-radius: 0.5rem;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.nav-item:hover {
  background: #f3f4f6;
  color: #111827;
}

.nav-item.active {
  background: #f0fdfa;
  color: #0f766e;
  font-weight: 600;
}

.nav-item svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* ---- Buttons ---- */
.btn-primary {
  background-color: #0f766e;
  color: #fff;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background-color 0.15s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #0d6d66;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background-color: transparent;
  color: #0f766e;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  border: 1.5px solid #d1d5db;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: #f9fafb;
  border-color: #0f766e;
}

.btn-danger {
  background-color: transparent;
  color: #dc2626;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.813rem;
  border: 1px solid #fecaca;
  transition: background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-danger:hover {
  background-color: #fef2f2;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.813rem;
}

/* ---- Cards ---- */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.card-hover:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ---- Stat Cards ---- */
.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}

.stat-card .stat-sub {
  font-size: 0.813rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.data-table thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table thead th:hover {
  color: #111827;
}

.data-table thead th.sorted {
  color: #0f766e;
}

.data-table thead th .sort-arrow {
  display: inline-block;
  margin-left: 0.25rem;
  opacity: 0.4;
  font-size: 0.625rem;
}

.data-table thead th.sorted .sort-arrow {
  opacity: 1;
}

.data-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  vertical-align: middle;
}

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

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

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green {
  background: #ecfdf5;
  color: #065f46;
}

.badge-red {
  background: #fef2f2;
  color: #991b1b;
}

.badge-yellow {
  background: #fffbeb;
  color: #92400e;
}

.badge-gray {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-teal {
  background: #f0fdfa;
  color: #0f766e;
}

/* ---- Priority colors ---- */
.priority-highest, .priority-critical {
  color: #dc2626;
  font-weight: 700;
}

.priority-high {
  color: #ea580c;
  font-weight: 600;
}

.priority-medium {
  color: #ca8a04;
}

.priority-low {
  color: #6b7280;
}

.priority-lowest {
  color: #9ca3af;
}

/* ---- Misalignment highlight ---- */
.row-misaligned {
  background: #fffbeb !important;
  border-left: 3px solid #f59e0b;
}

.row-misaligned:hover {
  background: #fef3c7 !important;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
}

.empty-state .empty-icon {
  width: 3rem;
  height: 3rem;
  color: #d1d5db;
  margin: 0 auto 1rem;
}

.empty-state .empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}

.empty-state .empty-message {
  font-size: 0.875rem;
  color: #9ca3af;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
}

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

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

.skeleton-text {
  height: 0.875rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.25rem;
  width: 60%;
  margin-bottom: 0.75rem;
}

.skeleton-card {
  height: 100px;
  margin-bottom: 1rem;
}

/* ---- Onboarding Steps ---- */
.onboarding-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.onboarding-step.completed {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.onboarding-step.current {
  border-color: #0f766e;
  background: #f0fdfa;
}

.onboarding-step.disabled {
  opacity: 0.5;
}

.step-indicator {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.813rem;
}

.step-indicator.done {
  background: #0f766e;
  color: #fff;
}

.step-indicator.active {
  background: #f0fdfa;
  border: 2px solid #0f766e;
  color: #0f766e;
}

.step-indicator.pending {
  background: #f3f4f6;
  color: #9ca3af;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.813rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.form-hint {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* ---- Integration Cards ---- */
.integration-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.integration-card .integration-icon {
  width: 2.5rem;
  height: 2.5rem;
}

/* ---- Progress Bar ---- */
.progress-bar {
  height: 0.5rem;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  background: #0f766e;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ---- Toast / Notification ---- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #111827;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #991b1b;
}

.toast.success {
  background: #065f46;
}

/* ---- Filter pills ---- */
.filter-pills {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.1s ease;
}

.filter-pill:hover {
  border-color: #0f766e;
  color: #0f766e;
}

.filter-pill.active {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}

/* ---- Focus visible ---- */
:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Login page ---- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
}

.login-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border: 1.5px solid #d1d5db;
  border-radius: 0.5rem;
  background: #fff;
  color: #374151;
  font-weight: 600;
  font-size: 0.938rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  justify-content: center;
}

.google-btn:hover {
  border-color: #9ca3af;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.google-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}
