@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");

:root {
  --bg: #0e1217;
  --bg-soft: #151b23;
  --surface: #1c2330;
  --surface-2: #20293a;
  --text: #eaeef5;
  --muted: #9aa3af;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --success: #24c16b;
  --chip: #2a3446;
  --ring: rgba(108, 92, 255, 0.35);
  --border: rgba(255, 255, 255, 0.08);
  --white: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #1a1531 0%, #111827 100%);
  color: var(--text);
}

/* ================= GLASS EFFECT ================= */
.glass {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-radius: 16px;
}

/* ================= CONTAINER ================= */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ================= TOPBAR ================= */
.topbar {
  padding: 14px 0;
  width: 100%;      
}

.topbar__row {
  display: flex;
  align-items: center;
  position: relative;
}

.brand-right {
  position: absolute;
  left: 50%;
  transform: translateX(-50%); /* keep center alignment */
  display: flex;
  align-items: center;
  pointer-events: none;
}

.brand-center .brand {
  pointer-events: auto;
  transform: translateX(-35px); /* move the entire brand (logo + name) slightly left */
}

.brand {
  display: flex;
  align-items: center;
  color: var(--white);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 12px;
}

span.brand__name {}

.brand__logo {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  margin-right: 1px; /* spacing between logo and name */
}

.brand__name {
  font-weight: 700;
  font-size: 2rem;
}

/* ================= LOGIN ================= */
.login {
  margin-left: auto;
}

.login__button {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: #FFFFFF;
  border-radius: 14px;
  font-weight: 600;
  color: black;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.login__button:hover {
  background-color: #c6c6c6;
}

.tooltip {
  display: none;
}

/* ================= HERO ================= */
.hero {
  margin-top: 32px;
}

.hero__title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.hero__subtitle {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 24px;
}

/* ================= TOOLBAR ================= */
.toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px;
  margin-bottom: 24px;
  border-radius: 16px;
}

.toolbar__filters .chip {
  padding: 0.75rem 1.5rem; /* bigger box */
  font-size: 0.95rem;       /* bigger text */
  border-radius: 0.75rem;  /* optional */
  font-family: Figtree, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji";
}

/* ================= SEARCH ================= */
.search {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  padding: 10px;
  border-radius: 16px;
  
  /* Inherit font family from parent (body or .search container) */
  font-family: inherit;
}

.search__input {
  flex: 1;
  font-family: inherit;  /* Inherit font family from the parent */
  font-size: 1.05rem;    /* Increase the font size slightly */
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  border: none;
}

.search__input::placeholder {
  color: var(--muted);
}

.search__input:focus {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
  transition: box-shadow 0.2s ease, outline 0.2s ease;
}

/* Update the search button */
.search__button {
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
  
  /* Inherit font family from parent */
  font-family: inherit;
  font-size: 1.05rem;
}

.search__button:hover {
  background: var(--accent-2);
}

/* ================= BUTTONS ================= */
.btn {
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease-in-out;
}

.btn--primary {
  background: var(--accent);
  color: white;
}

.btn--primary:hover {
  background: var(--accent-2);
}

.btn--success {
  background: var(--success);
  color: white;
}

.btn--success:hover {
  background: #21a95a;
}

/* ================= CHIP BUTTONS (CATEGORIES) ================= */
.chip {
  background: var(--chip);
  color: var(--text);
  font-weight: 700;
  font-family: Arial, sans-serif;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}


.chip:hover {
  background: var(--accent-2);
}

/* ================= PAGE STRUCTURE ================= */
.page-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ================= PAGINATION ================= */
#pagination-section {
  margin-top: auto;
  padding: 40px 0;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 16px;
}

.pagination__btn,
.pagination__number {
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease-in-out;
}

.pagination__btn:hover,
.pagination__number:hover {
  background: var(--accent-2);
}

.pagination__number.current {
  background: var(--accent-2);
  color: white;
  pointer-events: none;
}

.pagination__dots {
  color: var(--muted);
  padding: 0 6px;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 600px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .toolbar__filters {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .btn--success {
    width: 100%;
    text-align: center;
  }

  .search {
    flex-direction: column;
    gap: 8px;
  }

  .search__input,
  .search__button {
    width: 100%;
    border-radius: 8px;
  }
}

/* ================= BACKGROUND OVERLAY ================= */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, hsl(220, 60%, 40%) 0%, hsl(220, 60%, 15%) 100%);
  opacity: 1;
  pointer-events: none;
}

/* ================= DROPDOWN MENU ================= */
.dropdown-content {
  display: none;
  position: absolute;
  top: 115%;          /* directly below the panel */
  left: 0;            /* align left edge with panel */
  width: 100%;        /* exactly match the width of the user-box */
  background-color: #112767;
  padding: 10px 0;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  z-index: 10;
}

/* Dropdown links */
.dropdown-content a {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: white;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* truncate long text */
}

/* For mobile screens */
@media (max-width: 480px) {
  .dropdown-content {
    left: 0;         /* keep aligned with panel */
    right: 0;
    width: auto;      /* adapt if necessary */
    min-width: 100%;  /* at least as wide as panel */
  }

  .dropdown-content a {
    padding: 8px 12px;
    font-size: 13px;
  }
}

  /* Make username in user-panel shrink too */
  .user-panel .username {
    max-width: calc(100vw - 100px); /* adapt to screen width minus avatar & padding */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Base user panel */
.user-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  background-color: #d4d4d4;
  padding: 10px 18px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s ease, width 0.2s ease;
  max-width: 100%;
  box-sizing: border-box;

  transform: translateX(-20px); /* moves the panel 20px to the left */
}

/* Avatar */
.user-panel .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Username */
.user-panel .username {
  color: #f3f3f3;
  font-size: 16px;
  font-weight: 600;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Shrink panel on narrow screens */
@media (max-width: 480px) {
  .user-panel {
    width: 80%;       /* 20% narrower than full width */
    gap: 10px;
    padding: 8px 14px;
  }

  .user-panel .username {
    font-size: 14px;
    max-width: calc(100% - 60px); /* leave room for avatar & gap */
  }
}

/* Outer dropdown container */
  display: inline-block;       /* shrink to fit panel */
  position: relative;          /* for absolute dropdown positioning */
  height: auto;                /* no fixed height */
  width: max-content;          /* fit exactly to inner panel content */
  box-sizing: border-box;
  transform: translateX(-20px); /* move the whole container if needed */
}

/* Inner user panel */
div.dropdown.user-box .user-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  background-color: #d4d4d4;
  padding: 10px 18px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s ease, width 0.2s ease;
  box-sizing: border-box;
  transform: none;         /* remove shift; control alignment from outer box */
}

/* To nudge the whole dropdown left if needed */
div.dropdown.user-box {
  transform: translateX(-20px);  /* now moves the whole container */
}

/* ================= USERNAME ================= */
div.dropdown.user-box .user-panel .username {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    flex-grow: 1;                /* fill available space */
    flex-shrink: 1;              /* shrink if needed */
    min-width: 0;                /* allow shrinking inside flex container */
    max-width: 100%;             /* never exceed container */
}

/* Align the icons properly with the text */
.icon {
  width: 20px;
  height: 20px;
  fill: #ccc; /* Lighter gray color */
  margin-right: 8px;
  vertical-align: middle; /* Ensures icons align properly with the text */
  transition: fill 0.2s ease-in-out; /* Smooth transition when hover */
}

.icon:hover {
  fill: #fff; /* Make the icon white when hovered */
}


.dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px;
  color: white;
  text-decoration: none;
  font-size: 14px;
}

.dropdown-item:hover {
  background-color: #353642;
}

/* === PUBLISH SERVER PAGE ONLY === */
form.card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 1.5rem;
}

form.card label {
  display: flex;
  flex-direction: column;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text, #ddd);
}

form.card input[type="text"],
form.card textarea,
form.card select {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  background-color: #181820;
  border: 1px solid #2a2a38;
  border-radius: 8px;
  color: #f0f0f0;
  transition: border 0.2s ease;
}

form.card input:focus,
form.card textarea:focus,
form.card select:focus {
  border-color: #5f80ff;
  outline: none;
}

form.card small {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  color: #aaa;
}

form.card .btn {
  align-self: flex-start;
  margin-top: 0.5rem;
  background-color: #5f80ff;
  color: white;
  border: none;
  padding: 0.65rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.25s ease;
}

form.card .btn:hover {
  background-color: #7a96ff;
}

/* ================= SERVER CARDS GRID ================= */
.home-page .servers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);  /* 3 per row on large screens */
  row-gap: 24px;
  column-gap: 24px;
  justify-items: center;
  margin-top: 2rem;
  padding: 0 16px;
  width: 100%;
  max-width: 1125px;                      /* align to search bar width */
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}

/* ================= INDIVIDUAL SERVER CARD ================= */
.home-page .server-card {
  position: relative; /* Ensures the splash background can be absolutely positioned */
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between; /* Ensures spacing within the card */
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  width: 100%;
  max-width: 300px;  /* max width */
  min-width: 300px;  /* prevent shrinking below 300px */
  height: 300px;     /* fixed height */
  overflow: hidden;  /* hide overflowed content */
}

/* Server name truncation */
.home-page .server-card h3 {
  margin: 0.5rem 0;
  font-size: 1.2rem;
  color: var(--text);

  white-space: nowrap;       /* Keep text on one line */
  overflow: hidden;          /* Hide overflow */
  text-overflow: ellipsis;   /* Add "..." when text is too long */
  max-width: 15ch;           /* Limit width to ~15 characters */
}


/* Server actions (buttons) at the bottom */
.home-page .server-card .server-card-actions {
  margin-top: 90px; /* Increase the space */
  display: flex;
  justify-content: center;
  gap: 1rem;
  width: 100%;
}

/* Button Styles */
a.server-btn {
  padding: 0.4rem 0.8rem; /* Smaller padding for buttons */
  font-size: 0.9rem; /* Smaller font size */
  background-color: rgba(75, 85, 99, 0.5);
  color: #fff;
  border-radius: 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px; /* Make buttons smaller */
  text-align: center;
}

a.server-btn:hover {
  background-color: rgba(75, 85, 99, 0.7);
  color: #333;
}

/* Hover state */
.home-page .server-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.12);  /* slightly lighter glass on hover */
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

/* ================= SPLASH BACKGROUND ================= */
.home-page .splash-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1; /* Ensure it's behind the content */
  background-size: cover;
  background-position: center;
  filter: blur(8px); /* Apply the blur effect here */
  border-radius: 16px; /* Match the border radius of the card */
}

/* Optional focus ring for accessibility */
.home-page .server-card:focus-within {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--ring), 0 10px 24px rgba(0, 0, 0, 0.25);
}

/* Media elements and text inside the card */
.home-page .server-card img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-bottom: 0.5rem;
}

.home-page .server-card h3 {
  margin: 0.5rem 0;
  font-size: 1.2rem;
  color: var(--text);
}

.home-page .server-card p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--muted);
}

/* ================= SERVER CARD ACTION BUTTONS ================= */
.home-page .server-card-actions {
  display: flex; /* Use flexbox to align buttons horizontally */
  gap: 8px; /* Space between the buttons */
  justify-content: center; /* Center the buttons horizontally */
  width: 100%; /* Ensure the action section stretches to full width of the card */
  margin-top: auto; /* Push the buttons to the bottom */
  margin-bottom: 1rem; /* Space between buttons and bottom edge of the card */
}

/* ================= BUTTON STYLES ================= */
a.server-btn {
  padding: 0.4rem 0.8rem; /* Smaller padding for smaller buttons */
  font-size: 0.9rem; /* Smaller font size */
  background-color: rgba(75, 85, 99, 0.5);
  color: #fff;
  border-radius: 1rem; /* Rounded corners */
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-flex; /* Ensure buttons behave as flex containers */
  align-items: center; /* Center text and icon inside buttons */
  justify-content: center; /* Center text and icon inside buttons */
  min-width: 100px; /* Make the buttons smaller */
  text-align: center; /* Ensure text is centered inside buttons */
}

a.server-btn:hover {
  background-color: rgba(75, 85, 99, 0.7); /* Darker shade on hover */
  color: #333; /* Darker text on hover */
}

/* ================= INDEPENDENT LIGHT BACKGROUND (BIGGER) ================= */
.user-panel {
  position: relative;   /* needed so the pseudo-element is positioned correctly */
  z-index: 0;           /* ensure content sits above background */
  padding: 9px 1px;   /* increased padding to make the box bigger */
  border-radius: 16px;  /* slightly rounder corners for larger box */
}

.user-panel::before {
  content: "";                    
  position: absolute;             
  top: -2px; bottom: -2px;       /* small expansion */
  left: -4px; right: -35px;
  background: linear-gradient(
    135deg,
    rgb(46 58 124), 
    rgb(18 86 222)
  );                               /* subtle light-to-dark gradient */
  backdrop-filter: blur(6px);      
  -webkit-backdrop-filter: blur(6px); /* Safari support */
  border-radius: 18px;            
  z-index: -1;                    
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* soft shadow */
}

/* ================= RESPONSIVE GRID ================= */
@media (max-width: 1024px) {
  .home-page .servers-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 cards per row on medium screens */
  }
}

@media (max-width: 600px) {
  .home-page .servers-grid {
    grid-template-columns: 1fr; /* 1 card per row on small screens */
    gap: 1rem; /* Adjust gap between cards */
  }
}
