/* ═══════════════════════════════════════════════════════════
   TrainOptix — Login + Dashboard Styles
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Montserrat:wght@600;700&display=swap');

/* ── Design Tokens ── */
:root {
  --brand-500: #28729ff0;
  --brand-600: #1f6490;
  --brand-700: #134665f0;
  --ink-900: #101828;
  --ink-800: #1f2937;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-300: #d0d7e1;
  --ink-200: #e5e7eb;
  --panel: #efefef57;
  --page-bg: #f6f7fb;
  --surface: #fff;
  --border: #e6e7ef;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(16,24,40,.06), 0 1px 1px rgba(16,24,40,.04);
  --shadow-2: 0 6px 16px rgba(16,24,40,.12);
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.55;
  color: var(--ink-800);
  overflow-x: hidden;
}

body {
  height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.55;
  color: var(--ink-800);
  overflow-x: hidden;
  background-color: var(--page-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ── */
h1 {
  color: var(--ink-900);
  font-weight: 600;
  margin-bottom: 12px;
}

h2 {
  color: var(--ink-900);
  font-weight: 400;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--brand-500);
  padding-bottom: 6px;
  font-size: 1.5rem;
  display: inline-block;
  letter-spacing: .2px;
}

/* ══════════════════════════════════════
   HEADER
   ══════════════════════════════════════ */
.header {
  background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
  color: #fff;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-1);
}

.header .left {
  display: flex;
  align-items: center;
}

.header-logo {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
}

.header .right2 {
  font-size: 1.65rem;
  font-weight: 600;
}

.header .right {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Logout Button ── */
.logout-button {
  background: linear-gradient(90deg, #ffffff, #ededed);
  color: #161616b5;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
}

.logout-button:hover {
  background: linear-gradient(90deg, #e9e9e9, #e7e7e7);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.logout-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-1);
}

/* ══════════════════════════════════════
   LAYOUT: Sidebar + Main Content
   ══════════════════════════════════════ */
.container {
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 0;
  gap: 16px;
  padding-right: 20px;
}

/* ── Sidebar ── */
.sidebar {
  width: 20%;
  min-width: 200px;
  background: var(--surface);
  padding: 1rem .5rem;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(16,24,40,.04);
  display: flex;
  flex-direction: column;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar ul > li {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #f3f3f3;
  margin: 0.5rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
  font-weight: 600;
  color: var(--ink-700);
}

.sidebar ul > li:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow-2);
  background: #f9fafb;
}

.sidebar ul > li.active {
  background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
  color: #fff;
  box-shadow: var(--shadow-2);
}

.sidebar ul > li.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar ul > li:last-child {
  margin-bottom: 1rem;
}

/* ── Forecast submenu ── */
#forecastTools {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-bottom: 0;
  color: var(--ink-700);
}

#forecastTools > span:first-of-type {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
  font-weight: 600;
  padding: .1rem .25rem;
  border-radius: var(--radius-sm);
}

#forecastTools > span:first-of-type:hover {
  background: #eef2f7;
  transform: translateX(2px);
}

.hamburger {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #4d4d4d;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.sidebar .submenu {
  display: none;
  padding: 0;
  margin: .25rem 0 0;
  list-style: none;
  background: transparent;
}

.sidebar .submenu.show {
  display: block;
}

.sidebar .submenu li {
  height: 36px;
  padding: 0.6rem 0.8rem;
  font-weight: 600;
  text-align: left;
  background: #f7f7f9;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  line-height: 1;
  transition: background 0.2s ease;
}

.sidebar .submenu li:hover {
  background: #eceff4;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);
  padding: 24px;
  margin-top: 16px;
  overflow-y: auto;
}

/* ── Panel ── */
.panel {
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-bottom: 20px;
  border: 1px solid #c9c9c91f;
  box-shadow: var(--shadow-1);
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.2rem;
}

.panel p {
  margin-bottom: 1rem;
}

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */
.primary-btn {
  display: inline-block;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  user-select: none;
  box-shadow: var(--shadow-1);
  transition: transform .2s ease, box-shadow .2s ease, background .3s ease;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}

.primary-btn:hover {
  background: linear-gradient(90deg, var(--brand-600), var(--brand-700));
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.primary-btn:focus {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ══════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════ */
#loginPageBody {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #000;
}

#contentContainer {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #000 url('images/JRS-Background-Portal.png') center / cover no-repeat;
}

/* ── Login Card ── */
#loginCardContainer {
  position: relative;
  z-index: 1;
  background: #ffffffe3;
  width: 100%;
  max-width: 500px;
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  text-align: left;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#loginHeaderContainer {
  text-align: center;
}

#loginHeaderContainer h2 {
  display: inline-block;
  margin: 0 0 12px;
  text-align: center;
}

#loginFormContainer {
  text-align: left;
}

#loginFormContainer label {
  display: block;
  margin: .75rem 0 .25rem;
  font-weight: 600;
}

#loginFormContainer input {
  width: 100%;
  height: 44px;
  padding: 0 .75rem;
  box-sizing: border-box;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
  margin-bottom: 12px;
  font-size: 1rem;
}

#loginFormContainer input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(40, 114, 159, 0.18);
  outline: 0;
}

#loginForm {
  text-align: left;
}

#loginForm .primary-btn {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: .25rem;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 1px;
  font-size: 1.25rem;
  text-align: center;
}

/* ── Footer ── */
#footerContainer {
  background: #222;
  color: #fff;
  text-align: center;
  padding: 10px;
  font-size: 0.9rem;
  z-index: 2;
}

/* ══════════════════════════════════════
   DASHBOARD CARDS
   ══════════════════════════════════════ */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-1);
  transition: transform .15s ease, box-shadow .15s ease;
}

.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.dash-card-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.dash-card-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}

.dash-card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink-900);
}

/* ══════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    padding-right: 0;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .main-content {
    margin-top: 0;
    border-radius: 0;
  }

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

@media (max-width: 480px) {
  .dashboard-cards {
    grid-template-columns: 1fr;
  }
}

.sidebar a {
  color: inherit;
  text-decoration: none;
  display: block;
}

.sidebar small {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-500);
}

.sidebar li.active small {
  color: rgba(255, 255, 255, 0.85);
}

.sidebar-note {
  margin: 12px 10px 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #eef4f8;
  color: var(--ink-600);
  font-size: 0.82rem;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.header-user {
  color: #fff;
  font-weight: 600;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.role-super_admin {
  background: rgba(107, 33, 168, 0.22);
}

.role-admin {
  background: rgba(159, 18, 57, 0.22);
}

.role-manager {
  background: rgba(22, 101, 52, 0.22);
}

.role-client {
  background: rgba(255, 255, 255, 0.15);
}

.eyebrow {
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--brand-600);
}

.page-lead {
  color: var(--ink-600);
  max-width: 70ch;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-1);
}

.info-card h3 {
  margin-bottom: 8px;
  color: var(--ink-900);
}

.info-card p + p {
  margin-top: 8px;
}

.feature-list {
  padding-left: 18px;
}

.feature-list li + li {
  margin-top: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  color: var(--ink-700);
  font-weight: 700;
  width: 220px;
}

.notice {
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fff4db;
  color: #8a5a00;
  font-weight: 600;
  margin-bottom: 16px;
}

.main-content--narrow {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.flash-message {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.flash-message--success {
  background: #eefbea;
  border: 1px solid #97c58a;
  color: #215c1d;
}

.flash-message--error {
  background: #fff0f0;
  border: 1px solid #d99;
  color: #8a2020;
}

.flash-message--info {
  background: #eef5fb;
  border: 1px solid #a6c5dd;
  color: #1f577d;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.stack-form--compact {
  gap: 10px;
  margin-top: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field label {
  font-weight: 600;
  color: var(--ink-700);
}

.form-field input,
.form-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-900);
}

.form-field input:focus,
.form-field select:focus {
  outline: 2px solid rgba(40, 114, 159, 0.2);
  border-color: var(--brand-500);
}

.form-field--wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions--compact {
  margin-top: 2px;
}

.secondary-btn {
  display: inline-block;
  background: #f3f4f6;
  color: var(--ink-800);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease, box-shadow .15s ease;
}

.secondary-btn:hover {
  background: #e9edf2;
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}

.muted-copy {
  color: var(--ink-500);
}

.mega-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.mega-admin-user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-1);
}

.mega-admin-user-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mega-admin-user-card__header h3 {
  margin-bottom: 4px;
  color: var(--ink-900);
}

.mega-admin-user-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--ink-500);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #fff;
}

.role-pill--super_admin {
  background: #6b21a8;
}

.role-pill--admin {
  background: #9f1239;
}

.role-pill--manager {
  background: #166534;
}

.role-pill--client {
  background: #475569;
}
