/* =========================
   PORT ARTEMIS BASE THEME
   ========================= */

:root {
  --bg-main: #061015;
  --bg-panel: #0c1b22;
  --bg-panel-2: #0f232b;
  --accent: #4fd1e8;
  --accent-soft: rgba(79, 209, 232, 0.15);
  --text-main: #d9faff;
  --text-muted: #7ecdd8;
  --border: rgba(79, 209, 232, 0.25);
}

/* =========================
   GLOBAL BACKGROUND LOCK
   ========================= */

html,
body {
  background-color: #0a0e1a !important;
}

#app {
  background-color: transparent !important;
}

body {
  background: #0a0e1a;
  color: var(--text-main);
  font-family: 'Orbitron', sans-serif;
}

/* Prevent Bootstrap gutter bleed */
.container-fluid,
.row {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* =========================
   HEADER IMAGE RESTORE
   ========================= */

.site-header-image {
  display: block;
  width: 100%;
  height: 320px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  z-index: 1;
}

/* =========================
   PANELS
   ========================= */

.card, .well, .content, .list-group-item {
  background: var(--bg-panel) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 0 20px rgba(79, 209, 232, 0.08);
  position: relative;
  overflow: hidden;
}

.modal-content {
  background: var(--bg-panel) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 0 20px rgba(79, 209, 232, 0.08);
  position: relative;
  overflow: visible !important;
}

.card .card-header,
.card .card-body {
  position: relative;
  overflow: hidden;
}

.card .card-header::after,
.card .card-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(79, 209, 232, 0.06),
    rgba(79, 209, 232, 0.06) 2px,
    transparent 2px,
    transparent 4px
  );
  animation: scanMove 6s linear infinite;
  pointer-events: none;
  z-index: 3;
}

.card .card-header > *,
.card .card-body > * {
  position: relative;
  z-index: 2;
}

.card.overflow-visible,
.card.overflow-visible .card-header,
.card.overflow-visible .card-body {
  overflow: visible;
}

.card.overflow-visible .selectize-dropdown {
  z-index: 4000;
}

/* =========================
   HUD CORNER BRACKETS
   ========================= */

.card::before,
.well::before,
.content::before,
.modal-content::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  top: 8px;
  left: 8px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 1;
}

.card::after,
.well::after,
.content::after,
.modal-content::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  bottom: 8px;
  right: 8px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 1;
}

/* =========================
   MODAL FIX
   ========================= */

/* Fix modal click blocking issue */
.modal-backdrop {
  z-index: 2100 !important;
  pointer-events: none !important;  /* Backdrop should not capture clicks */
  opacity: 0 !important;  /* Hide the backdrop entirely */
  display: none !important;
}

.modal {
  z-index: 2200 !important;
  pointer-events: none !important;  /* Modal container passes through clicks */
}

.modal-open .modal {
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: none !important;
}

.modal-dialog {
  position: relative;
  z-index: 2250 !important;
  pointer-events: auto !important;
  margin: 1.75rem auto;
}

.modal-content {
  pointer-events: auto !important;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background-clip: padding-box;
  outline: 0;
}

/* Ensure all modal interactive elements work */
.modal-header,
.modal-body,
.modal-footer,
.modal-header *,
.modal-body *,
.modal-footer * {
  pointer-events: auto !important;
}

.modal button,
.modal .close,
.modal a,
.modal input,
.modal select,
.modal textarea {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* Make close button always visible and clickable */
.modal .close {
  position: relative;
  z-index: 2300 !important;
  opacity: 1 !important;
}

/* =========================
   TABLES
   ========================= */

.table {
  color: var(--text-main);
}

.table th,
.table td {
  color: var(--text-main);
  border-color: var(--border) !important;
}

.table thead th {
  color: #9befff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(79, 209, 232, 0.06);
}

.table-striped tbody tr:nth-of-type(even) {
  background-color: rgba(12, 27, 34, 0.35);
}

.selectize-dropdown {
  z-index: 5000 !important;
}

/* =========================
   HEADINGS
   ========================= */

h1, h2, h3, h4 {
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(79, 209, 232, 0.4);
}

/* =========================
   LINKS
   ========================= */

a { color: var(--accent); }

a:hover {
  color: #9befff;
  text-shadow: 0 0 6px var(--accent);
}

/* =========================
   BUTTONS
   ========================= */

.btn-primary {
  background: linear-gradient(135deg, #0f3b46, #145b69) !important;
  border: 1px solid var(--accent) !important;
  color: var(--text-main) !important;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.25s ease;
}

.btn-primary:hover {
  box-shadow: 0 0 12px var(--accent);
  transform: translateY(-2px);
}

/* =========================
   NAVBAR
   ========================= */

.navbar {
  background: rgba(5, 20, 25, 0.95) !important;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 2000;
}

.navbar .dropdown-menu {
  z-index: 3000 !important;
  position: absolute !important;
}

/* =========================
   NOTIFICATION PULSE
   ========================= */

.badge,
.notification,
.alert-indicator {
  position: relative;
}

.badge::after,
.notification::after,
.alert-indicator::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.8); opacity: 0.6; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { opacity: 0; }
}

/* =========================
   SCROLLBARS
   ========================= */

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-panel); }
::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 10px var(--accent);
}
::-webkit-scrollbar-thumb:hover { background: #9befff; }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-panel);
}

/* =========================
   RARITY BORDERS
   ========================= */

.rarity-common { border-color: #888 !important; }

.rarity-uncommon {
  border-color: #4caf50 !important;
  box-shadow: 0 0 8px #4caf50;
}

.rarity-rare {
  border-color: #2196f3 !important;
  box-shadow: 0 0 12px #2196f3;
}

.rarity-epic {
  border-color: #9c27b0 !important;
  box-shadow: 0 0 14px #9c27b0;
  animation: epicGlow 2s infinite alternate;
}

.rarity-legendary {
  border-color: #ff9800 !important;
  box-shadow: 0 0 18px #ff9800;
  animation: legendaryPulse 1.8s infinite alternate;
}

@keyframes epicGlow {
  from { box-shadow: 0 0 10px #9c27b0; }
  to   { box-shadow: 0 0 20px #e040fb; }
}

@keyframes legendaryPulse {
  from { box-shadow: 0 0 15px #ff9800; }
  to   { box-shadow: 0 0 28px #ffc107; }
}

/* =========================
   HOME TERMINAL
   ========================= */

.home-terminal {
  padding: 40px;
  background: linear-gradient(
    180deg,
    rgba(6,16,21,0.95),
    rgba(12,27,34,0.95)
  );
  border: 1px solid var(--border);
  box-shadow:
    0 0 25px rgba(79,209,232,0.15),
    inset 0 0 30px rgba(79,209,232,0.05);
  position: relative;
  overflow: hidden;
}

.home-terminal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(79,209,232,0.03),
    rgba(79,209,232,0.03) 2px,
    transparent 2px,
    transparent 4px
  );
  animation: scanMove 6s linear infinite;
  pointer-events: none;
}

@keyframes scanMove {
  from { transform: translateY(0); }
  to   { transform: translateY(20px); }
}

/* =========================
   FIX: NEWS POST SQUISH
   ========================= */

/* Preserve newlines if content is stored as plain text */
.card-body,
.news-content,
.post-content,
.parsed-text,
.wysiwyg-content {
  white-space: normal;
  line-height: 1.7;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Restore breathing room for actual HTML paragraphs */
.card-body p,
.news-content p,
.post-content p {
  margin: 0 0 1.1em;
}

.card-body h1,
.card-body h2,
.card-body h3,
.card-body h4 {
  margin: 1.2em 0 0.6em;
}

/* =========================
   MAIN CONTENT SCAN LINES
   ========================= */

.main-content {
  position: relative;
  overflow: hidden;
}

.main-content::after {
  content: "";
  position: absolute;
  inset: -20px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(79, 209, 232, 0.04),
    rgba(79, 209, 232, 0.04) 1.5px,
    transparent 1.5px,
    transparent 3px
  );
  animation: scanMove 6s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.main-content > * {
  position: relative;
  z-index: 2;
}
/* Reduce card body padding inside home terminal */
.home-terminal .card-body {
  padding: 20px !important;
}
/* =========================================
   NEWS BODY: preserve line breaks (no squish)
   - pre-line respects \n newlines
   - normal paragraphs still behave normally
========================================= */
.news-body {
  white-space: pre-line !important;
  line-height: 1.7;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* If the parser outputs real HTML blocks, keep them pretty */
.news-body p { margin: 0 0 1.1em; }
.news-body h1, .news-body h2, .news-body h3, .news-body h4 { margin: 1.2em 0 0.6em; }
.news-body ul, .news-body ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.news-body li { margin: 0.25em 0; }
