/* Steerage v2 styles inspired by Cleopatra template */
/* Typography */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Poppins');
}
.font-ubuntu, .v2 {
  font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji" !important;
}

.v2 h1, .v2 h2, .v2 h3, .v2 h4, .v2 h5, .v2 h6,
.v2 .h1, .v2 .h2, .v2 .h3, .v2 .h4, .v2 .h5, .v2 .h6 {
  text-transform: capitalize;
  color: #0f172a; /* slate-900 */
  letter-spacing: -0.01em;
}
.v2 p {
  text-transform: none; /* keep paragraph readability */
  letter-spacing: .02em; /* tracking-wider */
  font-size: 0.875rem; /* text-sm */
  color: var(--c-subtle);
  line-height: 1.7;
}

.v2 .h1 { font-size: 3.75rem; font-weight: 900; }
.v2 .h2 { font-size: 3rem; font-weight: 800; }
.v2 .h3 { font-size: 2.25rem; font-weight: 800; }
.v2 .h4 { font-size: 1.875rem; font-weight: 800; }
.v2 .h5 { font-size: 1.5rem; font-weight: 800; }
.v2 .h6 { font-size: 1.25rem; font-weight: 800; }

/* Color system */
:root {
  --c-bg: #f8fafc;         /* slate-50 */
  --c-surface: #ffffff;    /* white */
  --c-border: #e2e8f0;     /* slate-200 */
  --c-muted: #94a3b8;      /* slate-400 */
  --c-text: #0f172a;       /* slate-900 */
  --c-subtle: #475569;     /* slate-600 */

  --c-primary: #4f46e5;    /* indigo-600 */
  --c-primary-700: #4338ca;/* indigo-700 */
  --c-primary-50: #eef2ff; /* indigo-50 */

  --c-secondary: #334155;  /* slate-700 */
  --c-success: #16a34a;    /* green-600 */
  --c-danger: #dc2626;     /* red-600 */
  --c-warning: #ca8a04;    /* yellow-600 */

  --radius-lg: 1rem;
  --radius-md: .75rem;
  --radius-sm: .5rem;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12);

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
}

/* Layout */
.v2 {
  background: var(--c-bg);
  color: var(--c-subtle);
}

.app-sidebar {
  position: fixed;
  top: 4rem; /* sit directly under the topbar */
  bottom: 0;
  left: 0;
  width: 16rem; /* w-64 */
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  border-left: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none; /* no shadow per requirement */
  padding: var(--space-4);
  overflow-y: auto;
  z-index: 10;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.app-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: #0f172a;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border-radius: .5rem;
  color: #334155;
  text-decoration: none;  
  transition: background .2s ease, color .2s ease;
}
.sidebar-link:hover {
  background: rgba(79,70,229,.08);
  color: var(--c-primary);
}
.sidebar-link.active {
  background: rgba(79,70,229,.13);
  color: var(--c-primary);
}

.app-main {
  margin-left: 16rem; /* account for sidebar */
  padding-top: 4rem;  /* account for fixed topbar */
  padding-left: 1rem;
  padding-right: 1rem;
  min-height: 100vh;
}
@media (max-width: 1024px) {
  .app-sidebar { position: static; width: auto; border-radius: 0; box-shadow: none; top: 0; bottom: 0; border-right: 0; }
  .app-main { margin-left: 0; padding-top: 4rem; }
}

/* Cards */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card-soft {
  background: #fafafa;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4rem; /* ~mt-16 in Cleopatra */
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 1.5rem; /* similar to p-6 */
  background: #ffffff;
  border-bottom: 1px solid var(--c-border);
  box-shadow: none;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji" !important; /* match Cleopatra navbar font */
  color: #111827; /* gray-900 */
}
.topbar-actions { display: flex; align-items: center; gap: .5rem; }

.brand { display: flex; align-items: center; gap: .5rem; }
.brand-logo { height: 2rem; width: auto; }
.brand-title { font-size: 1rem; font-weight: 700; color: #111827; text-transform: capitalize; }

/* Breadcrumb */
.breadcrumb {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--c-subtle);
  font-size: .8125rem;
}
.breadcrumb-list li { display: inline-flex; align-items: center; }
.breadcrumb-list li + li::before {
  content: '›';
  color: #94a3b8;
  margin: 0 .4rem;
}

/* Buttons (Cleopatra-inspired) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border-radius: .5rem;
  font-weight: 400;
  text-transform: capitalize;
  white-space: nowrap;
  transition: all .2s ease;
  border: 1px solid transparent;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--c-primary-700); }
.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}
.btn-secondary:hover { background: #cbd5e1; }
.btn-success {
  background: var(--c-success);
  color: #fff;
}
.btn-success:hover { filter: brightness(.95); }
.btn-danger {
  background: var(--c-danger);
  color: #fff;
}
.btn-danger:hover { filter: brightness(.95); }
.btn-indigo {
  background: #6366f1; /* indigo-500 */
  color: #eef2ff;
}
.btn-indigo:hover { background: #4f46e5; }

/* Alerts */
.alert {
  border-radius: .5rem;
  border: 1px solid var(--c-border);
  background: #eff6ff;
  color: #1d4ed8;
  padding: .75rem 1rem;
}

/* Tables */
.table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: .95rem;
}
.table thead th {
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .06em;
  background: #f8fafc;
  color: #475569;
  text-align: left;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--c-border);
}
.table tbody td {
  color: #0f172a;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--c-border);
}
.table tbody tr:nth-child(odd) { background: #fff; }
.table tbody tr:nth-child(even) { background: #f8fafc; }
.table tbody tr:hover { background: #eef2ff; }

/* Forms */
.form-label {
  display: block;
  margin-bottom: .35rem;
  font-size: .875rem;
  font-weight: 600;
  color: #0f172a;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: .5rem;
  background: #f8fafc;
  color: #0f172a;
  padding: .6rem .8rem;
  outline: none;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--c-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.form-hint { color: #64748b; font-size: .8125rem; }

.form-radio,
.form-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--c-primary);
}

/* Autocomplete list */
.autocomplete {
  position: absolute;
  z-index: 20;
  margin-top: .25rem;
  width: 100%;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: .5rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.autocomplete li {
  padding: .5rem .75rem;
  font-size: .9rem;
  cursor: pointer;
}
.autocomplete li:hover {
  background: var(--c-primary-50);
  color: var(--c-text);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal:not(.hidden) { display: flex; }
.modal-card {
  background: #fff;
  border-radius: .75rem;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-lg);
  width: min(48rem, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--c-border);
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}
.modal-close:hover { color: #0f172a; }
.modal-body {
  padding: 1rem;
  overflow: auto;
  flex: 1 1 auto;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: .75rem 1rem 1rem;
}

/* Utilities */
.section-subtitle {
  font-size: .9rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: .5rem;
}

/* Tooltips */
.tooltip {
  pointer-events: none;
}
.tooltip .tooltip-arrow[data-popper-arrow] {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #111827; /* match bg-gray-900 */
  left: 50%;
  top: -4px; /* arrow on top edge */
  transform: translateX(-50%) rotate(45deg);
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}

/* Normalize button font weight site-wide (overrides Tailwind font-medium) */
button, .btn, .rrf-action { font-weight: 400 !important; }

/* RRF cell layout: status (left) + fixed-width icon actions (right) */
.rrf-cell {
  display: grid;
  grid-template-columns: 1fr 120px; /* keep actions column constant width */
  align-items: center;
  gap: .5rem;
}
@media (max-width: 640px) {
  .rrf-cell { grid-template-columns: 1fr 96px; }
}
.rrf-status {
  min-height: 1.25rem; /* reserve space so rows don't jump when status appears */
}
.rrf-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .5rem;
  width: 120px; /* fixed area so icons align between rows */
}
@media (max-width: 640px) {
  .rrf-actions {
    width: 96px;
    gap: .25rem;
  }
}

/* Icon-only button styles */
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  border: 1px solid var(--c-border);
  background: #fff;
  color: #0f172a;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.icon-btn:hover { background: #f8fafc; }
.icon-btn i { margin: 0; font-size: 1.1rem; }

.icon-btn--primary {
  background: var(--c-primary);
  color: #fff;
  border-color: transparent;
}
.icon-btn--primary:hover { background: var(--c-primary-700); }

.icon-btn--success {
  background: var(--c-success);
  color: #fff;
  border-color: transparent;
}
.icon-btn--success:hover { filter: brightness(.95); }

/* Table captions for split result tables (UC/ER) */
.table-caption {
  display: table-caption;
  caption-side: top;
  width: 100%;
  text-align: left;
  padding: .75rem 1rem;
  font-weight: 600;
  border-radius: .5rem;
  margin-bottom: .5rem;
}
#friendlyCaption.table-caption {
  background: var(--c-primary-50); /* indigo-50 */
  color: var(--c-primary-700);     /* indigo-700 */
}
#resultsCaption.table-caption {
  background: #f3f4f6; /* gray-100 */
  color: #374151;      /* gray-700 */
}
