/* ==========================================================================
   SCHYOTLAR REJASI — STANDALONE & FALLBACK STYLES
   Ensures 100% functionality and styling even offline without Tailwind CDN.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Critical rule to guarantee hidden elements stay hidden */
.hidden {
  display: none !important;
}

/* Responsive Desktop Navigation rule */
@media (max-width: 767px) {
  .desktop-nav {
    display: none !important;
  }
}
@media (min-width: 768px) {
  .desktop-nav {
    display: flex !important;
  }
}

/* Autocomplete suggestions dropdown styling & stacking */
#catalog-suggestions {
  z-index: 9999 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45) !important;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  padding: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

code, .font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Base colors for Light and Dark modes */
html.light body {
  background-color: #f8fafc;
  color: #0f172a;
}
html.dark body {
  background-color: #020617;
  color: #f8fafc;
}

/* Modal default state */
#account-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Badge colors */
.badge-a {
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1px solid #a7f3d0 !important;
}
.dark .badge-a {
  background-color: rgba(6, 95, 70, 0.35) !important;
  color: #6ee7b7 !important;
  border-color: rgba(5, 150, 105, 0.4) !important;
}

.badge-p {
  background-color: #fff1f2 !important;
  color: #9f1239 !important;
  border: 1px solid #fecdd3 !important;
}
.dark .badge-p {
  background-color: rgba(159, 18, 57, 0.35) !important;
  color: #fda4af !important;
  border-color: rgba(225, 29, 72, 0.4) !important;
}

.badge-ka {
  background-color: #fffbeb !important;
  color: #92400e !important;
  border: 1px solid #fde68a !important;
}
.dark .badge-ka {
  background-color: rgba(146, 64, 14, 0.35) !important;
  color: #fcd34d !important;
  border-color: rgba(217, 119, 6, 0.4) !important;
}

.badge-kp {
  background-color: #faf5ff !important;
  color: #6b21a8 !important;
  border: 1px solid #e9d5ff !important;
}
.dark .badge-kp {
  background-color: rgba(107, 33, 168, 0.35) !important;
  color: #d8b4fe !important;
  border-color: rgba(147, 51, 234, 0.4) !important;
}

.badge-t {
  background-color: #eef2ff !important;
  color: #3730a3 !important;
  border: 1px solid #c7d2fe !important;
}
.dark .badge-t {
  background-color: rgba(55, 48, 163, 0.35) !important;
  color: #a5b4fc !important;
  border-color: rgba(79, 70, 229, 0.4) !important;
}

.badge-bt {
  background-color: #f0f9ff !important;
  color: #075985 !important;
  border: 1px solid #bae6fd !important;
}
.dark .badge-bt {
  background-color: rgba(7, 89, 133, 0.35) !important;
  color: #7dd3fc !important;
  border-color: rgba(2, 132, 199, 0.4) !important;
}

/* Animations */
@keyframes pop {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.animate-pop {
  animation: pop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Highlight search */
mark.highlight {
  background-color: #fef08a;
  color: #713f12;
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 700;
}
.dark mark.highlight {
  background-color: #854d0e;
  color: #fef08a;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
}
.dark ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.5);
}

/* Ensure interactive buttons have pointer */
button {
  cursor: pointer;
  user-select: none;
}


/* ==========================================================================
   MOBILE RESPONSIVENESS & TOUCH OPTIMIZATIONS (Smart Mobile App Feel)
   ========================================================================== */

/* Universal mobile-friendly touch defaults */
html, body {
  max-width: 100%;
  overflow-x: hidden !important;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

/* Ensure no child element creates horizontal scroll */
img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
}

/* Mobile specific styling (< 768px) */
@media (max-width: 768px) {
  /* Prevent horizontal layout shifts / unwanted horizontal scrolling */
  body {
    font-size: 14px;
    line-height: 1.5;
  }

  /* Safe container paddings */
  .max-w-7xl {
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
  }

  /* Minimum 44px touch targets for accessibility and comfort */
  button, 
  .nav-btn, 
  .trainer-mode-card, 
  .type-filter-card,
  input[type="text"], 
  .game-btn,
  .rule-btn,
  .filter-btn {
    min-height: 44px;
    touch-action: manipulation;
  }

  /* Compact header on mobile */
  header .max-w-7xl {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  /* Subaccounts and head account cards text break properly */
  h1, h2, h3, h4, p, span, div {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* 4 Trainer Mode Cards: comfortable spacing on phones */
  .trainer-mode-card {
    min-height: 100px;
    padding: 1rem !important;
  }

  /* Floating quick button positioned cleanly above mobile nav */
  .fixed.bottom-6.left-6 {
    bottom: 1rem !important;
    left: 1rem !important;
  }

  /* Modals on mobile full width with safe margin */
  #account-modal > div {
    max-height: 92vh !important;
    width: 95% !important;
    margin: auto !important;
    padding: 1.25rem !important;
  }

  /* Make code preview inputs touch-friendly */
  #sim-input-dt, #sim-input-kt {
    font-size: 1.125rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }

  /* Mobile Catalog Search: Sticky top toolbar */
  #mobile-search-slot {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 60px !important;
    z-index: 30 !important;
  }

  #search-input {
    font-size: 16px !important; /* Critical: prevents iOS Safari layout jump on focus */
    min-height: 44px !important;
  }

  #tab-catalog {
    padding-top: 0.75rem !important;
    border-top-width: 2px !important;
  }

  /* Type filter cards compact font on mobile */
  .type-filter-card {
    padding: 0.625rem !important;
  }
  .type-filter-card .text-xl {
    font-size: 1.125rem !important;
    line-height: 1.25 !important;
  }

  #sites-search-input {
    font-size: 16px !important;
    min-height: 44px !important;
  }
  .sites-cat-btn {
    min-height: 42px !important;
    touch-action: manipulation;
  }
}

/* ==========================================================================
   USEFUL SITES CATALOG — STANDALONE & FALLBACK STYLES
   ========================================================================== */
#sites-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  #sites-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
}
@media (min-width: 1024px) {
  #sites-container {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.site-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.site-card:hover {
  transform: translateY(-2px);
}
