/* Ultra-Fancy, Unique, Responsive, and Fully Animated UI Theme */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  /* Brand Core */
  --coral: #FF8783;
  --lime: #BDFF83;
  --purple: #C583FF;
  --text-color: #0F1222;
  --background-light: #FFFFFF;
  --border-color: #d9d9e3;
  --shadow-color: rgba(8, 15, 40, 0.08);

  /* Glass & Glow */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.35);
  --glow-soft: 0 8px 20px rgba(0,0,0,0.12);
  --glow-hard: 0 18px 50px rgba(0,0,0,0.18);
}

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* Cosmic Gradient BACKGROUND */
body {
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text-color);
  display: flex; flex-direction: column; min-height: 100vh; line-height: 1.65;
  background: linear-gradient(-35deg,
      #141E30 0%, #243B55 15%, #6a11cb 30%, #2575fc 45%, #12c2e9 60%, #c471ed 75%, #f64f59 90%);
  background-size: 500% 500%;
  animation: bg-pan 28s ease-in-out infinite;
}

@keyframes bg-pan {
  0% { background-position: 0% 50%; } 25% { background-position: 50% 100%; } 50% { background-position: 100% 50%; } 75% { background-position: 50% 0%; } 100% { background-position: 0% 50%; }
}

/* Floating PARTICLE FIELD */
.particle-field { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.particle { position: absolute; border-radius: 999px; filter: blur(0.5px); opacity: 0.75; mix-blend-mode: screen; }
.particle.bubble { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), rgba(255,255,255,0.05) 60%);
  box-shadow: 0 0 20px rgba(255,255,255,0.25), inset 0 0 25px rgba(255,255,255,0.15); }
.particle.star { background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 55%); box-shadow: 0 0 20px rgba(255,255,255,0.65); }
.particle.neon { background: radial-gradient(circle, rgba(198,131,255,0.95) 0%, rgba(198,131,255,0.05) 60%);
  box-shadow: 0 0 25px rgba(197,131,255,0.55), 0 0 45px rgba(0,178,255,0.35); }
@keyframes float-up { from { transform: translateY(40vh) translateX(var(--float-x, 0)); opacity: 0; } 10% { opacity: 0.9; } to { transform: translateY(-20vh) translateX(calc(var(--float-x, 0) * -1)); opacity: 0; } }
@keyframes twinkle { 0%,100% { opacity: 0.6; transform: scale(0.95); } 50% { opacity: 1; transform: scale(1.15); } }

/* Elevation Context */
header, main, footer { position: relative; z-index: 1; }

/* HEADER & NAV */
header {
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7));
  backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--glass-border); box-shadow: var(--glow-soft);
  padding: 1rem 5%; position: sticky; top: 0; z-index: 1000;
}
nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; max-width: 1400px; margin: 0 auto; }
.logo {
  font-size: 2.1rem; font-weight: 800;
  background: linear-gradient(90deg, #ff4e50, #f9d423, #4facfe, #00f2fe, #a18cd1, #fbc2eb);
  background-size: 300% 300%; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: rainbow-text 7s linear infinite;
  text-decoration: none;
}
@keyframes rainbow-text { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
nav ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
nav a {
  position: relative; display: inline-block; color: var(--text-color); text-decoration: none; font-weight: 600;
  padding: .75rem 1.1rem; border-radius: 12px; transition: transform .25s ease, color .25s ease, box-shadow .25s ease;
  border: 1px solid transparent; isolation: isolate; overflow: hidden;
}
nav a::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, rgba(197,131,255,0.35), rgba(0,178,255,0.25));
  transform: translateY(100%); transition: transform .45s ease;
}
nav a:hover::before { transform: translateY(0%); }
nav a:hover { color: #fff; transform: translateY(-2px) scale(1.03); box-shadow: 0 8px 24px rgba(0,0,0,0.18); border-color: rgba(255,255,255,0.35); }

/* MAIN LAYOUT */
main { flex: 1; padding: 1.75rem; }
section {
  width: 100%; max-width: 1200px; margin: 1.5rem auto; background: var(--glass-bg);
  padding: 2rem; border-radius: 22px; border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
section h2 {
  font-size: 2rem; font-weight: 800; margin-bottom: 1.2rem; padding-bottom: .6rem; border-bottom: 3px solid var(--lime);
  background: linear-gradient(90deg, #ff9a9e, #fad0c4, #a1c4fd, #c2e9fb); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* BUTTONS */
button, input[type="submit"], .copy-btn, .button-link {
  background: linear-gradient(135deg, #ff758c, #ff7eb3, #a18cd1, #fbc2eb);
  background-size: 250% 250%; animation: btn-shift 10s ease infinite;
  color: #fff; border: 0; padding: 0.95rem 1.6rem; border-radius: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 22px rgba(0,0,0,0.18);
  transition: transform .2s ease;
}
@keyframes btn-shift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
button:hover, input[type="submit"]:hover, .copy-btn:hover, .button-link:hover {
  transform: translateY(-3px);
}

/* FORMS */
form { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1.25rem; }
input, textarea, select {
  width: 100%; padding: 0.95rem 1.1rem; border: 1px solid var(--border-color); border-radius: 12px;
  font-size: 1rem; background: rgba(255,255,255,0.95);
}

/* TIER GRID & TILES */
.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}
.tier-tile {
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: none; /* Hidden by default, JS will show them */
}
.tier-tile:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}
.tier-icon { margin-bottom: 1rem; height: 48px; color: var(--purple); }
.tier-tile.completed .tier-icon { color: var(--lime); }
.tier-tile h4 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.tier-tile p { font-size: 0.9rem; opacity: 0.7; margin-bottom: 1rem; }
.progress-bar-container { width: 100%; height: 10px; background-color: #e9ecef; border-radius: 5px; overflow: hidden; margin-bottom: 0.5rem; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--coral), var(--purple)); border-radius: 5px; transition: width 0.5s ease-in-out; }
.tier-tile.completed .progress-bar { background: var(--lime); }
.tier-tile .claim-btn { width: 100%; margin-top: 1rem; }

/* GRID LINK CARDS */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.6rem; margin-top: 1rem; }
.link-card { position: relative; background: rgba(255,255,255,0.88); border: 1px solid var(--glass-border); border-radius: 18px; padding: 1.6rem; text-align: center; box-shadow: var(--glow-soft); }
.link-card-name { font-size: 1.25rem; font-weight: 700; margin-bottom: .5rem; }
.link-card-code { font-family: ui-monospace, monospace; background: #eef2ff; display: inline-block; padding: .35rem .6rem; border-radius: 8px; margin-bottom: 1rem; }
.link-card .copy-btn { width: 100%; }

/* Wallet */
.wallet-summary { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 1rem; background: rgba(255,255,255,0.9); padding: 1.5rem; border-radius: 16px; text-align: center; margin-bottom: 2rem; border: 1px solid var(--glass-border); box-shadow: var(--glow-soft); }
.summary-item { flex: 1; min-width: 160px; }
.summary-item h4 { font-size: 1rem; font-weight: 600; opacity: .8; margin-bottom: .5rem; }
.summary-item p { font-size: 2rem; font-weight: 800; }
.wallet-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* History Toggle */
.history-toggle { display: flex; gap: .5rem; margin-top: 2rem; border-bottom: 2px solid var(--border-color); }
.toggle-btn { background: transparent; color: var(--text-color); border: 2px solid transparent; border-bottom: none; padding: .9rem 1.5rem; border-radius: 10px 10px 0 0; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all .25s ease; opacity: .65; margin-bottom: -2px; }
.toggle-btn.active { background: var(--glass-bg); border-color: var(--glass-border); opacity: 1; }
.history-content { padding-top: 1.25rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.modal-content { background: var(--glass-bg); padding: 2rem; border-radius: 18px; width: 90%; max-width: 900px; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 12px 40px rgba(0,0,0,0.25); border: 1px solid var(--glass-border); }
.modal-close { position: absolute; top: .8rem; right: 1.2rem; font-size: 2rem; font-weight: 800; cursor: pointer; color: #666; }
#withdrawal-modal .modal-content { background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); border-top: 6px solid var(--purple); }

/* Admin Panel */
.admin-nav-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}
.admin-content {
    margin-top: 1rem;
}
body.admin-theme { background: #f4f7f6; }
.admin-theme header, .admin-theme footer, .admin-theme section { background: #fff; }
.admin-theme .button-link { background: #e9ecef; color: #000; }
.admin-theme .button-link:hover { background: #343a40; color: #fff; }

/* Footer */
footer { background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.5)); text-align: center; padding: 1.6rem; margin-top: 2rem; border-top: 1px solid var(--glass-border); }
footer ul { list-style: none; display: flex; justify-content: center; gap: 1.2rem; flex-wrap: wrap; }
footer a { color: var(--text-color); text-decoration: none; font-weight: 600; }

/* TABLES */
table { width: 100%; border-collapse: collapse; overflow: hidden; border-radius: 14px; box-shadow: var(--glow-soft); }
th, td { padding: .9rem 1rem; border-bottom: 1px solid var(--border-color); text-align: left; }
th { background: rgba(198,131,255,0.12); font-weight: 700; }
tr:hover { background: rgba(255,255,255,0.6); }

/* UTILITIES */
.hidden { display: none !important; }
