/* 
  pages.css
  Universal Glassmorphism UI classes for ZEXO GIZA subpages
  Restores structure to leaderboard, shop, achievements, etc.
*/

/* Universal Containers */
[class$="-container"] {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 2.5rem;
  background: var(--card-bg);
  border-radius: 24px;
  border: var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--glass-shadow);
}

/* Universal Tables (Leaderboard, Analytics, etc.) */
table[class$="-table"] {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5rem 0;
  background: rgba(15, 23, 42, 0.3);
  border-radius: 16px;
  overflow: hidden;
  border: var(--glass-border);
}

table[class$="-table"] th,
table[class$="-table"] td {
  padding: 1.25rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--font-base);
}

table[class$="-table"] th {
  background: rgba(0, 0, 0, 0.3);
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

table[class$="-table"] tr {
  transition: background var(--transition-speed);
}

table[class$="-table"] tr:hover {
  background: var(--card-bg-hover);
}

table[class$="-table"] tr:last-child td {
  border-bottom: none;
}

/* Specific Ranking Styles */
.rank-1 td:first-child .badge { color: var(--gold, #fbbf24); text-shadow: 0 0 10px rgba(251, 191, 36, 0.4); }
.rank-2 td:first-child .badge { color: var(--silver, #94a3b8); text-shadow: 0 0 10px rgba(148, 163, 184, 0.4); }
.rank-3 td:first-child .badge { color: var(--bronze, #b45309); text-shadow: 0 0 10px rgba(180, 83, 9, 0.4); }

.badge {
  font-size: 1.25rem;
  font-weight: 800;
}

/* Universal Titles */
h1[class$="-title"], h2[class$="-title"] {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2rem;
  background: linear-gradient(to right, var(--accent), var(--secondary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Universal Cards & Grids (Shop, Achievements, etc.) */
[class$="-grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

[class$="-card"] {
  background: var(--card-bg);
  border: var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-speed);
  display: flex;
  flex-direction: column;
}

[class$="-card"]:hover {
  transform: translateY(-5px);
  background: var(--card-bg-hover);
  border-color: var(--accent);
}

/* User Info & Avatars */
.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

/* Nav & Interactive Buttons */
.back-btn, .game-button, button[class$="-btn"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  color: #fff;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-speed);
  margin-top: 1rem;
  width: auto;
}

.back-btn:hover, .game-button:hover, button[class$="-btn"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
  color: #fff;
}

/* Shop specific overrides */
.balance-amount {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
}

.balance-label {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--secondary)) !important;
  color: #fff !important;
  border: none !important;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-online { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.status-offline { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

/* Mobile Adjustments */
@media (max-width: 768px) {
  [class$="-container"] {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  table[class$="-table"] th,
  table[class$="-table"] td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }
  
  table[class$="-table"] th {
    display: none;
  }
  
  table[class$="-table"] tr {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* =============================================
   SUB-PAGE SPECIFIC STYLES
   ============================================= */

/* --- Game Score Display (Leaderboard) --- */
.game-score {
  display: inline-block;
  background: rgba(56, 189, 248, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  margin: 0.15rem;
  color: var(--accent);
  font-weight: 500;
}

.total-score {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent);
}

.username {
  font-weight: 600;
}

/* --- Chat AI Styles --- */
.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--header-bg, rgba(11, 15, 25, 0.8));
  border-bottom: var(--glass-border, 1px solid rgba(255, 255, 255, 0.08));
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
}

.ai-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #38bdf8), var(--secondary, #818cf8));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}

.ai-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.chat-box {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 50vh;
  max-height: 70vh;
}

.chat-box .message {
  padding: 1rem 1.25rem;
  border-radius: 16px;
  max-width: 80%;
  line-height: 1.6;
  font-size: 0.95rem;
}

.chat-box .ai-message {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.15);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-box .user-message {
  background: rgba(129, 140, 248, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.2);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.input-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--header-bg, rgba(11, 15, 25, 0.8));
  border-top: var(--glass-border, 1px solid rgba(255, 255, 255, 0.08));
  position: sticky;
  bottom: 0;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.input-bar {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  color: var(--text, #f8fafc);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.input-bar:focus {
  outline: none;
  border-color: var(--accent, #38bdf8);
}

.action-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.3s;
  flex-shrink: 0;
}

.send-btn {
  background: linear-gradient(135deg, var(--accent, #38bdf8), var(--secondary, #818cf8));
  color: #fff;
}

.upload-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #f8fafc);
}

.action-btn:hover {
  transform: scale(1.1);
}

.image-preview {
  max-width: 200px;
  max-height: 100px;
  border-radius: 8px;
  margin-top: 0.5rem;
  display: none;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 1rem;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #38bdf8);
  animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-6px); opacity: 1; }
}

#imageInput {
  display: none;
}

/* --- FunHack Terminal Styles --- */
.terminal {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  min-height: 100vh;
}

.terminal .header {
  background: none;
  border-bottom: none;
  padding: 1rem 0;
  display: block;
  position: static;
  backdrop-filter: none;
}

.terminal .header pre {
  color: #10b981;
  font-size: 0.6rem;
  line-height: 1.2;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.terminal p {
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

.ip-address { color: #38bdf8; }
.status-200 { color: #10b981; font-weight: 700; }
.status-404 { color: #ef4444; }
.status-500 { color: #f59e0b; }
.highlight  { color: #fbbf24; }
.file-path  { color: #818cf8; }

.output {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hack-animation {
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 0.5rem 0;
  overflow: hidden;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, #10b981, #38bdf8);
  animation: progressFill 2s ease forwards;
}

@keyframes progressFill {
  from { width: 0; }
  to { width: 100%; }
}

.prompt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-top: 1rem;
}

.prompt span {
  color: #10b981;
  font-weight: 700;
  white-space: nowrap;
}

.prompt-line {
  flex: 1;
  background: transparent !important;
  border: none !important;
  color: var(--text, #f8fafc) !important;
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  padding: 0 !important;
  margin: 0 !important;
  outline: none;
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1.2em;
  background: #10b981;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.typing {
  opacity: 0;
  animation: typeIn 0.4s ease forwards;
}

/* --- Sitemap Styles --- */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.topbar .title h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.topbar .subtitle {
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
}

.topbar .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
  transition: border-color 0.3s;
}

.search:focus-within {
  border-color: var(--accent, #38bdf8);
}

.search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text, #f8fafc);
  font-size: 0.95rem;
  outline: none;
  margin: 0;
  padding: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.grid .card {
  background: var(--card-bg, rgba(30, 41, 59, 0.4));
  border: var(--glass-border, 1px solid rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(16px);
}

.grid .card h2 {
  font-size: 1.1rem;
  color: var(--accent, #38bdf8);
  margin-bottom: 1rem;
  font-weight: 700;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list .item {
  margin-bottom: 0.25rem;
}

.list .item a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--text, #f8fafc);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.list .item a:hover {
  background: rgba(56, 189, 248, 0.1);
}

.list .item .path {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  display: none;
}

.list .empty {
  color: var(--text-muted, #94a3b8);
  font-style: italic;
  padding: 0.5rem 0.75rem;
}

/* --- Leaderboard FontAwesome CSS fix --- */
.leaderboard-container .fa-trophy,
.leaderboard-container .fa-crown,
.leaderboard-container .fa-medal,
.leaderboard-container .fa-award {
  font-size: 1.3rem;
}

@media (max-width: 768px) {
  .topbar { flex-direction: column; }
  .grid { grid-template-columns: 1fr; }
  .chat-box { min-height: 40vh; max-height: 60vh; }
  .terminal .header pre { font-size: 0.4rem; }
}
