/* styles.css */

/* License: Public Domain
   Font by: Alex Maracinaru
   https://www.fontspace.com/arowit-font-f30292 */

/* ======================== */
/* ====== VARIABLES ======== */
/* ======================== */
:root {
  --content-width: 600px;
  --form-width: 320px;
  --breakpoint-mobile: 480px;
  --breakpoint-tablet: 768px;
  --breakpoint-laptop: 1024px;
  --breakpoint-desktop: 1280px;
  --breakpoint-wide: 1440px;
}

/* ======================== */
/* ====== RESET & BASE ===== */
/* ======================== */
*, *::before, *::after {
  box-sizing: border-box;
}

/* -------------------- Base -------------------- */
html, body {
  min-width: 320px;
  margin: 0;
  padding: 0;
  height: 100vh;
  font-family: "Coalabeer-5Vlv", sans-serif;
  font-size: 18px;
  background: #ddd url(../assets/bg.webp);
  background-size: cover;
  background-position: center;
  background-repeat: repeat;
  overflow: overlay;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: center; /* Center everything globally */
  text-align: center;
  padding: 0 20px;
  line-height: 1;
}


/* ======================== */
/* ====== TYPOGRAPHY ======= */
/* ======================== */
@font-face {
  font-family: "Coalabeer-5Vlv";
  src: url("../fonts/Coalabeer-5Vlv.eot");
  src: url("../fonts/Coalabeer-5Vlv.eot?#iefix") format("embedded-opentype"),
       url("../fonts/Coalabeer-5Vlv.woff2") format("woff2"),
       url("../fonts/Coalabeer-5Vlv.woff") format("woff"),
       url("../fonts/Coalabeer-5Vlv.ttf") format("truetype"),
       url("../fonts/Coalabeer-5Vlv.svg#Coalabeer-5Vlv") format("svg");
  font-weight: normal;
  font-style: normal;
}

h1, h2, h3 {
  margin: 10px 0 10px;
  text-align: center;
  font-size: 1.8rem;
}

p {
  margin: 10px;
  font-size: 1.2rem;
  line-height: 1.5rem;
  text-align: center;
}

label {
  text-align: center;
}


/* ======================== */
/* ======= LAYOUT ========= */
/* ======================== */
/* Ensure main takes remaining space and centers content */
main {
  display: flex;
  flex-direction: column; /* Stack sections vertically */
  align-items: center;
  width: 100%;
  flex: 1; /* Pushes footer to bottom */
  margin-bottom: 10px;
}


/* Section inside main */
section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* Specific auth-section styles */
#auth-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  margin: 0;
  width: 100%;
}

/* Header layout */
header {
  padding: 0; /* Changed from 0.5rem to 0 */
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;

}

.header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: var(--content-width);
  width: 100%;
}

#logo {
  width: 100%;
  max-width: 500px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Center wrapper utility */
.center-wrapper {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ======================== */
/* ====== FORMS & AUTH ==== */
/* ======================== */

.auth-forms {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: auto; /* adjust as needed */
  align-items: center;
}

.form-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: var(--form-width);
  text-align: center;
  margin: 0 auto;
}

.form-block h3 {
  margin-bottom: 1rem;
}

.form-block form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

input {
  width: 100%;
  max-width: 250px;
  padding: 0.5rem;
  box-sizing: border-box;
}

/* =================== */
/* Dashboard Layout    */
/* =================== */

/* Center the main dashboard container itself */
main.dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;    /* Horizontal centering for children */
    justify-content: flex-start;
    width: 100%;
    margin: 0 auto;         /* Standard block centering */
}

/* Ensure the summary box stays centered and centers its children */
.collection-summary {
    display: flex;
    flex-direction: column; /* Dashboard default */
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 900px;
    margin: 20px auto !important; /* Forces horizontal centering */
    text-align: center;
}

.collection-summary ul {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    width: fit-content;
    min-width: 280px;
}

/* Style for each stats group */
.collection-summary li {
    display: block;
    text-align: center;     /* Ensures the text inside the bubble is centered */
    margin: 0.5rem 0;
}

/* Ensure the top themes list behaves exactly the same */
#top-themes-list {
    text-align: center;
}

/* Theme progress section */
.themeProgress {
    width: 100%;
    max-width: 400px;         /* same as ul above */
    margin-top: 0.5rem;
    padding-left: 0;          /* remove default indent */
}

.themeProgress li {
    background-color: #f3f3f3;
    border-left: 4px solid #7ec9e4;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    margin: 0.3rem 0;
}

.dashboard-wrapper {
    width: 100%;
    max-width: 1200px; /* For Desktop */
    margin: 0 auto;
    padding: 15px; /* Keeps content off the edge of the S25 screen */
    box-sizing: border-box; /* Crucial: ensures padding doesn't add to the width */
}

/* =============================== */
/* ====== WELCOME SECTION ======== */
/* =============================== */

.welcome-section {
    margin-top: 30px;    /* Space above the greeting */
    margin-bottom: 30px; /* Space below the greeting, before the buttons */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Optional: Removes the default margin on the h2 so our custom spacing is perfectly accurate */
.welcome-section h2 {
    margin: 0;
}

/* Apply this globally to all your page headings to keep them uniform */
.page-controls {
    margin-top: 30px;
    margin-bottom: 20px; /* Use this to create that space you wanted */
    text-align: center;
}

.page-controls h2 {
    margin: 0; /* Keep the title clean */
}

/* ============================ */
/* 2. Stats Page Specific Overrides */
/* ============================ */

/* Force the Main area to stack sections vertically */
.stats-main {
    display: flex !important;
    flex-direction: column !important; 
    align-items: center !important;
    width: 100%;
}

/* Force the 3 stat boxes into a horizontal row */
.stats-page .collection-summary {
    flex-direction: row !important;
    justify-content: center !important;
    flex-wrap: wrap;
    gap: 40px;
}

/* Style for the individual boxes on Stats page */
.stats-page .summary-item {
    flex: 0 1 auto;
    text-align: center;
    min-width: 180px;
}

/* Big Blue Numbers */
.stats-page .summary-item .value, 
.username {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #3bb3e0;
    margin-top: 5px;
}

/* Keep the Table container centered below */
.stats-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ======================================== */
/* ======= THEME DISPLAY CONTAINERS ======= */
/* ======================================== */
#themes-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  margin: 0 auto;
  margin-top: 0;

}

#themes-container a.cta {
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px; /* spacing between text and SVG */
}

#themes-container label {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

#themes-container input[type="checkbox"] {
  margin-right: 10px;
}

a {
  text-decoration: none;
  cursor: pointer;
  color: black;
}

a:visited {
  color: white;
}

a:hover, a:focus, a:active {
  color: #072239;
}

#loading-message {
  font-weight: bold;
  text-align: center;
  margin: 1em;
  color: #444;
}

/* Style specifically for the theme titles */
.theme-title {
  color: #3bb3e0 !important; /* Force this color regardless of global link rules */
  font-weight: bold;
  text-decoration: none;
}

.theme-title:visited {
  color: #3bb3e0 !important; /* Forces it to stay blue even after clicking */
}

.theme-title:hover {
  color: #072239 !important; /* Your signature dark blue hover */
}

/* =============================== */
/*==========DO NOT TOUCH ==========*/
/* =============================== */
/* =============================== */
/* =========FLOW BUTTONS========== */
/* =============================== */
/* From Uiverse.io by alexmaracinaru */ 
.cta {
  position: relative;
  margin: auto;
  padding: 5px 5px;
  transition: all 0.2s ease;
  border: none;
  background: none;
  cursor: pointer;

}

.cta:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  border-radius: 50px;
  background: #b1dae7;
  width: 50px;
  height: 50px;
  transition: all 0.3s ease;
}

.cta span {
  position: relative;
  text-align: center;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #234567;
}

.cta svg {
  position: relative;
  top: 0;
  margin-left: 10px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: #234567;
  stroke-width: 2;
  transform: translateX(-5px);
  transition: all 0.3s ease;
}

.cta:hover:before {
  width: 100%;
  background: #b1dae7;
}

.cta:hover svg {
  transform: translateX(0);
}

.cta:active {
  transform: scale(0.95);
}


/* =============================== */
/*==========DO NOT TOUCH ==========*/
/* =============================== */
/* =============================== */
/* ========== BUTTONS ============ */
/* =============================== */
.button {
  background-color: #3bb3e0;
  font-family: "Coalabeer-5Vlv", sans-serif;
  font-size: 1.25rem;
  text-decoration: none;
  color: #fff;
  box-shadow: inset 0px 1px 0px #7fd2f1, 0px 6px 0px #156785;
  border-radius: 10px;
  display: inline-block;
  width: 140px;
  height: 36px;
  line-height: 36px;
  border: none;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  text-align: center;
}

.button:active {
  top: 7px;
  box-shadow: inset 0px 1px 0px #7fd2f1, inset 0px -1px 0px #156785;
  color: #072239;
  background: #3bb3e0;
}

.button::before {
  background-color: #072239;
  content: "";
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  left: -2px;
  top: 5px;
  z-index: -1;
  border-radius: 10px;
  box-shadow: 0px 1px 0px #fff;
}

.button:active::before {
  top: -2px;
}

.button:hover {
  background-color: #34a5cf; /* slightly darker shade */
  color: #072239;           /* match the link hover */
}

/* Specific Gold/Yellow style for the Best Value button */
.button-gold {
  background-color: #ffc107;
  color: #000;
  /* Top light highlight and bottom 3D shadow */
  box-shadow: inset 0px 1px 0px #ffe082, 0px 6px 0px #b28905;
}

.button-gold:hover {
  background-color: #ffca28; /* Slightly brighter on hover */
  color: #000;
}

.button-gold:active {
  background-color: #ffc107;
  /* Pressed state shadow */
  box-shadow: inset 0px 1px 0px #ffe082, inset 0px -1px 0px #b28905;
}

/* The dark background/outline for the gold button */
.button-gold::before {
  background-color: #333; /* Darker outline to make the gold pop */
}

/* This targets the div containing the buttons inside page-controls */
.page-controls > .button-row {
  margin-top: 20px;    /* Space between the H2 title and buttons */
  margin-bottom: 40px; /* Space between the buttons and the themes list */
  display: flex;       /* Optional: allows for easy spacing between buttons */
  gap: 15px;           /* Adds a consistent 15px gap between the two buttons */
  justify-content: center; /* Keeps buttons centered if that's your layout */
  flex-wrap: wrap;     /* Ensures they stack nicely on mobile screens */
}

/* Specific Green style for the Whatsapp button */
.button-green {
  background-color: #25D366;
  color: #fff;
  /* Top light highlight (Vibrant Mint) and bottom 3D shadow (Dark Teal) */
  box-shadow: inset 0px 1px 0px #70f7a2, 0px 6px 0px #075E54;
}

.button-green:hover {
  background-color: #3de07a; /* Made this slightly brighter so it actually reacts when hovered */
  color: #000;
}

.button-green:active {
  background-color: #25D366;
  /* FIXED: Replaced the leftover gold colors with your correct green and teal shadows */
  box-shadow: inset 0px 1px 0px #70f7a2, inset 0px -1px 0px #075E54;
}

/* The dark background/outline for the green button */
.button-green::before {
  background-color: #072239; /* Matched to your site's dark blue outline instead of #333 */
}

/* ======================== */
/* ======== INPUT BAR ===== */
/* ======================== */
.input {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  margin-right: 0.5rem;
}


/* ======================== */
/* ======== NAVIGATION ===== */
/* ======================== */
nav {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.nav-group {
  display: flex;
  justify-content: center; /* Keeps them centered */
  flex-wrap: wrap;         /* Allows buttons to drop to a new line on small screens */
  gap: 12px;               /* Space between buttons (optimized for touch targets) */
  margin-bottom: 15px;     /* Space between the rows */
  width: 100%;
}

/* Ensure the bottom row doesn't have extra bottom margin */
.nav-group-bottom {
  margin-bottom: 0;
}

/* =============================== */
/* ===== START HERE POINTER ====== */
/* =============================== */

/* Keeps the button and the pointer bound together in the grid */
.start-here-wrapper {
    position: relative;
    display: inline-block;
}

/* The styling for the floating text box */
.start-here-pointer {
    position: absolute;
    top: -40px; 
    left: 50%;
    transform: translateX(-50%);
    background-color: #F504CC; 
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: "Coalabeer-5Vlv", sans-serif;
    font-size: 1rem;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 100;
    pointer-events: none; /* Ensures users can still click the button underneath */
    
    /* Triggers the float animation */
    animation: float-bounce 1.5s infinite ease-in-out;
}

/* The little triangle pointing down at the button */
.start-here-pointer::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    margin-left: -6px;
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #F504CC transparent transparent transparent;
}

/* The up-and-down floating animation */
@keyframes float-bounce {
    0%, 100% {
        top: -40px;
    }
    50% {
        top: -30px; /* Moves it down 10px */
    }
}

/* =============================== */
/* ===== FUN BEGIN POINTER ======= */
/* =============================== */

/* 1. The row container aligns its children */


/* 2. Make the wrapper act like a flexible container that mimics a button */
.fun-begin-wrapper {
    position: relative;
    display: inline-block;
}

/* 3. Ensure the anchor inside the wrapper looks exactly like the one outside */
.fun-begin-wrapper .button {
    margin: 0; /* Remove any accidental margins */
}

.fun-begin-pointer {
    position: absolute;
    top: 0; 
    left: 50%;
    transform: translateX(-50%);
    background-color: #F504CC; 
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: "Coalabeer-5Vlv", sans-serif;
    font-size: 1rem;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 100;
    pointer-events: none; 
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    animation: float-bounce 1.5s infinite ease-in-out;
}

.fun-begin-pointer.show-pointer {
    opacity: 1;
    visibility: visible;
}

.fun-begin-pointer::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    margin-left: -6px;
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #F504CC transparent transparent transparent;
}

/* ======================== */
/* ======== SORTING ===== */
/* ======================== */
.sort-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    font-family: sans-serif;
}

.sort-label {
    font-weight: bold;
    color: #444;
}

.sort-group {
    display: flex;
    background: #e0e0e0; /* Light grey background for the group */
    border-radius: 25px;
    padding: 4px;
}

.sort-btn {
    text-decoration: none;
    color: #555;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    color: #000;
}

/* This styles the currently selected sorting method */
.sort-btn.active {
    background-color: #3bb3e0; /* Matches your main theme blue */
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


/* ======================================== */
/* =======THEME SELECTION CONTAINERS ====== */
/* ======================================== */
/* Container that wraps all themes */
#theme-selection-form {
  display: flex;
  flex-direction: column;
  align-items: center; /* center children horizontally */
  gap: 0.5px;
  padding: 5px;
}

/* Each individual theme row */
.theme-container {
  display: flex;
  justify-content: center; /* center horizontally */
}

/* Make label contents horizontal */
.theme-container label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  cursor: pointer;
}

/* Style checkbox */
.theme-container input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

/* ======================== */
/* ======= PAGINATION ====== */
/* ======================== */

.pagination {
  display: flex;
  justify-content: center;
  padding: 20px 0;
  font-family: "Coalabeer-5Vlv", sans-serif;
  flex-wrap: wrap;
}

.pagination button {
  font-family: inherit;
  padding: 6px 12px;
  cursor: pointer;
  border: 1px solid #ccc;
  background-color: #f5f5f5;
  border-radius: 4px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.pagination .active {
  background-color: #3bb3e0;
  color: white;
}

.pagination button:disabled {
  background-color: #ddd;
  cursor: not-allowed;
}

.pagination button:hover:not(:disabled) {
  background-color: #d6d6d6;
}

.pagination button:focus {
  outline: 2px solid #3bb3e0;
  outline-offset: 2px;
}

.pagination .ellipsis {
  padding: 0 6px;
  user-select: none;
  pointer-events: none;
}

/* ======================== */
/* ======== LOGOUT ========= */
/* ======================== */

.logout-container {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
}

#logout-btn {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 0.5rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.3s ease;
}

#logout-btn:hover {
  background-color: #c82333;
}

/* ======================== */
/* ======== PROFILE ======== */
/* ======================== */

.profile-container {
  margin: 0.5rem auto;
  max-width: var(--content-width);
  padding: 1rem;
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.2;
}

.avatar {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border: 3px solid #3bb3e0;
  border-radius: 8px;
}

.username {
  color: #3bb3e0;
  font-size: 2rem;
  font-weight: bold;
}

.badge {
    background: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid #ffeeba;
    display: inline-block;
    margin-right: 5px;
}

/* ======================== */
/* ======== FOOTER ======== */
/* ======================== */

footer {
  padding: 0.5rem 1rem;        /* reduced horizontal padding */
  text-align: center;
  max-width: var(--content-width);
  margin: 0 auto;
}
footer {
  width: 100%;             /* Occupies full screen width */
  padding: 2rem 0;         /* Vertical breathing room */
  display: flex;           /* Use flex for perfect centering */
  justify-content: center; /* Center horizontally */
  align-items: center;     /* Center vertically */
  clear: both;             /* Ensures it sits below all other content */
}

.footer-inner {
  width: 100%;
  max-width: var(--content-width); /* Keeps text from getting too wide */
  text-align: center;              /* Centers the text inside */
  margin: 0 auto;
}

.footer-inner a {
  color: #156785;
  text-decoration: none;
}

.footer-inner a:hover {
  color: #7ec9e4;
}


/* ======================== */
/* ========= STATS ======== */
/* ======================== */

/* CRITICAL FIX: Stops the footer from floating and allows stats to move up */
body.stats-page {
    display: block;
    height: auto;
    padding-bottom: 10px;
}

.summary-grid {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 180px;
    flex: 1;
}

.stat-card .label {
    font-size: 0.85rem;
    margin-bottom: 5px;
    display: block;
    color: #555;
}

.stat-card .value {
    font-size: 0.85rem;
    font-weight: bold;
    color: #072239;
}

.stats-container {
    padding: 0;
    max-width: 800px;
    margin: 0 auto;
}

/* ======================== */
/* ===== STATS TABLE ====== */
/* ======================== */

.stats-table {
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stats-table th {
    background-color: #3bb3e0;
    color: white;
    padding: 8px 4px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #156785;
}

.stats-table td {
    padding: 8px 4px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.stats-table td:first-child {
    word-wrap: break-word;
    font-weight: bold;
}

.stats-table th:nth-child(2),
.stats-table th:nth-child(3),
.stats-table td:nth-child(2),
.stats-table td:nth-child(3) {
    text-align: center;
    width: 40px;
}

/* ======================== */
/* ===== PROGRESS BAR ===== */
/* ======================== */

.progress-bar {
    background: #eee;
    width: 60px;
    height: 10px;
    border-radius: 8px;
    overflow: hidden;
    margin: 4px auto 0;
    display: inline-block;
    vertical-align: middle;
}

.progress-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(
        45deg,
        rgba(255,255,255,0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.15) 75%,
        transparent 75%,
        transparent
    ),
    #3bb3e0;
    background-size: 20px 20px;
}

/* Gold styling for completed themes */
.progress-fill.is-complete {
    background: linear-gradient(
        90deg,
        #bf953f,
        #fcf6ba,
        #b38728,
        #fbf5b7,
        #aa771c
    ) !important;
    box-shadow: 0 0 8px rgba(191,149,63,0.6);
}

/* ======================== */
/* === COLLECTION SUMMARY = */
/* ======================== */

.collection-summary {
    text-align: center;
    margin: 30px 0 20px 0; /* Reduced bottom spacing */
    font-size: 1.2rem;
}

.collection-summary .summary-item {
    margin-bottom: 12px;
    font-weight: 600;
    color: #072239;
}

.value-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 5px;
}

.val-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.val-box small {
    font-size: 0.8rem;
    color: #888;
    letter-spacing: 0.5px;
}

.val-box span {
    font-size: 1rem;
    font-weight: bold;
    color: #072239;
}

/* ======================== */
/* ===== TOP FIGURES ====== */
/* ======================== */

.top-figs-grid {
    display: grid;
    /* FIX: auto-fill makes it fully responsive across all devices */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

.fig-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
}

.fig-card img {
    height: 100px;
    width: auto;
    object-fit: contain;
    margin-bottom: 15px;
}

.fig-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.fig-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 10px;

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    
    /* FIX: Ensure long strings don't stretch the grid */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.fig-val {
    margin-top: auto;
    font-weight: bold;
    color: #007bff;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}

/* ======================== */
/* ===== Avatar Picker ===== */
/* ======================== */

.avatar-grid {
    display: grid;
    /* This forces 3 equal columns */
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px;
    margin: 20px 0;
    /* Optional: Limit the width so they don't get too large on big screens */
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.avatar-option {
    text-align: center;
    cursor: pointer;
}

.avatar-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.avatar-option label {
    display: block;
    padding: 8px;
    border-radius: 12px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.avatar-option img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid transparent;
    background: #f8f9fa;
    object-fit: cover;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.avatar-option input:checked + label {
    background: #e6f4ff;
    box-shadow: 0 0 0 3px #a5d8ff;
}

.avatar-option input:checked + label img {
    border-color: #1e90ff;
    transform: scale(1.08);
}

.avatar-option label:hover img {
    transform: scale(1.12);
}

.avatar-option label:active img {
    transform: scale(1.15);
}

.avatar-name {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #444;
    font-weight: 500;
}

.current-preview {
    text-align: center;
    margin: 30px 0 40px;
}

.current-preview img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 6px solid #1e90ff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    
    /* This prevents the squishing */
    object-fit: cover; 
    object-position: center; /* Ensures the middle of the image is shown */
}

/* ========================= */
/* === PROFILE FORM INPUTS === */
/* ========================= */

.username-input {
    width: 100%;
    max-width: 400px;
    height: 40px;
    padding: 0.5rem;
    font-family: "Coalabeer-5Vlv", sans-serif;
    color: #ffffff;
    font-size: 22px;
    border: 2px solid #000000;
    border-radius: 10px;
    box-sizing: border-box;
    background-color: #156785;
    box-shadow: inset 3px 6px #7fd2f1;
    display: block;
    margin: 6px auto 0; /* Center-aligns the input field */
    text-align: center; /* Centers the text inside the input */
}

/* ======================== */
/* ===== Admin Buttons ===== */
/* ======================== */

.step-desc { 
    font-size: 13px; 
    color: #aaa; 
    margin: 5px 0 20px 5px; 
    line-height: 1.4; 
}

/* ================================== */
/* === WANTED LIST LAYOUT & PRINT === */
/* ================================== */

.controls-wrapper {
    margin: 15px auto 30px auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
    max-width: 800px;
}

.layout-controls, .export-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.layout-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.layout-controls select {
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 1rem;
}

.button.auto-width {
    width: auto;
    padding: 0 20px;
}

.button.auto-width {
    width: auto;
    padding: 0 15px; /* Slightly reduced padding so they fit better side-by-side on small phones */
}

/* Custom 3D Theme Select Dropdown (Matched to Search Bar) */
.layout-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.layout-controls label {
    font-family: "Coalabeer-5Vlv", sans-serif;
    font-size: 22px; /* Matches the new input size */
    color: #072239;
    line-height: 40px; /* Aligns the text perfectly with the 40px tall box */
}

.theme-select {
    /* Reset default browser box */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    
    /* Exact Search Bar match */
    height: 40px;
    width: 220px; 
    font-family: "Coalabeer-5Vlv", sans-serif;
    color: #ffffff;
    font-size: 22px;
    
    /* FORCE the black border */
    border: 2px solid #000000 !important;
    border-radius: 10px;
    
    box-sizing: border-box;
    background-color: #156785;
    box-shadow: inset 3px 6px #7fd2f1;
    
    padding: 0 40px 0 0.5rem; 
    cursor: pointer;
    
    /* Custom white down-arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
}

.theme-select:focus {
    /* Prevents the browser from adding a weird blue glow ring */
    outline: none !important;
    
    /* Keeps the border solid black when you click it */
    border: 2px solid #000000 !important; 
}

/* Style the dropdown menu items */
.theme-select option {
    background-color: #156785;
    color: #ffffff;
    font-family: "Coalabeer-5Vlv", sans-serif;
    font-size: 18px; /* Slightly smaller text for the actual list so it isn't massive */
}

/* --- Compact List View --- */
.view-list .top-figs-grid { display: block; }
.view-list .fig-card {
    display: flex; flex-direction: row; align-items: center; padding: 10px;
    border: none; border-bottom: 1px solid #ccc; border-radius: 0;
    margin-bottom: 0; text-align: left; background: transparent;
}
.view-list .fig-card::before {
    content: ''; display: inline-block; min-width: 22px; height: 22px;
    border: 2px solid #888; border-radius: 4px; margin-right: 15px; background: white;
}
.view-list .fig-card img { height: 50px; width: 50px; margin-bottom: 0; margin-right: 15px; }
.view-list .fig-info { flex-direction: row; align-items: center; width: 100%; gap: 15px; }
.view-list .fig-name { flex-grow: 1; margin-bottom: 0; -webkit-line-clamp: unset; text-align: left; }
.view-list .id-num { font-size: 0.9rem; color: #555; }
.view-list .fig-val { margin: 0; padding: 0; border: none; font-size: 0.9rem; }

/* --- Text-Only View (Ink Saver) --- */
.view-text .top-figs-grid { display: block; }
.view-text .fig-card {
    display: flex; flex-direction: row; align-items: center; padding: 8px 10px;
    border: none; border-bottom: 1px dashed #ccc; border-radius: 0; text-align: left; background: transparent;
}
.view-text .fig-card::before {
    content: ''; display: inline-block; min-width: 20px; height: 20px;
    border: 2px solid #000; margin-right: 15px;
}
.view-text .fig-card img { display: none; } 
.view-text .fig-info { flex-direction: row; align-items: center; width: 100%; gap: 15px; }
.view-text .fig-name { flex-grow: 1; margin-bottom: 0; -webkit-line-clamp: unset; text-align: left; }
.view-text .id-num { font-size: 0.9rem; }
.view-text .fig-val { margin: 0; padding: 0; border: none; font-size: 0.9rem; }

/* --- A4 Print Specific Styles --- */
@media print {
    @page { size: A4 portrait; margin: 15mm; }
    body { background: white !important; color: black !important; padding: 0 !important; overflow: visible !important; }
    .no-print, header, nav, footer, .controls-wrapper { display: none !important; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .fig-card { page-break-inside: avoid; break-inside: avoid; }
    .view-grid .top-figs-grid { display: grid; grid-template-columns: repeat(4, 1fr) !important; gap: 10px; }
    .view-grid .fig-card { border: 1px solid #ccc !important; }
    .view-grid .fig-card img { max-height: 80px; }
}

/* ======================================== */
/* =========== LEADERBOARD ================ */
/* ======================================== */

.leaderboard-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 800px;
}

.leaderboard-nav a {
    flex: 1 1 auto;
    text-align: center;
    padding: 10px;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    transition: all 0.2s ease;
}

.leaderboard-nav a.active {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.leaderboard-container {
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead tr {
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.leaderboard-table th {
    padding: 15px;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
}

.col-rank { text-align: left; width: 5%; }
.col-user { text-align: left; width: 85%; }
.col-score { text-align: right; width: 10%; }

.leaderboard-row {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s;
}

.leaderboard-row.is-me {
    background: rgba(255, 243, 205, 0.6);
}

.lb-divider td {
    text-align: center;
    padding: 10px;
    color: #aaa;
    background: rgba(0,0,0,0.02);
}

.lb-rank {
    padding: 15px;
    font-weight: bold;
    color: #888;
    font-size: 0.95rem;
}

.lb-user { padding: 15px; }
.lb-score-cell { padding: 15px; text-align: right; }

.lb-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lb-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
    object-fit: cover;
    flex-shrink: 0;
}

.lb-user-details {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap; /* Allows badges to drop below name on small screens */
}

.lb-username {
    color: #111;
    font-size: 0.95rem;
    white-space: nowrap;
}

.lb-pro-badge {
    color: #28a745;
    font-weight: bold;
    font-size: 0.7rem;
    background: rgba(40, 167, 69, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.lb-achieve-badge {
    font-size: 0.75rem;
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #ffeeba;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* 1. Tell the table cell to stack elements vertically and align them to the right */
/* 1. Reset the parent container's gap */
.leaderboard-table td:last-child, 
.lb-score-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0 !important; /* 👈 Forces the uniform gap to 0 so we can use custom margins */
}

/* 2. Fix the score line-height and remove default margins */
.lb-score {
    font-weight: 800;
    font-size: 1.2rem;
    line-height: 1.2; /* Changed from 1rem to prevent text clipping/extra spacing bugs */
    margin: 0;        /* Strips out any hidden browser margins */
}

.lb-score.themes { color: #28a745; }
.lb-score.themes span { font-size: 0.8rem; color: #666; }
.lb-score.value { color: #d69e2e; }
.lb-score.default { color: #007bff; }

/* 3. Tighten up the subscore spacing */
.lb-subscore {
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
    display: block;
    margin: 2px 0 0 0; /* Gives it just a tiny 2px gap below the main score */
}

/* 2. Control the space between the Score and the Name */
.lb-subscore.fig-name {
    margin-top: 4px;   /* Creates a clean space below the dollar value */
    margin-bottom: 0;  /* Ensures no bottom spacing pushes the number away */
    line-height: 1.2;  /* Tightens up the text box bounding box */
}

/* 3. Snug the Number right up against the Name */
.lb-subscore.fig-num {
    margin-top: -2px !important; /* 👈 A tiny negative margin completely deletes the gap */
    line-height: 1.1;            /* Keeps the text block ultra-compact */
    font-size: 1rem; /* Adjust this number up or down to find your sweet spot */
    font-weight: 400;   /* Optional: makes it a tiny bit bolder if it's hard to read */
}

/* ======================================== */
/* --- ENHANCED MOBILE RESPONSIVENESS ----- */
/* ======================================== */

@media (max-width: 480px) {
    /* 1. Reset column distributions for tiny screens */
    .col-rank { width: 12%; }
    .col-user { width: 53%; }
    .col-score { width: 35%; }

    /* 2. Prevent table from blowing past its parent container */
    .leaderboard-container {
        width: 100%;
        overflow-x: hidden; /* Prevent horizontal container scrolling */
    }
    
    .leaderboard-table {
        table-layout: fixed; /* Forces columns to honor widths instead of content sizes */
        width: 100%;
    }

    /* 3. Compress padding to maximize horizontal canvas space */
    .leaderboard-table th, 
    .lb-rank, 
    .lb-user, 
    .lb-score-cell {
        padding: 10px 4px;
    }

    .lb-rank {
        font-size: 0.85rem;
    }

    /* 4. Keep the User block horizontally aligned and crisp */
    .lb-user-info {
        gap: 8px;
        overflow: hidden;
    }

    .lb-avatar {
        width: 34px;
        height: 34px;
        border-width: 1px;
    }

    /* Fix layout alignment: rows wrap naturally, but elements line up evenly */
    .lb-user-details {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
        width: 100%;
    }

    .lb-username {
        font-size: 0.85rem;
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* 5. Clean up the badges so they fit cleanly beneath or alongside */
    .lb-pro-badge {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    .lb-achieve-badge {
        font-size: 0.65rem;
        padding: 1px 6px;
        white-space: nowrap;
        max-width: 110px; /* Restrict badge size so it doesn't clip the score */
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
    }

    /* 6. Fix the score column clipping */
    .lb-score-cell {
        vertical-align: middle;
    }

    .lb-score {
        font-size: 0.95rem;
        white-space: nowrap;
    }

    /* Drastically scale back the Holy Grail text threshold to keep it on-screen */
    .lb-subscore.fig-name {
        max-width: 95px; /* Shrinks the max allowed width before adding '...' */
        font-size: 0.65rem;
        margin-left: auto;
    }
    
    /* 2x2 grid for the nav tabs still fits beautifully */
    .leaderboard-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 6px;
    }
    
    .leaderboard-nav a {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
}

/* ======================================== */
/* =============== STATS PAGE ============= */
/* ======================================== */

.stats-section {
    width: 100%;
    margin-bottom: 30px;
}

.stats-section .section-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
}

/* --- 1. Collection Summary Grid --- */
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    width: 100%;
    margin-bottom: 30px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.summary-card small {
    color: #888;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.75rem;
    display: block;
    margin-bottom: 5px;
}

.summary-card .value {
    font-size: 1.25rem;
    font-weight: bold;
}
.summary-card .value.success { color: #28a745; }
.summary-card .value.primary { color: #007bff; }


/* --- 2. Top Figures Grid --- */
.top-figs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    width: 100%;
}

.fig-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.fig-card-top {
    margin-bottom: 8px;
}

.fig-card-top img {
    max-height: 80px;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto 8px;
    display: block;
}

.fig-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    min-height: 2.4em;
}

.fig-val {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    color: #007bff;
    padding-top: 8px;
    border-top: 1px dashed #eee;
    margin-top: auto;
}


/* --- 3. Theme Breakdown Grid --- */
.theme-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    width: 100%;
}

.theme-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
}

.theme-card.empty-themes {
    text-align: center;
    grid-column: 1 / -1;
    padding: 20px;
}

.theme-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.theme-title {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1.2;
}

.btn-small {
    padding: 0;
    width: 75px;
    height: 26px;
    line-height: 26px;
    font-size: 0.7rem;
    background: #6c757d;
    box-shadow: none;
    border-radius: 6px;
    flex-shrink: 0;
    text-align: center;
    color: #fff;
    text-decoration: none;
    display: inline-block;
}

.theme-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.03);
    padding: 8px 12px;
    border-radius: 8px;
}

.theme-card-stats .label {
    font-size: 0.85rem;
    color: #555;
    font-weight: 600;
}

.theme-card-stats .count {
    font-size: 1rem;
    font-weight: bold;
    color: #072239;
}

.theme-card-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.progress-bar-container {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.08);
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    background: #28a745;
    height: 100%;
    border-radius: 5px;
}

.progress-percent {
    font-size: 0.9rem;
    font-weight: bold;
    color: #28a745;
    min-width: 45px;
    text-align: right;
    flex-shrink: 0;
}

/* ======================================== */
/* --- STATS PAGE MOBILE RESPONSIVENESS --- */
/* ======================================== */

@media (max-width: 480px) {
    /* Stack the top summary cards into a vertical list on small screens */
    .stats-summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Reduce padding slightly to save screen space */
    .summary-card {
        padding: 15px;
    }

    /* Shrink the grid size for the Holy Grail figs so they fit in pairs or triple columns */
    .top-figs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .fig-card {
        padding: 8px;
    }

    /* Prevent theme cards from being too wide and causing horizontal scroll */
    .theme-breakdown-grid {
        grid-template-columns: 1fr;
    }

    /* Ensure text doesn't overflow */
    .theme-title {
        font-size: 1rem;
        word-break: break-word;
    }
}

/* ======================================== */
/* ============== PROFILE PAGE ============ */
/* ======================================== */

.profile-block {
    text-align: center;
    padding: 30px 20px;
    width: 100%;
    max-width: 600px; /* Increased max-width to allow more stretch */
    margin: 0 auto;
}

.btn-danger {
    background-color: #d9534f;
    border-color: #d43f3a;
}
.btn-danger:hover {
    background-color: #c9302c;
}

/* Achievement Badge Grid */
.profile-achievements {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Creates two equal columns */
    gap: 12px;
    margin-bottom: 30px;
    justify-items: start; /* Forces badges to align to the start (left) of each column */
    max-width: 500px; /* Constrain grid width so it doesn't spread too far */
    margin-left: auto;
    margin-right: auto;
}

.ach-badge {
    background: #2d1b4e;
    color: #fff;
    padding: 8px 16px;
    border-radius: 25px;
    border: 2px solid #f504cc;
    font-size: 0.8rem; /* Slightly smaller to fit better in columns */
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    width: 100%; /* Ensures badges fill their column space */
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    text-align: left; /* Ensures text inside the badge aligns left */
}

/* Hover effect to make them feel interactive */
.ach-badge:hover {
    background: #f504cc;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(245, 4, 204, 0.4);
}

.profile-achievements .ach-badge {
    font-size: 0.85rem;
    background: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #ffeeba;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.profile-info {
    margin-top: 1.5rem;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #156785;
    object-fit: cover;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.profile-details {
    text-align: left;
    max-width: 350px;
    margin: 0 auto;
    line-height: 1.8;
    padding: 20px;
    border-radius: 12px;
}

/* Stretched Key/Value Grid */
.profile-details {
    display: grid;
    gap: 15px;
    text-align: left;
    padding: 25px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.profile-details p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 2.5px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.profile-details p:last-child { border-bottom: none; }

.profile-details strong {
    color: #333;
    font-weight: 700;
    font-size: 0.95rem;
}

.user-email {
    word-break: break-all;
    text-align: right;
}

/* Badge at the bottom of details */
.disp-badge {
    background: #e2e3e5;
    color: #383d41;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: bold;
}

.profile-actions {
    margin-top: 2rem;
}

/* ======================================== */
/* --- MOBILE STRETCHING RULES ----------- */
/* ======================================== */

@media (min-width: 480px) {
    /* On larger screens, spread the details out more */
    .profile-details {
        padding: 30px 40px;
    }
    
    .profile-details p {
        font-size: 1.1rem; /* Slightly larger text */
    }
}

@media (max-width: 480px) {
    .profile-block { padding: 15px 10px; }
    
    /* Ensure the container is fully stretched on mobile */
    .profile-details {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 20px;
    }
}

/* ======================================== */
/* --- EDIT PROFILE ----------- */
/* ======================================== */
.edit-profile-section {
    max-width: 680px; 
    margin: 0 auto;
    padding: 20px;
}

.center-text { text-align: center; }

/* Avatar Preview */
.preview-img {
    width: 120px; 
    height: 120px; 
    display: block; 
    margin: 10px auto; 
    border-radius: 50%; 
    border: 3px solid #156785;
}

/* Button Group */
.form-actions {
    margin-top: 30px; 
    display: flex; 
    gap: 10px; 
    justify-content: center;
}

.cancel-btn {
    background-color: #6c757d !important; 
    color: white !important; 
    text-decoration: none;
}

/* Mobile Fixes for the Avatar Grid */
@media (max-width: 480px) {
    .edit-profile-section { padding: 10px; }
    
    .avatar-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* 3 columns for better fit on phone */
        gap: 10px;
        margin-top: 20px;
    }

    .avatar-option img {
        width: 100%;
        height: auto;
        border-radius: 8px;
    }

    .form-actions { flex-direction: column; }
    .form-actions .button { width: 100%; }
}

.edit-profile-form .form-group label,
.edit-profile-form .avatar-preview-container label {
    display: block;
    font-size: 1.2rem;       /* Increase from default to 1.2rem */
    margin-bottom: 8px;      /* Adds a little breathing room */
    color: #333;             /* Ensures good contrast */
    font-weight: 600;        /* Makes it stand out more */
}

/* Optional: If you want the text to look even larger on desktop */
@media (min-width: 768px) {
    .edit-profile-form .form-group label,
    .edit-profile-form .avatar-preview-container label {
        font-size: 1.3rem;
    }
}

/* Target the labels directly to ensure they grow */
.form-group label {
    display: block;
    font-size: 1.25rem !important; /* Forces the size change */
    margin-bottom: 10px !important;
    font-weight: 700 !important;
    color: #333 !important;
}

/* Ensure the input and select boxes aren't too small */
.form-group input, 
.form-group select {
    font-size: 1rem !important;
    padding: 10px !important;
    width: 100% !important;
    box-sizing: border-box;
}

/* ======================================== */
/* --- RESPONSIVE AVATAR GRID ------------- */
/* ======================================== */

.avatar-grid {
    display: grid;
    /* This is the magic line: 
       It tells the browser: "Make columns at least 80px wide, 
       and fit as many as you can. If you can't fit them, wrap them." */
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
    margin: 20px 0;
    width: 100%; /* Ensures it stays within the parent container */
}

.avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.avatar-option label {
    cursor: pointer;
    width: 100%;
}

.avatar-option img {
    width: 100%;
    aspect-ratio: 1 / 1; /* Keeps images square */
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

/* Highlight the selected one */
.avatar-option input[type="radio"]:checked + label img {
    border-color: #156785;
    transform: scale(1.05);
}

/* Responsive tweak for your phone */
@media (max-width: 480px) {
    .avatar-grid {
        /* Force a slightly tighter grid on phones if needed */
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* ======================== */
/* ===== MEDIA QUERIES ===== */
/* ======================== */

/* Mobile adjustments */
@media (max-width: 480px) {
    .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 16px;
    }
    .avatar-option img {
        width: 80px;
        height: 80px;
    }
    .current-preview img {
        width: 120px;
        height: 120px;
        border-width: 5px;
    }


/* Respect reduced motion setting */
@media (prefers-reduced-motion: reduce) {
    .avatar-option img {
        transition: none;
        transform: none !important;
    }


/* Tablet and up */
@media (min-width: var(--breakpoint-tablet)) {
  body {
    font-size: 16px;
    padding: 1.5rem;
  }

  nav {
    flex-direction: row;
    max-width: var(--breakpoint-tablet);
  }

  h1, h2, h3 {
    font-size: 2rem;
  }

  p {
    font-size: 1.2rem;
    line-height: 1.2rem;
  }
}



/* Laptop and up */
@media (min-width: var(--breakpoint-laptop)) {
  body {
    font-size: 17px;
    padding: 2rem;
  }

  nav {
    max-width: var(--breakpoint-laptop);
  }
}

/* Desktop and up */
@media (min-width: var(--breakpoint-desktop)) {
  body {
    font-size: 18px;
    padding: 2.5rem;
  }

  nav {
    max-width: var(--breakpoint-desktop);
  }
}

/* Wide screens and up */
@media (min-width: var(--breakpoint-wide)) {
  body {
    font-size: 19px;
    max-width: var(--breakpoint-wide);
    margin: auto;
    padding: 3rem;
  }

  nav {
    max-width: var(--breakpoint-wide);
  }
}

/* Mobile-specific overrides below 480px */
@media (max-width: var(--breakpoint-mobile)) {
  #logo {
    max-width: 80%;
  }
  
  nav .nav-group {
    display: flex;
    flex-wrap: wrap;    /* Allows them to stack if 45% + 45% + gap > 100% */
    gap: 15px;          /* This creates space between the left/right buttons */
    justify-content: center;
    margin-bottom: 15px; /* This creates space between the TOP and BOTTOM row */
  }

  /* Ensure the buttons don't physically touch if they stack */
  .button {
    margin-bottom: 10px; 
  }

  .profile-content,
  .profile-header,
  .profile-info {
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
  }

  #theme-selection-form {
    padding: 0.5rem;
  }

  .theme-container label {
    font-size: 0.95rem;
  }

  .logout-container {
    top: 5px;
    right: 5px;
  }

  #logout-btn {
    font-size: 0.75rem;
    padding: 5px;
  }

  form {
    width: 90%;
  }

  .summary-cards {
    flex-direction: column;
  }

  .minifig {
    max-width: 100%;
    margin: 5px 0;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination button {
    padding: 6px 10px;
  }
  
  .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 16px;
    }
    .avatar-option img {
        width: 80px;
        height: 80px;
    }
    .current-preview img {
        width: 120px;
        height: 120px;
        border-width: 5px;
    }
}

