/* ============================================
   NIER: AUTOMATA UI — STYLE.CSS
   Senior Web Dev Recreation
   ============================================ */

/* ---------- Google Fonts Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Turret+Road:wght@300;400;500;700;800&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  --nier-beige: #dad4bb;
  --nier-dark: #4e4b42;
  --nier-black: #2b2b2b;
  --nier-active-text: #f2f2ef;
  --nier-dim: #b8b4a0;
  --nier-border: #c8c2a8;
  --nier-highlight: #57544a;
  --nier-shadow: rgba(75, 71, 60, 0.15);
  --nier-panel-bg: rgba(218, 212, 187, 0.5);
  --nier-scanline: rgba(0, 0, 0, 0.03);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--nier-beige);
  color: var(--nier-dark);
  font-family: 'Turret Road', monospace, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---------- Scanline / CRT Overlay ---------- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--nier-scanline) 2px,
    var(--nier-scanline) 4px
  );
}

/* ---------- Dot Pattern Background ---------- */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, var(--nier-dim) 0.8px, transparent 0.8px);
  background-size: 24px 24px;
  opacity: 0.25;
}

/* ---------- Main Wrapper ---------- */
.nier-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   SECTION: TOP NAVIGATION BAR
   ============================================ */
.nier-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 20px 0 0 0;
  border-bottom: 2px solid var(--nier-dark);
  position: relative;
}

/* ---------- Individual Nav Button ---------- */
.nier-nav-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  letter-spacing: 1px;
  padding: 14px 24px;
  background-color: var(--nier-beige);
  color: var(--nier-dark);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
}

.nier-nav-btn .nav-icon {
  font-size: 0.75rem;
  opacity: 0.7;
}

.nier-nav-btn:hover {
  background-color: var(--nier-dark);
  color: var(--nier-beige);
  text-decoration: none;
}

.nier-nav-btn:hover .nav-icon {
  opacity: 1;
}

/* Active state */
.nier-nav-btn.active {
  background-color: var(--nier-dark);
  color: var(--nier-active-text);
}

.nier-nav-btn.active .nav-icon {
  opacity: 1;
  color: var(--nier-active-text);
}

/* Decorative line connectors between nav items */
.nier-nav-btn:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -12px;
  top: 50%;
  width: 24px;
  height: 1px;
  background: var(--nier-dim);
  z-index: 2;
}

/* ============================================
   SECTION: PAGE TITLE
   ============================================ */
.nier-page-title {
  padding: 28px 0 20px 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.nier-page-title h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.5rem;
  color: var(--nier-dark);
  letter-spacing: 4px;
  line-height: 1;
}

.nier-page-title .subtitle {
  font-family: 'Turret Road', monospace;
  font-size: 1rem;
  font-weight: 500;
  color: var(--nier-dark);
  opacity: 0.7;
}

/* ============================================
   SECTION: 3-COLUMN MAIN CONTENT
   ============================================ */
.nier-content {
  display: flex;
  gap: 20px;
  flex: 1;
  padding-bottom: 20px;
  min-height: 480px;
}

/* ---------- Left Column: Item List ---------- */
.nier-col-left {
  flex: 0 0 310px;
  max-width: 310px;
  position: relative;
}

.nier-item-list-container {
  border: 1px solid var(--nier-border);
  position: relative;
  padding: 4px;
}

/* Decorative left-side bracket */
.nier-item-list-container::before {
  content: '◇';
  position: absolute;
  left: -20px;
  top: 16px;
  font-size: 0.65rem;
  color: var(--nier-dim);
}

/* ---------- Item List Entries ---------- */
.nier-item-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  border: 1px solid transparent;
  font-family: 'Turret Road', monospace;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--nier-dark);
}

.nier-item-entry:hover {
  background-color: rgba(78, 75, 66, 0.08);
}

.nier-item-entry.active {
  background-color: var(--nier-dark);
  color: var(--nier-active-text);
  border-color: var(--nier-dark);
}

.nier-item-entry .item-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nier-item-entry .item-icon {
  font-size: 0.75rem;
  opacity: 0.6;
}

.nier-item-entry.active .item-icon {
  opacity: 1;
}

.nier-item-entry .item-count {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Active badge */
.nier-item-entry .active-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
  letter-spacing: 2px;
  background: rgba(255, 255, 255, 0.15);
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-left: 8px;
}

/* ---------- Middle Column: Detail Panel ---------- */
.nier-col-middle {
  flex: 1;
  min-width: 0;
}

.nier-detail-panel {
  border: 1px solid var(--nier-border);
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Detail panel header */
.nier-detail-header {
  background-color: var(--nier-dark);
  color: var(--nier-active-text);
  padding: 10px 18px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  letter-spacing: 2px;
}

/* Detail image area */
.nier-detail-image {
  background-color: var(--nier-dim);
  margin: 16px;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  max-height: 260px;
}

.nier-detail-image img {
  max-width: 50%;
  max-height: 50%;
  object-fit: contain;
  filter: sepia(0.15) contrast(0.95);
}

/* Placeholder for image */
.nier-detail-image .placeholder-icon {
  font-size: 3rem;
  color: var(--nier-dark);
  opacity: 0.3;
}

/* Detail description */
.nier-detail-body {
  padding: 0 18px 12px 18px;
  flex: 1;
}

.nier-detail-body .item-type {
  font-family: 'Turret Road', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--nier-dark);
  margin-bottom: 4px;
}

.nier-detail-body .item-description {
  font-family: 'Turret Road', monospace;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--nier-dark);
  line-height: 1.5;
  opacity: 0.85;
}

/* Detail footer */
.nier-detail-footer {
  padding: 12px 18px;
  text-align: center;
  font-family: 'Turret Road', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--nier-dark);
  opacity: 0.7;
  border-top: 1px solid var(--nier-border);
}

/* ---------- Right Column: Status Panel ---------- */
.nier-col-right {
  flex: 0 0 300px;
  max-width: 300px;
}

.nier-status-panel {
  border: 1px solid var(--nier-border);
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Status header */
.nier-status-header {
  background-color: var(--nier-dark);
  color: var(--nier-active-text);
  padding: 10px 18px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  letter-spacing: 2px;
}

/* Status body */
.nier-status-body {
  padding: 14px 18px;
  flex: 1;
}

/* Character name & level row */
.nier-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.nier-status-row .label {
  font-family: 'Turret Road', monospace;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--nier-dark);
}

.nier-status-row .value {
  font-family: 'Turret Road', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--nier-dark);
}

.nier-char-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  color: var(--nier-dark);
}

.nier-char-level {
  font-family: 'Turret Road', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--nier-dark);
}

/* Divider */
.nier-status-divider {
  height: 1px;
  background-color: var(--nier-border);
  margin: 10px 0;
}

/* HP Bar */
.nier-hp-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.nier-hp-bar-container .label {
  font-family: 'Turret Road', monospace;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 30px;
}

.nier-hp-bar {
  flex: 0 0 60px;
  height: 8px;
  background-color: var(--nier-dim);
  position: relative;
  overflow: hidden;
}

.nier-hp-bar-fill {
  height: 100%;
  background-color: var(--nier-dark);
  transition: width 0.3s ease;
}

.nier-hp-bar-container .hp-value {
  font-family: 'Turret Road', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Chip slots (empty squares) */
.nier-chip-slots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.nier-chip-slot {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--nier-dim);
  background: transparent;
}

.nier-chip-slot.filled {
  background-color: var(--nier-dim);
}

/* Error status */
.nier-error-status {
  text-align: center;
  font-family: 'Turret Road', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--nier-dark);
  opacity: 0.6;
  padding: 10px 0;
  letter-spacing: 2px;
}

/* ============================================
   SECTION: BOTTOM BAR / FOOTER
   ============================================ */
.nier-footer {
  border-top: 2px solid var(--nier-dark);
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.nier-footer-left {
  font-family: 'Turret Road', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--nier-dark);
  opacity: 0.8;
}

.nier-footer-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nier-footer-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Turret Road', monospace;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--nier-dark);
}

.nier-footer-action .action-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-family: 'Press Start 2P', monospace;
  border: 1.5px solid var(--nier-dark);
  color: var(--nier-dark);
}

.nier-footer-action .action-icon.arrow-icon {
  font-size: 0.7rem;
}

/* ============================================
   SECTION: DECORATIVE BOTTOM STRIP
   ============================================ */
.nier-deco-strip {
  height: 28px;
  background: repeating-linear-gradient(
    90deg,
    var(--nier-dark) 0px,
    var(--nier-dark) 2px,
    transparent 2px,
    transparent 10px
  );
  opacity: 0.35;
  margin-top: 8px;
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

/* Fade in for panels on item switch */
.nier-detail-panel,
.nier-status-panel {
  transition: opacity 0.2s ease;
}

.nier-detail-panel.fade-switch,
.nier-status-panel.fade-switch {
  animation: nierFadeIn 0.25s ease;
}

@keyframes nierFadeIn {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Subtle glitch effect on page load */
@keyframes nierGlitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, -1px); }
  60% { transform: translate(-1px, 0); }
  80% { transform: translate(1px, 1px); }
}

.nier-wrapper {
  animation: nierGlitch 0.15s ease 0.1s 1;
}

/* Nav cursor blink */
@keyframes nierCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 1200px) {
  .nier-col-left {
    flex: 0 0 260px;
    max-width: 260px;
  }
  .nier-col-right {
    flex: 0 0 260px;
    max-width: 260px;
  }
}

@media (max-width: 992px) {
  .nier-content {
    flex-direction: column;
  }
  .nier-col-left,
  .nier-col-middle,
  .nier-col-right {
    flex: 1 1 auto;
    max-width: 100%;
  }
  .nier-nav {
    flex-wrap: wrap;
  }
  .nier-nav-btn:not(:last-child)::after {
    display: none;
  }
}

@media (max-width: 576px) {
  .nier-nav-btn {
    font-size: 0.55rem;
    padding: 10px 12px;
  }
  .nier-page-title h1 {
    font-size: 1rem;
  }
  .nier-footer-right {
    gap: 16px;
  }
}
