/* Minecraft Font */
@font-face {
  font-family: 'Mojangles';
  src: url('fonts/Mojangles.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* Pixel Arabic Font */
@font-face {
  font-family: 'Arapix';
  src: url('fonts/MojanglesArab.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* =========================================
   1. VARIABLES & THEMES
   ========================================= */
:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #22c55e; /* Green */
  --accent: #334155; /* Dark blue/grey */
  --shadow: rgba(0, 0, 0, 0.3);
  --main-font: 'Arapix', sans-serif;
}

body.light-theme {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #16a34a; /* Darker green */
  --accent: #e2e8f0; /* Light grey */
  --shadow: rgba(0, 0, 0, 0.1);
}

/* =========================================
   2. GLOBAL STYLES
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--main-font); /* This handles the switch automatically */
  image-rendering: pixelated; /* Keeps pixel fonts crisp, not blurry */
  transition:
    background-color 0.3s,
    color 0.3s;
  display: flex;
  justify-content: center;
  padding: 20px;
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 900px;
}

html[lang='en'] {
  --main-font: 'Mojangles', sans-serif;
}

/* =========================================
   3. COMPONENTS (CARDS & BUTTONS)
   ========================================= */
.card {
  background-color: var(--card);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--accent);
  box-shadow: 0 10px 15px -3px var(--shadow);
}

.hero {
  text-align: center;
  padding: 40px 0;
}

.logo {
  width: 100px;
  filter: drop-shadow(0 0 10px var(--primary));
  margin-bottom: 15px;
}

/* IP Connection Area */
.ip-wrapper {
  background-color: var(--bg);
  padding: 12px 20px;
  border-radius: 8px;

  display: flex;
  flex-direction: column;   /* يخلي IP فوق والزر تحت */
  align-items: center;      /* يوسّطهم */
  gap: 10px;
}

.ip-text {
  direction: ltr;       /* يخلي الـ IP يتقري صح */
  text-align: center;   /* يخليه في النص */
  font-weight: bold;
}

.btn-copy,
.btn-bedrock {
  background-color: var(--primary) !important;
  color: white !important;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  }

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  direction: ltr; /* يخلي الإيموجي شمال والنص يمين */
}

.btn-copy span:first-child {
  direction: ltr;
}

.btn-bedrock {
  width: 100%;
  margin-top: 5px;
  font-size: 1rem;
}

.pulse {
  list-style: none;
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

/* =========================================
   VERSION BADGES - THEME & ALIGNMENT FIX
   ========================================= */
.version-badges {
  display: flex;
  gap: 10px; /* Controls the space between the two badges */
  justify-content: center;
  margin: 10px 0 20px 0; /* Reduced top margin to stay close to the IP */
}

.badge {
  /* Use variables instead of hardcoded colors */
  background-color: var(--accent) !important;
  color: var(--text) !important;
  border: 1.5px solid var(--primary);

  padding: 10px 18px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

/* Fix for the label text (Java/Bedrock) to be readable in both modes */
.badge .label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

/* Force all interactive elements to use the pixel fonts */
.badge,
.social-item,
.btn-copy,
.btn-bedrock {
  font-family: var(--main-font) !important;
  /* This ensures the pixel font stays crisp on buttons */
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}

/* Specifically for the Arabic Arapix font on buttons */
html[lang='ar'] button,
html[lang='ar'] .badge {
  font-size: 1.1rem; /* Arapix sometimes needs to be a bit bigger to be readable */
  line-height: 1.2;
}

/* =========================================
   4. RULES & GRID (LAYOUT)
   ========================================= */
.content-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

.rules-list {
  list-style: none;
  text-align: start !important; /* Respects LTR/RTL flip */
}

.rules-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--accent);
  display: block;
  unicode-bidi: isolate; /* Keeps emojis from flipping weirdly */
}

/* =========================================
   5. SOCIAL LINKS & STAFF
   ========================================= */
.social-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.social-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text) !important;
  padding: 12px;
  background-color: var(--accent) !important;
  border-radius: 8px;
}

.link-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 0 !important; /* FORCED SQUARE */
  flex-shrink: 0;
}

/* =========================================
   6. PERSISTENT CONTROLS (THEME/LANG)
   ========================================= */
.fixed-controls {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: auto;

  display: flex;
  flex-direction: row;   /* مهم */
  direction: ltr;        /* أهم حاجة 🔥 */

  gap: 10px;
  z-index: 1000;
  transition: bottom 0.3s ease;
  }

.control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background-color: var(--primary) !important;
  color: white !important;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

html[lang='ar'] .control-btn {
  font-size: 22px !important;
}

/* =========================================
   7. UTILITY
   ========================================= */
#toast {
  position: absolute;
  top: -35px; /* Adjust this to move it higher or lower */
  left: 50%;
  transform: translateX(-50%);
  background: #22c55e;
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none; /* So it doesn't block clicks */
  animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
}

#toast.show {
  top: 30px;
}

.section-title {
  margin-bottom: 15px;
  font-size: 1.25rem;
  color: var(--primary);
}

/* =========================================
   8. SERVER STATUS COLORS 
   ========================================= */
.status-card {
  padding: 15px 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;
}

.status-card:hover {
  transform: translateY(-5px); /* Gentle lift */
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4); /* Green glow */
  border-color: #22c55e;
}

.status-card:has(.dot-offline):hover {
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  border-color: #ef4444;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 15px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #6b7280; /* Gray by default */
  box-shadow: 0 0 10px rgba(107, 114, 128, 0.5);
}

/* Online Glow */
.dot-online {
  background-color: #22c55e;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.7);
}

/* Offline Glow */
.dot-offline {
  background-color: #ef4444;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.7);
}

.player-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-family: var(--main-font);
}

/* =========================================
    10. FOOTER GRASS & DIRT DESIGN
   ========================================= */

.grass-top {
  width: 100%;
  height: 12px;
  background: #5aa13d;
  border-top: 4px solid #4d8a34;
}

.dirt-body {
  width: 100%;
  height: 80px; /* Make it a bit taller to feel like solid ground */
  background-color: #795548;
  background-image:
    linear-gradient(45deg, #6d4c41 25%, transparent 25%),
    linear-gradient(-45deg, #6d4c41 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #6d4c41 75%),
    linear-gradient(-45deg, transparent 75%, #6d4c41 75%);
  background-size: 20px 20px;
  display: flex;
  justify-content: center; /* Centers horizontally */
  align-items: center; /* Centers vertically */
  color: #ffffff; /* Makes sure text is readable on dirt */
  text-shadow: 2px 2px 0px #000; /* Gives it that MC text "pop" */
  font-family: var(--main-font);
}

/* =========================================
    11. SCROLL PROGRESS BAR
   ========================================= */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%; /* Starts at 0 */
  height: 5px;
  background: #22c55e; /* Minecraft Green */
  z-index: 1000;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

/* =========================================
    12. PING DISPLAY
   ========================================= */
.ping-container {
  margin-left: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

#ping-value {
  font-weight: bold;
  font-variant-numeric: tabular-nums; /* Keeps the numbers from jumping around */
}

/* =========================================
    13. MODS SECTION
   ========================================= */
/* The Main Container */
.mods-section {
  margin: 25px 0; /* Creates space between the section above and below */
}

/* The Actual List Logic */
.mods-list {
  list-style: none;
  padding: 0;
  margin: 0;

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.mods-list li {
  background: rgba(255, 255, 255, 0.03); /* Very subtle contrast */
  padding: 10px 15px;
  border-radius: 8px;
  color: var(--text); /* ✔️ يتغير حسب الثيم */
  font-family: 'Minecraft', sans-serif; /* Use your server's font */
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Fix for Arabic alignment if needed */
[lang='ar'] .mods-list li {
  direction: rtl;
  text-align: right;
}


.minecraft-btn {
    display: inline-block;
    background-color: #55AA55; /* Minecraft Green */
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    font-family: 'Press Start 2P', cursive; /* Matches your download center font */
    font-size: 12px;
    
    /* Pixel-art border style */
    border-bottom: 4px solid #224422;
    border-right: 4px solid #224422;
    border-top: 4px solid #AAFFAA;
    border-left: 4px solid #AAFFAA;
    
    text-shadow: 2px 2px #224422;
    transition: all 0.1s ease;
}

.minecraft-btn:hover {
    background-color: #66CC66;
    transform: scale(1.05);
}

.minecraft-btn:active {
    /* "Pressed" effect */
    border: 4px solid #224422;
    transform: translateY(2px);
}

.mods-container {
  background: var(--card) !important;
  border: 1px solid var(--accent) !important;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}

.mod-item {
  padding: 12px;
  border-radius: 10px;

  background: var(--card);
  border: 1px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);

  color: var(--text);

  font-family: var(--main-font);

  text-align: center;
  direction: rtl;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover effect that works in both modes */
.mod-item:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

.mod-item:last-child {
    border-bottom: none !important;
}

/* عربي */
html[lang='ar'] .mod-item {
  font-family: 'Arapix', sans-serif;
}

/* إنجليزي */
html[lang='en'] .mod-item {
  font-family: 'Mojangles', sans-serif;
  }
