/* ==========================================================================
   FourZeroFour Servers
   ========================================================================== */

/* --- Font & Base Styles --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   ROOT VARIABLES
   ========================================================================== */
:root {
  /* --- Colors: Backgrounds --- */
  --primary-bg: #1e1e24;
  --secondary-bg: #232528;
  --tertiary-bg: #2c2f33;
  --interactive-bg: #36393f;
  --interactive-bg-hover: #4a4d52; /* Added for consistency on hovers */

  /* --- Colors: Borders --- */
  --primary-border: #3a3d42;
  --interactive-border: #4f545c;
  
  /* --- Colors: Text --- */
  --primary-text: #e0e0e0;
  --secondary-text: #b9bbbe;
  --tertiary-text: #a0a0a0;
  --disabled-text: #7f8c8d;
  --link-text-inverted: #fff; /* For text on dark accent backgrounds */

  /* --- Colors: Accents & Status --- */
  --accent-orange: #ff6f00;
  --accent-orange-hover: #ff8c42;
  --focus-ring-color: rgba(255, 111, 0, 0.3); /* Based on accent for focus states */

  --status-green: #2ecc71;
  --status-red: #e74c3c;

  /* --- Sizing & Spacing --- */
  --border-radius-sm: 5px;
  --border-radius-md: 8px;
  --border-radius-lg: 10px;

  /* --- Transitions & Effects --- */
  --transition-speed: 0.2s;
  --transition-timing: ease-in-out;
  --shadow-sm: 0 2px 5px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 10px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 25px rgba(0,0,0,0.2);
}

/* ==========================================================================
   BASE & TYPOGRAPHY
   ========================================================================== */

/* --- General Reset & Page Defaults --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px; /* Base font size for rem calculations */
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* Prevents content from being hidden by sticky headers */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--primary-bg);
  color: var(--primary-text);
  line-height: 1.6;
  min-height: 100dvh; /* Use dynamic viewport height for better mobile support */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Subtle grid pattern background */
  background-image:
    linear-gradient(rgba(45, 49, 56, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 49, 56, 0.5) 1px, transparent 1px);
  background-size: 35px 35px; /* Slightly larger grid for a cleaner look */
}

/* --- Accessibility & Focus --- */
/* A more prominent outline for keyboard navigation */
*:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 2px;
  box-shadow: none; 
}

/* --- Core Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--primary-text);
  margin-bottom: 0.75rem;
  line-height: 1.3;
  font-weight: 700;
  text-wrap: balance; /* Improves headline wrapping where supported */
}

p {
  margin-bottom: 1rem;
  color: var(--secondary-text);
  max-width: 75ch; /* Improves readability by limiting line length */
}
/* Unset max-width inside components where it's not desired */
.card > p, .tile > p, .flex-container > p, .grid-container > p {
  max-width: none;
}

a {
  color: var(--accent-orange);
  text-decoration: none;
  transition: color var(--transition-speed) var(--transition-timing);
}

a:hover,
a:focus-visible { /* Combine for consistent styling */
  color: var(--accent-orange-hover);
  text-decoration: underline;
  text-decoration-thickness: 1.5px; /* A subtle touch */
}

/* ==========================================================================
   LAYOUT CONTAINER & GRID AREAS
   ========================================================================== */
.container {
  display: grid;
  
  /* 
    Defines the main 3-column layout structure.
    - Sidebars have a fixed width (280px) for stability.
    - The main content area (1fr) is flexible and takes all remaining space.
  */
  grid-template-columns: 280px 1fr 280px;

  /*
    Defines the row structure.
    - Header and footer have automatic height based on their content.
    - The main row (`minmax(0, 1fr)`) expands to fill available vertical space,
      preventing content overflow issues with tall children.
  */
  grid-template-rows: auto minmax(0, 1fr) auto;
  
  grid-template-areas:
    "header header header"
    "left   main   right"
    "footer footer footer";

  max-width: 1800px;
  margin-inline: auto; /* Modern equivalent for horizontal centering */
}

/* Assigning page elements to their designated grid areas */
header                 { grid-area: header; }
main#content           { grid-area: main; }
aside.sidebar.left     { grid-area: left; }
aside.sidebar.right    { grid-area: right; }
footer                 { grid-area: footer; }

/* ==========================================================================
   CORE COMPONENTS (Header, Main, Footer)
   ========================================================================== */

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 2rem;
  
  /* Use RGBA of the primary background for a semi-transparent effect */
  background-color: rgba(30, 30, 36, 0.85); 
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--primary-border);
  transition: background-color var(--transition-speed) var(--transition-timing);
}

.banner-image {
  width: auto;
  max-height: 50px;
  object-fit: contain; /* Ensures the image scales correctly without distortion */
}

main#content {
  background-color: var(--secondary-bg); /* Use secondary-bg for a slight contrast */
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-lg);
  margin-block: 1.5rem; /* Vertical margin */
  margin-inline: 1.5rem; /* Horizontal margin */
  overflow: hidden; /* Contains child border-radii */
}

footer {
  background-color: var(--primary-bg);
  border-top: 1px solid var(--primary-border);
  padding: 2rem 1.5rem 1rem; /* Reduced bottom padding slightly */
  text-align: center;
  color: var(--secondary-text);
  font-size: 0.9em;
}

.footer-status {
  /* Replaces the ::before pseudo-element for better accessibility and structure */
  display: inline-block;
  margin-bottom: 1.5rem; /* Space between status and copyright text */
  padding: 0.25rem 1.25rem;
  font-weight: 600;
  font-size: 0.85em;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--primary-border);
  background-color: var(--tertiary-bg);
  color: var(--status-green); /* This should be updated via JS if status changes */
}

/* ==========================================================================
   SIDEBARS & NAVIGATION
   ========================================================================== */

aside.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
}
/* Adjust padding for sidebars to prevent double-padding against the main content */
aside.sidebar.left  { padding-right: 0; }
aside.sidebar.right { padding-left: 0; }

/* --- Mini Profile (Pinned to Top-Right via Fixed Positioning) --- */
#mini-profile {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1001; /* High z-index to stay on top */

  display: flex; /* Kept from original, as it's correct */
  align-items: center;
  gap: 12px;
  background-color: var(--tertiary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-lg);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease-in-out; /* Standardized transition */
}
/* 
  This selector correctly respects your JS logic 
  of applying inline styles to hide the element.
*/
#mini-profile:not([style*="display: none;"]):not([style*="display:none"]) {
    display: flex !important;
}
#mini-profile:hover {
  transform: translateY(-2px) scale(1.02); /* Added a slight lift */
}

#profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary-border);
  object-fit: cover;
}
#profile-info { line-height: 1.4; font-size: 0.9em; }
#profile-name { font-weight: 600; font-size: 1.1em; color: var(--primary-text); }
#auth-status-container { display: flex; align-items: center; font-size: 0.85em; gap: 6px; margin-top: 2px; }
#auth-light { width: 10px; height: 10px; border-radius: 50%; }
#auth-light.green { /* Using your existing class */
  background-color: var(--status-green);
  box-shadow: 0 0 8px var(--status-green);
}

/* --- Sidebar Navigation Lists --- */
aside.sidebar ul {
  list-style: none;
  background-color: var(--tertiary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden; /* Contains child elements within the rounded corners */
}

aside.sidebar li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  color: var(--secondary-text);
  font-weight: 500;
  border-bottom: 1px solid var(--primary-border);
  transition: all var(--transition-speed) var(--transition-timing);
  cursor: pointer;
}
aside.sidebar li:last-child { border-bottom: none; }

aside.sidebar li:hover,
aside.sidebar li.active {
  background-color: var(--interactive-bg);
  color: var(--primary-text);
}

/* Universal rule for icons to ensure consistent sizing */
aside.sidebar li img,
aside.sidebar li [class^="fa-"] {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  color: var(--tertiary-text);
  transition: color var(--transition-speed) var(--transition-timing), 
              transform var(--transition-speed) var(--transition-timing);
  object-fit: contain;
}

aside.sidebar li:hover img,
aside.sidebar li.active img,
aside.sidebar li:hover [class^="fa-"],
aside.sidebar li.active [class^="fa-"] {
  transform: scale(1.1);
  color: var(--primary-text);
}

/* 
  This preserves your structure where the link is a child of the list item,
  ensuring hover states on the <li> correctly affect the child <a>.
*/
aside.sidebar li.navigate a {
  color: inherit; /* Inherits color from parent <li> for hover effects */
  text-decoration: none;
}

/* ==========================================================================
   MAIN CONTENT STYLES
   ========================================================================== */

/* --- News Feed (Grid of Cards) --- */
#news-content {
  display: grid;
  /* Creates a responsive grid that shows 2 columns, but stacks to 1 if space is tight */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
}

.news-article {
  background-color: var(--tertiary-bg); /* Changed from secondary for more depth */
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-speed) var(--transition-timing);
}

.news-article:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg); /* Use shadow variable */
  border-color: var(--interactive-border); /* Use border variable */
}

.news-image-container {
  width: 100%;
  aspect-ratio: 16 / 10; /* A more standard widescreen ratio */
  background-color: var(--primary-bg);
  overflow: hidden;
}

.news-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease-out;
}

.news-article:hover .news-image {
  transform: scale(1.05);
}

.news-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* Ensures this part fills the card height */
}

.news-article h3 {
  color: var(--primary-text);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.5rem 0;
  transition: color var(--transition-speed) var(--transition-timing);
}

.news-article:hover h3 {
  color: var(--accent-orange);
}

.news-article p.article-excerpt {
  color: var(--secondary-text);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  flex-grow: 1; /* Pushes the 'Read More' link to the bottom */

  /* Clamp text to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read-more {
  display: inline-block;
  color: var(--accent-orange);
  font-weight: 600;
  text-decoration: none;
  margin-top: auto; /* Aligns to the bottom of the flex container */
  align-self: flex-start;
}
.read-more:hover {
  color: var(--accent-orange-hover);
  text-decoration: underline;
}

/* --- Authentication Container --- */
#auth-container {
  padding: 2rem;
  text-align: center;
}

#auth-container > div {
  max-width: 400px; /* Constrains the width of the form */
  margin-inline: auto;
}

/* Styles for buttons and inputs are handled globally, but we can add spacing */
#auth-container button,
#auth-container input {
  margin-block: 0.5rem;
}

/* ==========================================================================
   UI ELEMENTS (Buttons, Forms, etc.)
   ========================================================================== */

/* --- General Button Styling --- */
button,
.button-style {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9em;
  padding: 0.7rem 1.5rem;
  
  background-color: var(--interactive-bg);
  color: var(--primary-text);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-sm);
  
  cursor: pointer;
  text-decoration: none; /* For .button-style on <a> tags */
  transition: all var(--transition-speed) var(--transition-timing);
}

button:not(:disabled):hover,
.button-style:not(:disabled):hover {
  background-color: var(--interactive-bg-hover);
  border-color: var(--interactive-border);
  color: var(--link-text-inverted); /* Ensure text is bright on hover */
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none; /* Keep text decoration off for buttons */
}

/* --- Primary (Accent) Button --- */
button.primary,
.button-style.primary {
  background-color: var(--accent-orange);
  border-color: var(--accent-orange);
  color: var(--link-text-inverted);
}

button.primary:not(:disabled):hover,
.button-style.primary:not(:disabled):hover {
  background-color: var(--accent-orange-hover);
  border-color: var(--accent-orange-hover);
  color: var(--link-text-inverted);
}

/* --- Disabled State --- */
button:disabled,
.button-style:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background-color: var(--interactive-bg); /* Reset to base color */
}

/* --- Form Inputs & Textareas --- */
input[type="text"],
input[type="password"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  
  background-color: var(--secondary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-sm);
  color: var(--primary-text);
  
  transition: all var(--transition-speed) var(--transition-timing);
}

input::placeholder,
textarea::placeholder {
  color: var(--disabled-text);
}

/* Focus state for inputs */
input:focus,
textarea:focus {
  outline: none; /* We rely on the global :focus-visible for keyboard users */
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 3px var(--focus-ring-color); /* A subtle glow */
}

/* ==========================================================================
   CALENDAR & EVENT MODAL
   ========================================================================== */

/* --- Calendar Container --- */
.calendar-container {
  max-width: 900px; /* Increased max-width slightly */
  margin: 2rem auto;
  background-color: var(--secondary-bg);
  padding: 1.5rem;
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--primary-border);
}

#monthYear {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--primary-text);
}

.calendar-nav-button {
  /* This can now be replaced by the global button style. 
     In your HTML, change <button class="calendar-nav-button"> to <button class="button-style"> */
  /* If you can't change the HTML, keep these styles but align them with .button-style */
  padding: 0.6rem 1.2rem;
  font-size: 0.9em;
  text-transform: uppercase;
}

/* --- Calendar Grid --- */
.calendar-week-header,
.calendar-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px; /* Slightly increased gap */
}
.calendar-week-header {
  margin-bottom: 0.75rem;
}
.calendar-day-header {
  text-align: center;
  font-weight: 600; /* Boldened for clarity */
  color: var(--secondary-text);
  font-size: 0.8em;
  text-transform: uppercase;
}

.calendar-cell {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  position: relative;
  
  background-color: var(--tertiary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-sm);
  color: var(--primary-text);
  
  cursor: pointer;
  transition: all var(--transition-speed) var(--transition-timing);
}
.calendar-cell:hover:not(.empty) {
  background-color: var(--interactive-bg);
  border-color: var(--interactive-border);
  transform: scale(1.03); /* Add subtle growth */
}

.calendar-cell span.date {
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.calendar-cell.empty {
  background-color: var(--secondary-bg);
  cursor: default;
}
.calendar-cell.empty span.date {
  color: var(--disabled-text);
}
.calendar-cell.today {
  border-color: var(--accent-orange);
  background-color: rgba(255, 111, 0, 0.1);
}
.calendar-cell.today span.date {
  color: var(--accent-orange);
}

/* --- Event Indicator --- */
.calendar-cell.event-tile::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background-color: var(--accent-orange);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-orange);
}

/* --- Event Modal --- */
#eventModal {
  /* display is toggled by JS */
  position: fixed;
  z-index: 2000;
  inset: 0; /* Modern way to write top/right/bottom/left: 0 */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  
  background-color: rgba(0,0,0,0.7);
  backdrop-filter: blur(5px);
}
#eventModal .modal-content {
  background-color: var(--secondary-bg);
  padding: 2rem;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--primary-border);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  position: relative;
}
#eventModal .close-button {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
  color: var(--secondary-text);
  cursor: pointer;
  transition: all var(--transition-speed) var(--transition-timing);
}
#eventModal .close-button:hover {
  color: var(--primary-text);
  transform: rotate(90deg);
}

/* --- Modal Content --- */
#eventDetails { padding-top: 1rem; }
#eventDetails .modal-title {
  color: var(--accent-orange);
  margin-bottom: 1.5rem; /* Increased spacing */
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--primary-border);
}
#eventDetails .event-details-item {
  margin-bottom: 1rem;
  line-height: 1.6;
}
#eventDetails .event-details-item:last-child {
  margin-bottom: 0;
}
#eventDetails h4.event-title {
  color: var(--accent-orange);
  font-size: 1.2em;
  margin: 0 0 0.5rem 0;
}
#eventDetails p {
  margin: 0; /* Remove default paragraph margin */
  font-size: 0.95em;
  color: var(--secondary-text);
}
#eventDetails p strong {
  color: var(--primary-text);
  margin-right: 0.5em;
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "left"
      "main"
      "right"
      "footer";
  }
  main#content {
    margin: 0 0 1.5rem 0;
    border-radius: 0;
    border-left: none; border-right: none;
  }
  aside.sidebar { padding: 0 1rem 1.5rem 1rem; }
  aside.sidebar.right { padding-right: 1rem; padding-left: 1rem; }

  #mini-profile {
    top: 1rem;
    right: 1rem;
  }
}

@media (max-width: 767px) {
  html { font-size: 15px; }
  header, header.scrolled { padding-left: 1rem; padding-right: 1rem; }
  main#content, #news-content { padding: 1.5rem 1rem; }
  #news-content { grid-template-columns: 1fr; }
  #mini-profile {
    padding: 0.5rem;
    gap: 8px;
  }
  #mini-profile #profile-pic {
    width: 32px;
    height: 32px;
  }
  #mini-profile #profile-name {
    display: none; /* Hide name on very small screens to save space */
  }
}

#news-feed {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  padding: 1.5rem;
}

.news-article {
  background-color: var(--secondary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-speed) var(--transition-timing);
}
.news-article:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  border-color: var(--interactive-border);
}
.news-image-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--primary-bg);
  overflow: hidden;
}
.news-image {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease-out;
}
.news-article:hover .news-image { transform: scale(1.05); }
.news-content {
  padding: 1.25rem;
  display: flex; flex-direction: column; flex-grow: 1;
}
.news-article h3 {
  color: var(--primary-text); font-size: 1.3rem; font-weight: 600;
  line-height: 1.3; margin: 0 0 0.5rem 0;
}
.news-article:hover h3 { color: var(--accent-orange); }
.news-article p.article-excerpt {
  color: var(--secondary-text); font-size: 0.95rem; line-height: 1.5;
  margin-bottom: 1rem; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  display: -webkit-box; overflow: hidden;
}
.read-more {
  display: inline-block; color: var(--accent-orange); font-weight: 600;
  text-decoration: none; margin-top: auto; align-self: flex-start;
}
.read-more:hover { color: var(--accent-orange-hover); text-decoration: underline; }


/* 
  ==========================================================================
   ADDED STYLES FOR EVENT MODAL
  ==========================================================================
*/
#eventModal {
  display: none; /* JS toggles to 'flex' or 'block' */
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.7);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}
#eventModal .modal-content {
  background-color: #2a2a2d; /* Match calendar background */
  padding: 2rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--medium-grey-border);
  box-shadow: 0 5px 25px rgba(0,0,0,0.3);
  width: 90%;
  max-width: 500px;
  position: relative;
}
#eventModal .close-button {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
  color: var(--light-grey-text);
  cursor: pointer;
  transition: all var(--transition-speed) var(--transition-timing);
}
#eventModal .close-button:hover {
  color: #fff;
  transform: rotate(90deg);
}
/* Event Details (inside Calendar Modal) */
#eventDetails {
  padding-top: 1rem;
}
#eventDetails h3.modal-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent-orange);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--medium-grey-border);
}
#eventDetails .event-details-item {
  border-bottom: 1px solid var(--medium-grey-border);
  padding: 0.75rem 0;
  margin-bottom: 0.75rem;
}
#eventDetails .event-details-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
#eventDetails h4.event-title {
  color: var(--accent-orange);
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2em;
  margin: 0 0 0.5rem 0;
}
#eventDetails p {
  margin: 0.25rem 0;
  font-size: 0.95em;
  color: var(--light-grey-text);
  line-height: 1.6;
}
#eventDetails p strong {
    color: var(--hologram-white);
    margin-right: 0.5em;
}
/* ==========================================================================
   GAME SERVER TILES
   ========================================================================== */

#server-list-content {
  padding: 1.5rem;
}

#server-list-content h2 {
  margin-top: 0;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--primary-border);
  color: var(--primary-text);
}

/* This creates a responsive grid for the server tiles */
.game-tiles-container {
  display: grid;
  /* This is a powerful responsive technique:
     - It creates as many columns as will fit.
     - Each column will be at least 350px wide.
     - Columns will expand to fill any extra space (up to 1fr).
     - It automatically stacks to a single column on smaller screens.
  */
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* 
  UNIVERSAL TILE STYLING
  This rule targets ANY direct child of the container, making it extremely flexible.
  It will style a <div>, <article>, or a third-party <rustalyzer-widget> the same way.
*/
.game-tiles-container > * {
  background-color: var(--secondary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column; /* Stacks header, body, footer vertically */
  transition: all var(--transition-speed) var(--transition-timing);
}

.game-tiles-container > *:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--interactive-border);
}

/* --- Specific Tile Sections (for custom-built tiles) --- */

.game-tile-header {
  padding: 1rem 1.25rem;
  text-align: center;
  background-color: var(--interactive-bg);
  border-bottom: 1px solid var(--primary-border);
  flex-shrink: 0; /* Prevents header from shrinking */
}

.game-tile-header h4 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
  color: var(--primary-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-tile-body {
  padding: 1.25rem;
  flex-grow: 1; /* Pushes buttons to the bottom by taking up all available space */
  font-size: 0.95em;
  color: var(--secondary-text);
}

.game-tile-body p {
  display: flex;
  justify-content: space-between;
  margin: 0 0 0.75rem 0;
}
.game-tile-body p:last-child {
  margin-bottom: 0;
}
.game-tile-body strong {
  color: var(--tertiary-text);
  font-weight: 500;
}
.game-tile-body span {
  color: var(--primary-text);
  font-weight: 600;
}
.game-tile-body span.status-online {
  color: var(--status-green);
}

.game-tile-buttons {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--primary-border);
  display: flex;
  gap: 1rem;
  flex-shrink: 0; /* Prevents button area from shrinking */
}
.game-tile-buttons .button-style {
  flex-grow: 1; /* Makes buttons share the width */
}

/* Special styling for the connect button */
.game-tile-buttons .connect-button {
  background-color: var(--status-green);
  border-color: var(--status-green);
  color: var(--link-text-inverted);
}
.game-tile-buttons .connect-button:hover {
  background-color: #27ae60; /* A slightly darker green for hover */
  border-color: #27ae60;
}

/* 
  Ensures third-party widgets like Rustalyzer fill their tile.
  You can add more specific rules here if needed.
*/
.game-tiles-container > rustalyzer-widget {
  /* The base tile styles from .game-tiles-container > * are already applied.
     Add any specific overrides or padding here if necessary. */
  padding: 1rem;
}

/* ==========================================================================
   FORUM STYLES
   ========================================================================== */

/* --- Forum Section Headers --- */
.forum-section-title {
  color: var(--primary-text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--primary-border);
  font-size: 1.8em;
  font-weight: 700;
}
.forum-section-title i { /* Style for an icon next to the title */
  color: var(--accent-orange);
  margin-right: 0.75rem;
}

/* --- Forum Lists (Categories & Threads) --- */
.forum-category-list,
.forum-thread-list {
  list-style: none;
  margin-bottom: 2rem;
}

.forum-category-item,
.forum-thread-item {
  background-color: var(--tertiary-bg);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--primary-border);
  transition: all var(--transition-speed) var(--transition-timing);
}
.forum-category-item:hover,
.forum-thread-item:hover {
  background-color: var(--interactive-bg);
  border-color: var(--interactive-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.forum-thread-item a.thread-title-link {
  color: var(--primary-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.2em;
  display: block;
  margin-bottom: 0.3rem;
  transition: color var(--transition-speed) var(--transition-timing);
}
.forum-thread-item a.thread-title-link:hover {
  color: var(--accent-orange);
}
.forum-thread-item span.thread-meta {
  font-size: 0.85em;
  color: var(--secondary-text);
}

/* --- Special Thread States --- */
.forum-thread-item.pinned-thread {
  background-color: color-mix(in srgb, var(--tertiary-bg) 80%, var(--accent-orange) 20%);
  border-left: 4px solid var(--accent-orange);
}
.fa-thumbtack { /* FontAwesome pin icon */
  color: var(--accent-orange);
  margin-right: 0.5rem;
}

/* --- Forum Buttons & Forms --- */
/* (These selectors now use the global .button-style and input styles where possible) */
#new-thread-form-container, #reply-form-container {
  background-color: var(--secondary-bg);
  border: 1px solid var(--primary-border);
  padding: 1.5rem;
  margin-top: 1.5rem;
  border-radius: var(--border-radius-md);
}
#new-thread-form-container h4, #reply-form-container h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--accent-orange);
  font-size: 1.3em;
}
#new-thread-title, #new-thread-content, #reply-content {
  margin-bottom: 1rem;
  /* These will inherit global input/textarea styles automatically */
}

/* --- Individual Forum Posts --- */
.forum-post {
  background-color: var(--tertiary-bg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--primary-border);
}

.post-author {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--primary-border);
}
img.author-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 2px solid var(--primary-border);
  object-fit: cover;
}
strong.author-name {
  color: var(--primary-text);
  font-size: 1.1em;
  font-weight: 600;
}
strong.author-name a { color: inherit; text-decoration: none; }
strong.author-name a:hover { color: var(--accent-orange); }
span.post-timestamp {
  font-size: 0.85em;
  color: var(--secondary-text);
  margin-left: auto; /* Pushes to the right */
}

.post-content {
  color: var(--secondary-text);
  line-height: 1.7;
  word-wrap: break-word;
}
.post-content blockquote {
  border-left: 4px solid var(--accent-orange);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background-color: var(--secondary-bg);
  color: var(--tertiary-text);
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

/* --- Post Interactions (Reactions) --- */
.post-interactions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.reactions-ui { position: relative; }
.emoji-palette-container {
  position: absolute;
  bottom: calc(100% + 8px); /* Position above the trigger button */
  left: 0;
  display: none; /* Toggled by JS */
  flex-wrap: wrap;
  gap: 0.4rem;
  background-color: var(--interactive-bg);
  border: 1px solid var(--interactive-border);
  border-radius: var(--border-radius-md);
  padding: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 10;
}
img.reaction-option {
  width: 32px;
  height: 32px;
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  padding: 3px;
  transition: all var(--transition-speed) var(--transition-timing);
}
img.reaction-option:hover {
  background-color: var(--interactive-bg-hover);
  transform: scale(1.15);
}

.post-reactions-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.reaction-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--interactive-bg);
  border: 1px solid var(--primary-border);
  border-radius: 20px; /* Pill shape */
  padding: 0.3rem 0.75rem;
  font-size: 0.85em;
  color: var(--secondary-text);
  font-weight: 500;
  transition: all var(--transition-speed) var(--transition-timing);
}
.reaction-pill.user-has-reacted {
  background-color: var(--accent-orange);
  border-color: var(--accent-orange-hover);
  color: var(--link-text-inverted);
  cursor: pointer;
}

#boot-loader-wrapper {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: #030712;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.7s ease-in-out;
    animation: flicker 0.1s infinite;
}
#boot-loader-wrapper.is-hiding {
    opacity: 0;
    pointer-events: none;
}
#boot-loader-wrapper.is-glitching {
    animation: glitch-screen 0.2s infinite linear alternate-reverse;
}

#main-website-content {
    display: none;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}
#main-website-content.is-visible {
    display: block;
    opacity: 1;
}

.line-error { color: #e74c3c; }
.line-success { color: #2ecc71; }
.line-warning { color: #f1c40f; }
.line-info { color: #38bdf8; }
.line-primary { color: #f97316; }

.glitch-text {
    color: #e74c3c;
    text-shadow: 0 0 5px #e74c3c;
    animation: text-flicker 0.1s infinite;
}

@keyframes text-flicker {
    0% { opacity: 0.8; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
@keyframes flicker {
    0% { opacity: 0.98; }
    50% { opacity: 1; }
    100% { opacity: 0.98; }
}
@keyframes glitch-screen {
    0% { transform: skewX(0.5deg); }
    100% { transform: skewX(-0.5deg); }
}

.font-orbitron { font-family: 'Orbitron', sans-serif; }
.font-roboto-mono { font-family: 'Roboto Mono', monospace; }
.cursor-blink { animation: blink 1s step-end infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ==========================================================================
   AI CHAT WIDGET STYLES (CORRECTED)
   ========================================================================== */

#ai-chat-widget-container {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;

  /* --- FIX: Make the entire container non-interactive by default --- */
  pointer-events: none;
}

/* --- FIX: When open, re-enable interaction for the whole widget --- */
#ai-chat-widget-container.is-open {
  pointer-events: auto;
}

#ai-chat-window-container {
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 100px);
  margin-bottom: 15px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden; 
  background-color: var(--tertiary-bg); 

  /* Visual transition only */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#ai-chat-widget-container.is-open #ai-chat-window-container {
  opacity: 1;
  transform: translateY(0);
}

#ai-chat-toggle-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--accent-orange);
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;

  /* --- FIX: Explicitly make ONLY the button clickable when closed --- */
  pointer-events: auto;
}

#ai-chat-toggle-button:hover {
  transform: scale(1.1);
  background-color: var(--accent-orange-hover);
}

/* Icon Styling (using a pseudo-element for easy swapping) */
#ai-chat-toggle-button::before {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  background-color: white;
  transition: all 0.3s ease;
  
  /* Chat Bubble Icon (default state) */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M4.848 2.771A49.144 49.144 0 0112 2.25c2.43 0 4.817.178 7.152.52 1.978.292 3.348 2.024 3.348 3.97v6.02c0 1.946-1.37 3.678-3.348 3.97a48.901 48.901 0 01-3.476.383.39.39 0 00-.297.15l-2.11 2.11a.75.75 0 01-1.06 0l-2.11-2.11a.39.39 0 00-.297-.15 48.9 48.9 0 01-3.476-.384c-1.978-.29-3.348-2.024-3.348-3.97V6.741c0-1.946 1.37-3.68 3.348-3.97zM6.75 8.25a.75.75 0 01.75-.75h9a.75.75 0 010 1.5h-9a.75.75 0 01-.75-.75zm.75 2.25a.75.75 0 000 1.5H12a.75.75 0 000-1.5H7.5z' clip-rule='evenodd' /%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M4.848 2.771A49.144 49.144 0 0112 2.25c2.43 0 4.817.178 7.152.52 1.978.292 3.348 2.024 3.348 3.97v6.02c0 1.946-1.37 3.678-3.348 3.97a48.901 48.901 0 01-3.476.383.39.39 0 00-.297.15l-2.11 2.11a.75.75 0 01-1.06 0l-2.11-2.11a.39.39 0 00-.297-.15 48.9 48.9 0 01-3.476-.384c-1.978-.29-3.348-2.024-3.348-3.97V6.741c0-1.946 1.37-3.68 3.348-3.97zM6.75 8.25a.75.75 0 01.75-.75h9a.75.75 0 010 1.5h-9a.75.75 0 01-.75-.75zm.75 2.25a.75.75 0 000 1.5H12a.75.75 0 000-1.5H7.5z' clip-rule='evenodd' /%3E%3C/svg%3E") no-repeat center / contain;
}

/* Close Icon (when open) */
#ai-chat-widget-container.is-open #ai-chat-toggle-button::before {
  transform: rotate(45deg);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zm-1.72 6.97a.75.75 0 10-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 101.06 1.06L12 13.06l1.72 1.72a.75.75 0 101.06-1.06L13.06 12l1.72-1.72a.75.75 0 10-1.06-1.06L12 10.94l-1.72-1.72z' clip-rule='evenodd' /%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zm-1.72 6.97a.75.75 0 10-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 101.06 1.06L12 13.06l1.72 1.72a.75.75 0 101.06-1.06L13.06 12l1.72-1.72a.75.75 0 10-1.06-1.06L12 10.94l-1.72-1.72z' clip-rule='evenodd' /%3E%3C/svg%3E") no-repeat center / contain;
}

/* STYLES FOR THE REACT COMPONENT (These are unchanged but necessary) */
#ai-chat-window-container { font-family: 'Inter', sans-serif; color: var(--primary-text); }
#ai-chat-window-container > div { display: flex; flex-direction: column; height: 100%; }
#ai-chat-window-container .p-4 { padding: 1rem; }
#ai-chat-window-container .border-b { border-bottom: 1px solid var(--primary-border); }
#ai-chat-window-container .border-t { border-top: 1px solid var(--primary-border); }
#ai-chat-window-container .flex { display: flex; }
#ai-chat-window-container .justify-between { justify-content: space-between; }
#ai-chat-window-container .items-center { align-items: center; }
#ai-chat-window-container .text-lg { font-size: 1.125rem; }
#ai-chat-window-container .font-semibold { font-weight: 600; }
#ai-chat-window-container .text-slate-200 { color: #e2e8f0; }
#ai-chat-window-container .space-x-3 > * + * { margin-left: 0.75rem; }
#ai-chat-window-container .text-sm { font-size: 0.875rem; }
#ai-chat-window-container .text-slate-400 { color: #94a3b8; }
#ai-chat-window-container select { background-color: var(--interactive-bg); border: 1px solid var(--interactive-border); border-radius: var(--border-radius-sm); padding: 0.25rem 0.5rem; color: white; }
#ai-chat-window-container .flex-1 { flex: 1 1 0%; }
#ai-chat-window-container .p-6 { padding: 1.5rem; }
#ai-chat-window-container .overflow-y-auto { overflow-y: auto; }
#ai-chat-window-container .space-y-6 > * + * { margin-top: 1.5rem; }
#ai-chat-window-container .gap-3 { gap: 0.75rem; }
#ai-chat-window-container .items-end { align-items: flex-end; }
#ai-chat-window-container .justify-end { justify-content: flex-end; }
#ai-chat-window-container .justify-start { justify-content: flex-start; }
#ai-chat-window-container .w-8 { width: 2rem; }
#ai-chat-window-container .h-8 { height: 2rem; }
#ai-chat-window-container .flex-shrink-0 { flex-shrink: 0; }
#ai-chat-window-container .bg-sky-500 { background-color: #0ea5e9; }
#ai-chat-window-container .rounded-full { border-radius: 9999px; }
#ai-chat-window-container .w-5 { width: 1.25rem; }
#ai-chat-window-container .h-5 { height: 1.25rem; }
#ai-chat-window-container .text-slate-900 { color: #0f172a; }
#ai-chat-window-container .max-w-md { max-width: 28rem; }
#ai-chat-window-container .p-3 { padding: 0.75rem; }
#ai-chat-window-container .rounded-2xl { border-radius: 1rem; }
#ai-chat-window-container .bg-sky-600 { background-color: #0284c7; }
#ai-chat-window-container .rounded-br-none { border-bottom-right-radius: 0; }
#ai-chat-window-container .text-white { color: white; }
#ai-chat-window-container .bg-slate-700 { background-color: #334155; }
#ai-chat-window-container .rounded-bl-none { border-bottom-left-radius: 0; }
#ai-chat-window-container .text-slate-300 { color: #d1d5db; }
#ai-chat-window-container input[type="text"] { flex: 1 1 0%; background-color: #334155; color: #e2e8f0; border-radius: var(--border-radius-lg); padding: 0.75rem 1rem; border: 1px solid var(--primary-border); }
#ai-chat-window-container input[type="text"]:focus { outline: 2px solid var(--accent-orange); border-color: var(--accent-orange); }
#ai-chat-window-container button[type="submit"] { background-color: #0284c7; color: white; border-radius: var(--border-radius-lg); padding: 0.75rem; border: none; }
#ai-chat-window-container button[type="submit"]:hover { background-color: #0369a1; }
#ai-chat-window-container button:disabled { background-color: #334155; cursor: not-allowed; }
#ai-chat-window-container .text-xs { font-size: 0.75rem; }
#ai-chat-window-container .text-sky-400 { color: #38bdf8; }
#ai-chat-window-container .mb-1 { margin-bottom: 0.25rem; }
#ai-chat-window-container .whitespace-pre-wrap { white-space: pre-wrap; }
#ai-chat-window-container .font-mono { font-family: 'Roboto Mono', monospace; }
#ai-chat-window-container .italic { font-style: italic; }
#ai-chat-window-container .pt-1 { padding-top: 0.25rem; }
#ai-chat-window-container .bg-slate-800\/50 { background-color: rgba(30, 41, 59, 0.5); }
#ai-chat-window-container .rounded-lg { border-radius: var(--border-radius-lg); }


/* ==========================================================================
   LEADERBOARD STYLES (REVISED FOR RESPONSIVENESS)
   ========================================================================== */

.leaderboard-container {
  /* --- FIX: Restored background for readability --- */
  background-color: rgba(30, 30, 36, 0.85); /* Dark, semi-transparent background */
  backdrop-filter: blur(10px); /* Frosted glass effect */
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  
  /* Layout fixes from previous step */
  padding: 1.5rem;
  overflow-x: auto; /* Add horizontal scroll on overflow */
  -webkit-overflow-scrolling: touch; 
}

.leaderboard-container h2 {
  font-size: 1.8em;
  color: var(--primary-text);
  margin-top: 0;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.leaderboard-container h2 .fas {
  color: var(--accent-orange);
}

.leaderboard-container p {
  color: var(--secondary-text);
  margin-bottom: 1.5rem;
  max-width: none; /* Override base p styling */
}

/* --- Selection Page Grid --- */
.leaderboard-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.leaderboard-selection-grid .button-style {
  font-size: 1em;
  padding: 1rem;
  justify-content: flex-start; /* Align icon and text to the left */
}

/* --- Leaderboard Table Styling --- */
.leaderboard-table {
  width: 100%;
  min-width: 800px; /* Set a minimum width to prevent excessive squishing */
  border-collapse: collapse;
  font-size: 0.95em;
  table-layout: fixed; 
}

.leaderboard-table thead {
  background-color: var(--interactive-bg);
}

.leaderboard-table th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: var(--primary-text);
  text-transform: uppercase;
  font-size: 0.8em;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--accent-orange);
  vertical-align: middle;
}

/* Column Width Helpers */
.leaderboard-table th.col-rank { width: 8%; }
.leaderboard-table th.col-player { width: 30%; }
.leaderboard-table th.col-team { width: 45%; }
.leaderboard-table th.col-stat { width: 12%; }
.leaderboard-table th.col-stat-sml { width: 10%; } /* For K/D/R */
.leaderboard-table th.col-hours { width: 15%; }

.leaderboard-table tbody tr {
  /* --- FIX: Restored default row background color --- */
  background-color: var(--tertiary-bg); 
  border-bottom: 1px solid var(--primary-border);
  transition: background-color var(--transition-speed) var(--transition-timing);
}

.leaderboard-table tbody tr:last-child {
  border-bottom: none;
}

.leaderboard-table tbody tr:nth-child(even) {
  background-color: var(--secondary-bg); /* Zebra striping for readability */
}

.leaderboard-table tbody tr:hover {
  background-color: var(--interactive-bg-hover);
}

.leaderboard-table td {
  padding: 0.8rem 1.25rem;
  vertical-align: middle;
  color: var(--secondary-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Special styling for the first three ranks */
.leaderboard-table tbody tr:nth-child(1) td:first-child { color: #ffd700; font-weight: bold; }
.leaderboard-table tbody tr:nth-child(2) td:first-child { color: #c0c0c0; font-weight: bold; }
.leaderboard-table tbody tr:nth-child(3) td:first-child { color: #cd7f32; font-weight: bold; }

/* Player cell with avatar */
.player-name-cell {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--primary-text);
  font-weight: 500;
}

.leaderboard-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-border);
  flex-shrink: 0;
}

/* Stacked avatars for teams */
.team-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.team-avatar-stack {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.leaderboard-avatar-stacked {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--tertiary-bg);
  margin-left: -12px;
  object-fit: cover;
  transition: transform 0.2s ease, margin-left 0.2s ease;
}
.team-avatar-stack:hover .leaderboard-avatar-stacked {
    margin-left: -4px;
    transform: translateY(-2px);
}
.leaderboard-avatar-stacked:first-child {
  margin-left: 0;
}
.team-names {
    color: var(--primary-text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 767px) {
  .leaderboard-container { padding: 1rem; }
  .leaderboard-table th, .leaderboard-table td {
    padding-inline: 0.75rem;
  }
}

/* Container for all server info content */
.server-info-container {
    padding: 10px;
    font-family: 'Roboto Mono', monospace;
}

/* The primary "welcome" section at the top */
.server-welcome-section {
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    
    /* --- THE CENTERING FIX --- */
    display: flex;             /* 1. Use Flexbox for layout */
    flex-direction: column;    /* 2. Stack items vertically */
    align-items: center;       /* 3. Center all direct children horizontally */
    text-align: center;        /* 4. Center text for direct children like <p> */
}

/* The container for the left-aligned info block */
.info-block {
    text-align: left;    /* Override parent and align text to the left */
    max-width: 95%;      /* Prevents the block from getting too wide */
    margin-top: 20px;    /* Add some space above this block */
}

/* Style for text within the info block */
.info-block p {
    margin: 10px 0;
    line-height: 1.7;
    font-size: 1em;
    color: #f0f0f0;
}

/* A general-purpose section for Rules, Commands, etc. */
.server-info-section {
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 20px;
}

/* The header for each section */
.server-info-section h3 {
    margin-top: 0;
    color: #ff6f00;
    border-bottom: 2px solid #ff6f00;
    padding-bottom: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.server-info-section h3 .fas {
    font-size: 0.9em;
}

/* General text styling within sections */
.server-info-section .content p,
.server-welcome-section p {
    margin: 12px 0;
    line-height: 1.7;
    font-size: 1em;
    color: #f0f0f0;
}

/* Styling for the two-column command list */
.command-list { list-style-type: none; padding: 0; column-count: 2; column-gap: 40px; }
@media (max-width: 768px) { .command-list { column-count: 1; } }
.command-list li { padding: 8px 0; border-bottom: 1px solid #333; break-inside: avoid-column; }
.command-name { color: #C900FF; font-weight: bold; }
.command-description { color: #ddd; margin-left: 8px; }

/* Special styling for the warning box */
.notice-warning { background-color: rgba(255, 71, 71, 0.1); border: 1px solid #ff4747; border-left: 5px solid #ff4747; padding: 15px; margin: 15px auto; border-radius: 5px; color: #f0f0f0; max-width: 90%; text-align: left; }
.notice-warning strong { color: #ff4747; }

/* Styling for the numbered rules list */
.rules-list { list-style-type: none; padding-left: 0; counter-reset: rules-counter; }
.rules-list li { padding: 8px 0; counter-increment: rules-counter; display: flex; align-items: flex-start; }
.rules-list li::before { content: counter(rules-counter) ". "; color: #ff4747; font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 1.1em; margin-right: 10px; min-width: 25px; }

/* General list styling for other info */
.info-list { list-style-type: none; padding-left: 0; }
.info-list li { padding: 5px 0; }

/* Map button and image styling (unchanged) */
a.map-button { display: inline-block; padding: 10px 15px; background-color: #ff6f00; color: white; border: none; border-radius: 5px; cursor: pointer; text-decoration: none; font-size: 1em; font-weight: bold; text-align: center; transition: background-color 0.2s; margin-bottom: 15px; font-family: 'Orbitron', sans-serif; }
a.map-button:hover { background-color: #e66300; }
.map-preview-image { max-width: 100%; height: auto; border-radius: 8px; margin-top: 15px; margin-bottom: 15px; border: 2px solid #444; }

.copyable-command {
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 4px;
    padding: 2px 6px;
    margin: -2px -6px; /* Offset padding to maintain alignment */
}

/* Hover effect to reinforce clickability */
.copyable-command:hover {
    background-color: rgba(255, 111, 0, 0.3); /* A subtle highlight */
}

/* Style for the "Copied!" feedback state */
.copyable-command.copied {
    background-color: #46FF00; /* Bright green for success */
    color: #000;
    font-weight: bold;
}

/* Styling for the two-column command list (unchanged, for context) */
.command-list { list-style-type: none; padding: 0; column-count: 2; column-gap: 40px; }
@media (max-width: 768px) { .command-list { column-count: 1; } }
.command-list li { padding: 8px 0; border-bottom: 1px solid #333; break-inside: avoid-column; }
.command-name { color: #C900FF; font-weight: bold; }
.command-description { color: #ddd; margin-left: 8px; }

/* --- NECESSARY STYLES FOR THE NEW LAYOUT --- */

/* 1. Style for the main server title at the top */
.server-main-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.2em; /* Larger than section headers */
    font-weight: 700;
    text-align: center;
    color: #ff6f00; /* Matches your section header color */
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #444; /* A subtle separator */
}

/* 2. Flex container for the map image and button at the bottom */
.server-map-footer {
    display: flex;
    justify-content: space-between; /* Pushes image to left, button to right */
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%; /* Make it span the full width of its parent */
    margin-top: 25px; /* Add space between it and the info-block above */
    padding-top: 20px; /* Add some padding on top */
    border-top: 1px solid #444; /* A nice separator line */
}

.server-map-footer .map-preview-image,
.server-map-footer .map-button {
    margin-top: 0;
    margin-bottom: 0;
}