
/* EmberForge Portal v0.5 */

:root {
  --background: #14121c;
  --sidebar: #1d1725;
  --card: #241d2e;
  --maroon: #66023c;
  --cyan: #00ffff;
  --text: #f5f5f5;
  --muted: #aaa5b7;
  --border: #393044;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.app { display: flex; min-height: 100vh; }

/* Sidebar */

.sidebar {
  width: 270px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.brand { margin-bottom: 45px; }
.brand-header { display: flex; align-items: center; gap: 14px; }

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 0 9px rgba(0,255,255,.25));
}

.brand-name h2 { margin: 0; font-size: 21px; }

.brand-name span {
  display: block;
  margin-top: 5px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
}

.brand > p {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-link {
  width: 100%;
  padding: 13px 15px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  background: var(--maroon);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 25px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-version { color: var(--cyan); font-weight: 600; }
.sidebar-footer p { margin-bottom: 0; }

/* Main layout */

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 35px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 35px;
}

.topbar h1 { margin: 0 0 10px; font-size: 30px; }
.topbar p { margin: 0; color: var(--muted); }

.discord-button {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 9px;
  background: #5865f2;
  color: white;
  font-weight: 600;
}

.discord-button:hover { background: #4752c4; }

.member-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  object-fit: cover;
}

.member-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.member-details strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.member-details span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.logout-button {
  margin-left: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.logout-button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.logout-button:disabled { opacity: .5; cursor: wait; }

.auth-message {
  padding: 13px 18px;
  margin-bottom: 25px;
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  background: var(--card);
}

.portal-view { animation: fade-in .2s ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dashboard */

.welcome-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 30px;
  margin-bottom: 35px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(120deg, #350b2b, #241d2e 65%, #142c32);
}

.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
}

.welcome-card h2 { margin: 12px 0; font-size: 27px; }
.welcome-card p { max-width: 500px; color: var(--muted); line-height: 1.6; }

.welcome-gremlin {
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 0 15px rgba(0,255,255,.15));
}

.section-heading { margin: 30px 0 20px; font-size: 22px; }

.overview-grid,
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.overview-card,
.product-card,
.placeholder-card {
  padding: 25px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.overview-label {
  display: block;
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 13px;
}

.overview-card strong {
  display: block;
  color: var(--cyan);
  font-size: 23px;
  overflow-wrap: anywhere;
}

.overview-card p,
.product-card p,
.placeholder-card p {
  color: var(--muted);
  line-height: 1.6;
}

.section-intro { margin-bottom: 25px; }
.section-intro h2 { margin: 10px 0; font-size: 25px; }
.section-intro p { color: var(--muted); }

.placeholder-card { border-left: 4px solid var(--cyan); }
.placeholder-card h3, .product-card h3 { margin-top: 0; }
.placeholder-card .discord-button { margin-top: 10px; }

.product-icon { margin-bottom: 20px; font-size: 32px; }

.product-card {
  transition: transform .2s, border-color .2s;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--cyan);
}

.status {
  display: inline-block;
  margin-top: 15px;
  padding: 8px 12px;
  border-radius: 20px;
  background: rgba(0,255,255,.08);
  color: var(--cyan);
  font-size: 12px;
}

/* Server directory */

.server-stats,
.community-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 25px;
}

.stat-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--card);
}

.stat-card > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  color: var(--cyan);
  font-size: 25px;
  overflow-wrap: anywhere;
}

.stat-card .muted {
  color: var(--muted);
  font-size: 12px;
}

.server-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}

.search-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  max-width: 400px;
}

.search-label { color: var(--muted); font-size: 13px; }

#server-search {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
}

#server-search::placeholder { color: var(--muted); }

.server-filters { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-button {
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}

.filter-button:hover {
  border-color: var(--cyan);
  color: var(--text);
}

.filter-button.active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: white;
}

.server-results-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.server-results-heading h3 { margin: 0; font-size: 20px; }
.server-results-heading span { color: var(--muted); font-size: 13px; }

.server-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.server-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  transition: border-color .2s, transform .2s;
}

.server-card:hover {
  border-color: var(--cyan);
  transform: translateY(-3px);
}

.server-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.server-icon {
  width: 55px;
  height: 55px;
  flex-shrink: 0;
  border-radius: 15px;
  object-fit: cover;
  background: var(--sidebar);
}

.server-info { min-width: 0; }
.server-info h4 { margin: 0 0 7px; font-size: 15px; overflow-wrap: anywhere; }
.server-info p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.server-badges { display: flex; flex-wrap: wrap; gap: 8px; }

.server-badge {
  display: inline-block;
  padding: 7px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.server-badge.owner {
  background: rgba(0,255,255,.1);
  color: var(--cyan);
}

.server-badge.manager {
  background: rgba(180,90,160,.2);
  color: #f0a9dc;
}

.server-badge.member {
  background: rgba(170,165,183,.12);
  color: var(--muted);
}

.manage-button {
  width: 100%;
  margin-top: auto;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--sidebar);
  color: var(--muted);
}

.manage-button:disabled {
  cursor: not-allowed;
  opacity: .75;
}

.manage-button.enabled {
  background: var(--maroon);
  color: white;
  border-color: var(--maroon);
  font-weight: 600;
  cursor: pointer;
}

.manage-button.enabled:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,255,255,.12);
}

.server-notice {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
}

.server-notice.error {
  border-color: #a83e6c;
  color: #ffc3d9;
}

.server-disclaimer {
  margin-top: 25px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* v0.5 Server Command Center */

.back-button {
  align-self: flex-start;
  margin-bottom: 24px;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.back-button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.community-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 30px;
  margin-bottom: 25px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(115deg, #430b31, #241d2e 65%, #123038);
}

.community-icon {
  width: 105px;
  height: 105px;
  flex-shrink: 0;
  border: 2px solid var(--cyan);
  border-radius: 24px;
  object-fit: cover;
  background: var(--sidebar);
}

.community-heading {
  flex: 1;
  min-width: 0;
}

.community-heading h2 {
  margin: 10px 0;
  font-size: 28px;
  overflow-wrap: anywhere;
}

.community-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.preview-badge {
  align-self: flex-start;
  padding: 8px 12px;
  border: 1px solid var(--cyan);
  border-radius: 20px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 600;
}

.stat-card .server-id {
  font-size: 14px;
  word-break: break-all;
}

.info-panel {
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--cyan);
  border-radius: 12px;
  background: var(--card);
}

.info-panel h3 { margin-top: 0; }
.info-panel p { margin-bottom: 0; color: var(--muted); line-height: 1.7; }

/* Footer */

footer {
  margin-top: auto;
  padding-top: 35px;
  color: var(--muted);
  font-size: 13px;
}

/* Responsive */

@media (max-width: 1200px) {
  .server-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .overview-grid,
  .product-grid { grid-template-columns: 1fr; }
}

@media (max-width: 750px) {
  .server-grid,
  .server-stats,
  .community-stats { grid-template-columns: 1fr; }

  .community-hero {
    flex-wrap: wrap;
    padding: 22px;
  }

  .community-heading { flex-basis: calc(100% - 130px); }
}

@media (max-width: 650px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; padding: 20px; }
  .brand { margin-bottom: 20px; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-link { width: auto; }
  .sidebar-footer { margin-top: 20px; }
  .main-content { padding: 20px; }
  .topbar h1 { font-size: 25px; }

  .welcome-card {
    flex-direction: column-reverse;
    align-items: flex-start;
  }

  .welcome-gremlin { width: 100px; height: 100px; }
  .member-controls { flex-wrap: wrap; }
  .search-wrapper { max-width: none; flex-basis: 100%; }

  .community-icon { width: 80px; height: 80px; }
  .community-heading { flex-basis: 100%; }
  .community-heading h2 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .portal-view { animation: none; }
  .product-card, .server-card { transition: none; }
}
