/* ============================================================================
   SEAMLESS OPS — Shared Styles
   ----------------------------------------------------------------------------
   WHAT: Brand tokens + chrome (topbar/sidebar) + base components used across
         every module page.
   WHY:  Mirrors the customer-portal navy/red palette so the ops app feels
         like part of the same family. Tokens live in :root so a future
         re-skin is one block of edits.
   ============================================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand — pulled from customer-portal/styles.css for visual consistency. */
  --navy-dark: #0a0a0a;
  --navy-mid: #1f2937;
  --navy-light: #0a0a0a;
  --red-dark: #002a0e;
  --red-mid: #004217;
  --red-accent: #0d6e2e;
  --red-light: #0d6e2e;

  /* Surfaces */
  --bg: #f5f6fa;
  --card-bg: #ffffff;
  --sidebar-bg: #0a0a0a;
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --sidebar-bg-active: #0d6e2e;

  /* Type */
  --text: #1f2937;
  --text-light: #4b5563;
  --text-muted: #9ca3af;

  /* Lines + lift */
  --border: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Layout constants used by chrome — both topbar and sidebar reference
     these so a height/width tweak stays in sync. */
  --topbar-h: 56px;
  --sidebar-w: 232px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--red-mid); text-decoration: none; }
a:hover { color: var(--red-dark); }

/* ============================================================================
   TOPBAR
   ----------------------------------------------------------------------------
   Fixed across the top. Holds brand + the current user's name/role + sign-out.
   ============================================================================ */
.ops-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--navy-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.ops-topbar-brand { display: flex; align-items: center; gap: 12px; }
.ops-topbar-name { font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }

/* Version stamp — lives next to the brand in the topbar so anyone
   glancing at any ops page can see exactly which build is loaded.
   Filled in by shell.js's loadVersionInfo() after version.js loads. */
.ops-version-stamp {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.ops-sidebar-toggle {
  /* Hidden on desktop, visible on mobile via media query below. */
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: none;
  padding: 4px 8px;
}

.ops-topbar-user { display: flex; align-items: center; gap: 12px; }
.ops-user-name { font-size: 14px; }
.ops-user-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  font-weight: 600;
}
/* Per-role color so a glance tells you who you're signed in as. */
.role-owner   { background: #fbbf24; color: #0a0a0a; }
.role-admin   { background: #004217; color: #0a0a0a; }
.role-manager { background: #34d399; color: #0a0a0a; }
.role-field   { background: #cbd5e1; color: #0a0a0a; }

.ops-signout {
  background: var(--red-mid);
  color: #fff;
  border: 0;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.ops-signout:hover { background: var(--red-dark); }

/* ============================================================================
   SIDEBAR
   ----------------------------------------------------------------------------
   Fixed left rail. On mobile it slides in from the left when toggled.
   ============================================================================ */
.ops-sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  padding: 16px 0;
  overflow-y: auto;
  z-index: 90;
  transition: transform 0.2s ease;
}

.ops-sidebar-link {
  display: block;
  padding: 12px 20px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ops-sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--sidebar-text-active);
}
.ops-sidebar-link.active {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-text-active);
  border-left-color: #fbbf24;
}

/* ============================================================================
   MAIN CONTENT WELL
   ----------------------------------------------------------------------------
   Every module page wraps its content in <main class="ops-main">. The
   margins offset for the fixed topbar + sidebar.
   ============================================================================ */
.ops-main {
  margin-top: var(--topbar-h);
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
}

.ops-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ops-page-header h1 { font-size: 24px; font-weight: 700; color: var(--navy-dark); }
.ops-page-header .ops-page-sub { color: var(--text-light); font-size: 14px; margin-top: 2px; }

/* ============================================================================
   CARDS — generic content block used by every module
   ============================================================================ */
.ops-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.ops-card h2 { font-size: 18px; margin-bottom: 12px; color: var(--navy-dark); }
.ops-card .ops-card-meta { font-size: 13px; color: var(--text-muted); }

/* Empty-state placeholder used in module-stub pages. */
.ops-stub {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.ops-stub h2 { font-size: 22px; color: var(--navy-dark); margin-bottom: 8px; }
.ops-stub p { font-size: 14px; max-width: 480px; margin: 0 auto; }
.ops-stub .ops-stub-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }

/* ============================================================================
   BUTTONS — primary/secondary/danger
   ============================================================================ */
.ops-btn {
  display: inline-block;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
}
.ops-btn:active { transform: translateY(1px); }
.ops-btn-primary { background: var(--red-mid); color: #fff; }
.ops-btn-primary:hover { background: var(--red-dark); }
.ops-btn-secondary { background: var(--navy-light); color: #fff; }
.ops-btn-secondary:hover { background: var(--navy-mid); }
.ops-btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.ops-btn-ghost:hover { background: var(--bg); }
.ops-btn-danger { background: #0d6e2e; color: #fff; }
.ops-btn-danger:hover { background: #004217; }
.ops-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================================
   FORMS
   ============================================================================ */
.ops-form-row { margin-bottom: 14px; }
.ops-form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.ops-form-row input,
.ops-form-row select,
.ops-form-row textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ops-form-row input:focus,
.ops-form-row select:focus,
.ops-form-row textarea:focus {
  outline: none;
  border-color: var(--red-mid);
  box-shadow: 0 0 0 3px rgba(185,28,28,0.12);
}

/* ============================================================================
   TABLES
   ============================================================================ */
.ops-table { width: 100%; border-collapse: collapse; }
.ops-table th, .ops-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.ops-table th {
  background: #f9fafb;
  color: var(--text-light);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ops-table tr:hover { background: #f9fafb; }

/* ============================================================================
   LOGIN PAGE — used by index.html only
   ============================================================================ */
.ops-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-light) 100%);
  padding: 20px;
}
.ops-login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.ops-login-card h1 {
  font-size: 22px;
  color: var(--navy-dark);
  margin-bottom: 4px;
  text-align: center;
}
.ops-login-card .ops-login-sub {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  margin-bottom: 24px;
}
.ops-login-error {
  background: #f9fafb;
  color: var(--red-dark);
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ============================================================================
   BLOCKED-ACCESS PAGE
   ============================================================================ */
.ops-blocked {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.ops-blocked-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.ops-blocked-card h1 { color: var(--red-dark); font-size: 20px; margin-bottom: 12px; }
.ops-blocked-card p { color: var(--text-light); font-size: 14px; margin-bottom: 20px; }

/* ============================================================================
   MOBILE
   ============================================================================ */
@media (max-width: 768px) {
  .ops-sidebar-toggle { display: inline-block; }

  /* On mobile the sidebar is off-canvas by default. shell.js toggles `.open`. */
  .ops-sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 12px rgba(0,0,0,0.2);
  }
  .ops-sidebar.open { transform: translateX(0); }

  .ops-main {
    margin-left: 0;
    padding: 16px;
  }

  .ops-topbar-user .ops-user-name { display: none; } /* keep just the role chip + signout on small screens */
  .ops-version-stamp { display: none; }              /* brand alone is enough on a phone — version is a desktop affordance */
}
