/* ========================================
   Rogue Cortex Developer Portal
   ======================================== */

/* --- Preview Gate --- */

.preview-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.preview-gate-box {
  background: #ffffff;
  border: 1px solid #d5d5d5;
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.preview-gate-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888888;
  margin-bottom: 32px;
}

.preview-gate-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.preview-gate-subtitle {
  font-size: 0.95rem;
  color: #555555;
  margin: 0 0 28px;
  line-height: 1.5;
}

.preview-gate-error {
  background: #fff0f0;
  border: 1px solid #f5c2c2;
  border-radius: 6px;
  color: #c0392b;
  font-size: 0.875rem;
  padding: 10px 14px;
  margin-bottom: 20px;
}

.preview-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-gate-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  background: #f8f8f8;
  color: #222222;
  outline: none;
  transition: border-color 0.15s;
}

.preview-gate-input:focus {
  border-color: #222222;
  background: #ffffff;
}

.preview-gate-submit {
  width: 100%;
  padding: 12px;
  background: #222222;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.preview-gate-submit:hover {
  background: #444444;
}

/* --- Reset & Base --- */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: #1a1a2e;
  background: #fafafa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: #4361ee;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; margin-top: 2rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }

code {
  background: #eef;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* --- Container --- */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Top Nav --- */

.top-nav {
  background: #1a1a2e;
  color: #fff;
  padding: 0 1.5rem;
}

.nav-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}
.brand-link img {
  filter: brightness(0) invert(1);
}
.brand-link:hover {
  text-decoration: none;
  color: #c3c3ff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-links a {
  color: #ccc;
  font-size: 0.9rem;
  font-weight: 600;
}
.nav-links a:hover {
  color: #fff;
  text-decoration: none;
}

.nav-admin-link {
  color: #f7c948 !important;
}

.nav-button {
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}
.nav-button:hover {
  background: #333;
  color: #fff;
}

.nav-divider {
  color: #555;
}

/* Admin theme — black to distinguish from portal */
.admin-nav {
  background: #111;
  border-bottom: 3px solid #555;
}
.admin-nav .nav-links a {
  color: #eee;
}
.admin-nav .nav-links a:hover {
  color: #fff;
}
.admin-nav .brand-link {
  color: #fff;
}
.admin-nav .nav-button {
  color: #eee;
  border-color: #666;
}
.admin-nav .nav-button:hover {
  background: #333;
  color: #fff;
}
.admin-nav .nav-divider {
  color: #666;
}

.admin-layout {
  background: #f5f5f5;
}

.admin-layout .btn-primary {
  background: #333;
  color: #fff;
}
.admin-layout .btn-primary:hover {
  background: #111;
  color: #fff;
}

.admin-layout .btn-outline {
  border-color: #333;
  color: #333;
}
.admin-layout .btn-outline:hover {
  background: #333;
  color: #fff;
}

.admin-layout .btn-sm.btn-outline {
  border-color: #555;
  color: #555;
}
.admin-layout .btn-sm.btn-outline:hover {
  background: #333;
  color: #fff;
}

.admin-layout .stat-number {
  color: #111;
}
.admin-layout .stat-green { color: #2e7d32; }
.admin-layout .stat-red { color: #c62828; }

.admin-layout main a {
  color: #333;
}
.admin-layout main a:hover {
  color: #000;
}

/* --- Flash messages --- */

.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.flash-notice {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-alert {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* --- Buttons --- */

.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
  border: 1.5px solid transparent;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: #4361ee;
  color: #fff;
}
.btn-primary:hover {
  background: #3651d4;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #4361ee;
  color: #4361ee;
}
.btn-outline:hover {
  background: #4361ee;
  color: #fff;
}

.btn-danger {
  background: #e63946;
  color: #fff;
}
.btn-danger:hover {
  background: #c5303c;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

/* --- Hero (public landing) --- */

.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  text-align: center;
  padding: 6rem 1.5rem;
}

.hero h1 {
  font-size: 2.75rem;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #b0c4de;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.hero-actions .btn-outline {
  border-color: #fff;
  color: #fff;
}
.hero-actions .btn-outline:hover {
  background: #fff;
  color: #1a1a2e;
}

/* --- Features grid --- */

.features {
  max-width: 960px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.feature-card h3 {
  color: #4361ee;
}

/* --- Auth forms --- */

.auth-form-container {
  max-width: 460px;
  margin: 4rem auto;
  padding: 2.5rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.auth-form-container h2 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.form-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.form-fieldset legend {
  font-weight: 700;
  font-size: 0.9rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  width: 100%;
}

.auth-alt {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: #666;
}

/* --- Forms --- */

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.form-group-inline label {
  display: inline;
  margin-bottom: 0;
}

.form-group-inline input[type="date"] {
  width: auto;
}

.form-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-check input[type="checkbox"] {
  width: auto;
}
.form-check label {
  display: inline;
  margin-bottom: 0;
}

.form-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.form-errors {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}
.form-errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

/* --- Data tables --- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.data-table thead {
  background: #f0f0f5;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  font-weight: 600;
  color: #555;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr {
  border-top: 1px solid #eee;
}

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

.data-table .actions {
  white-space: nowrap;
  display: flex;
  gap: 0.4rem;
}

/* --- Detail cards --- */

.detail-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 2rem;
}

.detail-card dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
}

.detail-card dt {
  font-weight: 600;
  color: #666;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.detail-card dd {
  margin: 0;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.card-actions form {
  display: inline;
}

/* --- Page header (title + action button) --- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  margin-bottom: 0;
}

/* --- Stats grid (admin dashboard) --- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.stat-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: #4361ee;
}

.stat-green { color: #2e7d32; }
.stat-red { color: #c62828; }

.stat-label {
  display: block;
  color: #666;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

/* --- Badges --- */

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-doc      { background: #e8f5e9; color: #2e7d32; }
.badge-owner    { background: #ede7f6; color: #4527a0; }
.badge-member   { background: #f0f0f5; color: #555; }
.badge-active   { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #fce4ec; color: #c62828; }

/* --- Package cards --- */

.package-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.package-header h3 {
  margin: 0;
}

.package-actions {
  margin-top: 0.75rem;
}

/* --- Status bar --- */

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0f0f5;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  gap: 1rem;
}

.status-bar-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-green { background: #2e7d32; }
.status-dot-red { background: #c62828; }

/* --- Inline form (admin add package) --- */

.inline-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.form-select-inline {
  padding: 0.4rem 0.6rem;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}

/* --- Misc --- */

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.callout {
  background: #e3f2fd;
  border-left: 4px solid #4361ee;
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1.5rem;
}
.callout p { margin: 0; }

.empty-state {
  color: #888;
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

.text-muted {
  color: #888;
  font-size: 0.85rem;
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* --- Docs layout --- */

.docs-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.docs-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
}

.docs-sidebar-group {
  margin-bottom: 1.5rem;
}

.docs-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 0.5rem;
}

.docs-sidebar-link {
  display: block;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  color: #555;
  border-radius: 4px;
}
.docs-sidebar-link:hover {
  background: #f0f0f5;
  text-decoration: none;
  color: #1a1a2e;
}
.docs-sidebar-link.active {
  background: #4361ee;
  color: #fff;
}
.docs-sidebar-link.active:hover {
  background: #3651d4;
}

.docs-toc {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.docs-toc-link {
  display: block;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  color: #888;
}
.docs-toc-link:hover {
  color: #4361ee;
  text-decoration: none;
}
.docs-toc-h3 {
  padding-left: 1.25rem;
}

.docs-content {
  flex: 1;
  min-width: 0;
}

/* Markdown rendered content */
.docs-content h1 { margin-top: 0; }
.docs-content h2 {
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}
.docs-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

.docs-content pre {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

.docs-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.docs-content table th,
.docs-content table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  text-align: left;
  font-size: 0.9rem;
}
.docs-content table th {
  background: #f0f0f5;
  font-weight: 600;
}

/* Guide cards */
.guide-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.guide-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.guide-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.guide-card p {
  color: #666;
  font-size: 0.9rem;
  margin: 0;
}

/* API reference */
.api-module-desc {
  color: #666;
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.api-entry {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}
.api-entry:last-child {
  border-bottom: none;
}

.api-signature {
  background: #1a1a2e;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  overflow-x: auto;
}
.api-signature code {
  background: none;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.api-returns {
  font-size: 0.9rem;
  color: #555;
}

.api-params {
  margin: 0.75rem 0;
}

/* --- Footer --- */

.site-footer {
  padding: 32px 0 24px;
  border-top: 1px solid #d5d5d5;
  background: #e6e6e6;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  justify-content: center;
  gap: 48px;
  width: min(1200px, 92vw);
  margin: 0 auto 24px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  margin-bottom: 4px;
}

.footer-col-title-admin {
  color: #8b1a1a;
}

.footer-col a {
  color: #222;
  text-decoration: none;
  font-size: 0.95rem;
}

.footer-col a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-copy {
  text-align: center;
  font-size: 0.85rem;
  color: #888;
  border-top: 1px solid #d5d5d5;
  padding-top: 20px;
}

.admin-footer {
  background: #111;
  border-top: 1px solid #333;
}

.admin-footer .footer-col-title {
  color: #777;
}

.admin-footer .footer-col-title-admin {
  color: #d45555;
}

.admin-footer .footer-col a {
  color: #aaa;
}

.admin-footer .footer-col a:hover {
  color: #fff;
}

.admin-footer .footer-copy {
  color: #555;
  border-top-color: #333;
}

/* --- Responsive --- */

@media (max-width: 640px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 0.75rem 0;
    gap: 0.5rem;
  }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  .detail-card dl {
    grid-template-columns: 1fr;
  }
  .footer-inner {
    flex-wrap: wrap;
    gap: 24px 36px;
    padding: 0 1.5rem;
  }
  .docs-layout {
    flex-direction: column;
  }
  .docs-sidebar {
    width: 100%;
    position: static;
  }
}
