@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Poppins:wght@600;800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg: #030000; /* Pure black/red tint background */
  --panel: #0f0505; /* Dark red tinted panel */
  --primary: #ff0000; /* PURE RED */
  --primary-glow: rgba(255, 0, 0, 0.6);
  --primary-dark: #cc0000;
  --secondary: #ff3333; /* Lighter red */
  --text: #ffffff;
  --text-muted: #ffcccc; /* Reddish white */
  --text-2: #b36666; /* Muted red text */
  --danger: #ff0000;
  --warning: #ff8800;
  --success: #00ff00; /* Keep success green for usability, or make it red-white? Better keep green for status */
  --border-color: rgba(255, 0, 0, 0.4);
  --border-glow: rgba(255, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary);
}

.page {
  min-height: 100vh;
  position: relative;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(rgba(5, 0, 0, 0.9), rgba(5, 0, 0, 0.95)),
    url("../images/bg.jpg") center/cover no-repeat;
  filter: blur(2px);
}

/* Red Vignette Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(50, 0, 0, 0.4) 100%);
  pointer-events: none;
  z-index: -2;
  box-shadow: inset 0 0 100px rgba(255, 0, 0, 0.1);
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Modern Panel Style with Strong Red Border & Glow */
.panel {
  background: rgba(10, 0, 0, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.panel:hover {
  border-color: var(--primary);
  box-shadow: 0 0 25px rgba(255, 0, 0, 0.2);
}

.row {
  display: flex;
  gap: 24px;
}

.col {
  flex: 1;
}

/* Modern Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 4px; /* More angular for cyber look */
  border: 1px solid var(--border-color);
  background: rgba(20, 0, 0, 0.6);
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  text-shadow: 0 0 5px #fff;
}

.btn-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #000 !important;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}

.btn-primary:hover {
  background: #fff;
  color: var(--primary) !important;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background: rgba(255, 0, 0, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.brand {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 36px;
  letter-spacing: -2px;
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary);
  text-transform: uppercase;
}

.hero {
  text-align: center;
  padding: 100px 24px;
}

.hero h1 {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 24px;
  text-transform: uppercase;
  background: linear-gradient(to bottom, #fff, #ff0000);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(255,0,0,0.5));
}

.hero p {
  color: var(--text-muted);
  font-size: 18px;
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar - FULL RED THEME */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: rgba(5, 0, 0, 0.95);
  border-right: 1px solid var(--border-color);
  box-shadow: 5px 0 30px rgba(255, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  color: var(--primary);
  text-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 0, 0, 0.2);
}

.sidebar .logo .dot {
  width: 10px;
  height: 10px;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  transform: rotate(45deg);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 4px;
  color: var(--text-2); /* Reddish grey */
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Icon Red Color - FORCE RED */
.nav a i, .nav a .icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #ff0000 !important; /* Force Red */
  filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.8));
  transition: transform 0.2s ease;
}

.nav a:hover, .nav a.active {
  background: rgba(255, 0, 0, 0.1);
  color: #fff;
  border-color: var(--primary);
  box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.1);
}

.nav a:hover i, .nav a.active i {
  color: #fff;
  filter: drop-shadow(0 0 8px #fff);
  transform: scale(1.1);
}

/* Mobile Sidebar & Layout */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: rgba(10, 0, 0, 0.9);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.mobile-menu-btn:hover {
    background: var(--primary);
    color: white;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-2);
    font-size: 20px;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px; height: 32px;
    align-items: center; justify-content: center;
}
.sidebar-close-btn:hover { color: var(--primary); }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 992px) {
    .layout {
        display: block; /* Stack layout on mobile */
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100vh;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar-close-btn {
        display: flex;
    }
    
    .content {
        padding: 80px 16px 32px 16px; /* Top padding for menu button */
        max-width: 100%;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Card Styling */
.card {
  background: rgba(10, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--primary);
  opacity: 0.5;
  box-shadow: 0 0 10px var(--primary);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 0, 0, 0.1);
  background: rgba(20, 0, 0, 0.8);
}

.card .title {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.4;
  margin-bottom: 12px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}

.card .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
  font-size: 12px;
  margin-top: 16px;
  font-family: 'JetBrains Mono', monospace;
}

.severity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid transparent;
}

.sev-low { border-color: #00ff00; color: #00ff00; background: rgba(0,255,0,0.1); }
.sev-medium { border-color: #ffaa00; color: #ffaa00; background: rgba(255,170,0,0.1); }
.sev-high { border-color: #ff0000; color: #ff0000; background: rgba(255,0,0,0.1); }
.sev-critical { 
  background: rgba(255, 0, 0, 0.2); 
  border-color: #ff0000; 
  color: #fff; 
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.4); 
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 0, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 0, 0, 0.2);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 2px;
  background: rgba(255,0,0,0.1);
  border: 1px solid rgba(255,0,0,0.2);
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.code {
  font-family: "JetBrains Mono","Fira Code", monospace;
  background: #050000;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  padding: 16px;
  color: #ffcccc;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
}

.form {
  display: grid;
  gap: 24px;
}

.field {
  display: grid;
  gap: 10px;
}

.label {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'JetBrains Mono', monospace;
}

.input, .select, .textarea {
  width: 100%;
  background: rgba(10, 0, 0, 0.6);
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 16px;
  outline: none;
  transition: all 0.2s ease;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
  background: rgba(20, 0, 0, 0.9);
}

.textarea {
  min-height: 150px;
  resize: vertical;
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: rgba(5, 0, 0, 0.9);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(20, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px 16px;
  width: 320px;
  transition: all 0.2s;
}

.search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.2);
  width: 340px;
}

.search i {
  color: var(--primary);
}

.search input {
  background: transparent;
  border: 0;
  outline: none;
  color: #fff;
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.search input::placeholder {
  color: var(--text-2);
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.gallery img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery img:hover {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
  transform: scale(1.02);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  cursor: zoom-out;
}

.lightbox.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 90vh;
  border: 1px solid var(--primary);
  box-shadow: 0 0 50px rgba(255, 0, 0, 0.3);
  border-radius: 4px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Matrix & ECG Effects */
#matrix {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 1;
  pointer-events: none;
}

#ecg {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(255, 0, 0, 0.05) 1px,
    rgba(255, 0, 0, 0.05) 2px
  );
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #000;
}

::-webkit-scrollbar-thumb {
  background: #330000;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Auth Panel */
.auth-panel {
  width: 100%;
  max-width: 480px;
  margin: 80px auto;
  padding: 32px;
}

.auth-panel-lg {
  max-width: 640px;
}

@media (max-width: 980px) {
  .auth-panel, .auth-panel-lg {
    margin: 40px auto;
    padding: 24px;
  }
  
  .hero h1 {
    font-size: 42px;
  }
  
  .hero p {
    font-size: 16px;
  }
  
  .brand {
    font-size: 24px !important; /* Override inline styles if any */
  }
  
  /* Fix Stacked Columns in Register/Profile */
  .row {
    flex-wrap: wrap;
  }
  
  .col {
    flex: 1 1 100%; /* Force full width on mobile */
  }
}

/* Mobile Toggle Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(10, 0, 0, 0.9);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:active {
  transform: scale(0.95);
  background: var(--primary);
  color: #000;
}

.mobile-menu-btn:hover {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
}

/* Sidebar Backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 9990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  touch-action: none;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar Close Button (Hidden on Desktop) */
.sidebar-close-btn {
  display: none;
}

/* Responsive Utilities */
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 9995;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--primary);
    background: rgba(5, 0, 0, 0.98);
    box-shadow: 10px 0 50px rgba(0,0,0,0.8);
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .sidebar-close-btn {
    display: block;
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease;
  }
  
  .sidebar-close-btn:hover {
    transform: rotate(90deg) scale(1.1);
    color: #fff;
  }
  
  .mobile-menu-btn {
    display: flex;
  }

  .content {
    padding: 20px 16px;
  }

  /* Header Bar Responsive */
  .header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 16px;
    height: auto;
    position: relative; /* Unstick on mobile if needed, or keep sticky */
    top: 0;
  }
  
  .header-bar .row {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  /* Search & Filter stack */
  .header-bar form.row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search {
    width: 100%;
  }
  
  .search:focus-within {
    width: 100%;
  }

  /* Grid Responsive */
  .grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px !important;
  }
}

/* Table Responsive */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap; /* Prevent wrapping in cells */
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 0, 0, 0.1);
}

th {
  background: rgba(255, 0, 0, 0.05);
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}

td {
  font-size: 14px;
  color: var(--text);
}

tr:hover td {
  background: rgba(255, 0, 0, 0.02);
}

/* Sidebar Column in Post Detail */
.sidebar-col {
  max-width: 360px;
  width: 100%;
}

@media (max-width: 980px) {
  .sidebar-col {
    max-width: 100%;
  }
}

/* Comments Scroll Area */
.comments-scroll-wrapper {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
  border: 1px solid rgba(255, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  scroll-behavior: smooth;
}

.comment-item {
  display: flex;
  gap: 12px;
  background: rgba(10, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 0, 0, 0.1);
  padding: 12px;
  transition: background 0.2s;
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-item:hover {
  background: rgba(20, 0, 0, 0.6);
}

.comment-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--primary);
  background: #000;
}

.comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment-avatar.small {
  width: 24px;
  height: 24px;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  background: rgba(255, 0, 0, 0.2);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
}

.avatar-placeholder.small {
  font-size: 10px;
}

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

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.comment-author {
  font-weight: 700;
  color: var(--primary);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}

.comment-date {
  font-size: 10px;
  color: var(--text-2);
}

.comment-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  word-wrap: break-word;
}

.comment-replies {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 0, 0, 0.1);
}

.reply-item {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 0, 0, 0.05);
}

.reply-item:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
