/**
 * Alfa-panel – Tema Alfanest
 * Fundal #050505, border auriu #D4AF37, glow discret, text alb
 * Carduri: shadow auriu permanent, la hover → alb neon (aceeași intensitate)
 * Fonturi: Inter (UI), JetBrains Mono (stats)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Paletă */
  --alfa-bg: #050505;
  --alfa-border: #D4AF37;
  --alfa-text: #ffffff;
  --alfa-text-muted: #b0b0b0;
  --alfa-card-bg: #0a0a0a;

  /* Glow discret – lumină fină din spate */
  --alfa-card-glow: 0 0 20px rgba(212, 175, 55, 0.08);
  --alfa-border-glow: 0 0 12px rgba(212, 175, 55, 0.06);

  /* Fonturi */
  --alfa-font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --alfa-font-mono: 'JetBrains Mono', monospace;

  /* Sidebar */
  --alfa-sidebar-w: 240px;
  --alfa-sidebar-collapsed: 60px;
  --alfa-sidebar-transition: width 0.3s ease, transform 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}
html, body {
  background: var(--alfa-bg) !important;
  color: var(--alfa-text);
  font-family: var(--alfa-font-ui);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Stats, cifre, IDs */
.alfa-mono, .alfa-stat, [data-alfa-stat] {
  font-family: var(--alfa-font-mono);
}

/* ========== Header ========== */
.alfa-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--alfa-bg);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
}

.alfa-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.alfa-header .alfa-logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--alfa-text);
  text-decoration: none;
  letter-spacing: 0.05em;
}

/* Search Global – fix în header */
.alfa-search-wrap {
  position: relative;
  width: 240px;
}

.alfa-search {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 6px;
  color: var(--alfa-text);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.alfa-search::placeholder {
  color: var(--alfa-text-muted);
}

.alfa-search:focus {
  outline: none;
  border-color: var(--alfa-border);
  box-shadow: var(--alfa-border-glow);
}

/* Select / dropdown – fundal închis, text alb (consistent cu tema) */
select {
  padding: 10px 12px;
  background: var(--alfa-card-bg);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 6px;
  color: var(--alfa-text);
  font-size: 1rem;
  font-family: var(--alfa-font-ui);
  min-width: 200px;
  color-scheme: dark;
}
select:focus {
  outline: none;
  border-color: var(--alfa-border);
}
select option {
  background: var(--alfa-card-bg);
  color: var(--alfa-text);
}

/* Custom dropdown – pentru browsere care ignoră stilurile native */
.alfa-select-wrap {
  position: relative;
  width: 100%;
}
.alfa-select-trigger {
  width: 100%;
  padding: 10px 36px 10px 12px;
  background: var(--alfa-card-bg);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 6px;
  color: var(--alfa-text);
  font-size: 1rem;
  font-family: var(--alfa-font-ui);
  text-align: left;
  cursor: pointer;
  position: relative;
}
.alfa-select-trigger::after {
  content: '▼';
  font-size: 0.65rem;
  color: var(--alfa-text-muted);
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}
.alfa-select-trigger.placeholder { color: var(--alfa-text-muted); }
.alfa-select-trigger:hover, .alfa-select-trigger:focus {
  border-color: var(--alfa-border);
  outline: none;
}
.alfa-select-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--alfa-card-bg);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}
.alfa-select-dropdown.is-open { display: block; }
.alfa-select-option {
  padding: 10px 12px;
  color: var(--alfa-text);
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s;
}
.alfa-select-option:hover {
  background: rgba(212, 175, 55, 0.12);
}
.alfa-select-option.selected {
  background: rgba(212, 175, 55, 0.18);
  color: var(--alfa-border);
}

.alfa-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--alfa-text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.alfa-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.alfa-credits {
  font-family: var(--alfa-font-mono);
  font-size: 0.9rem;
  color: var(--alfa-border);
}

.alfa-user-menu, .alfa-logout-btn {
  color: var(--alfa-text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: border-color 0.2s, background 0.2s;
}

.alfa-user-menu:hover, .alfa-logout-btn:hover {
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.05);
}

/* ========== Sidebar ========== */
.alfa-sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  width: var(--alfa-sidebar-w);
  height: calc(100vh - 56px);
  background: var(--alfa-card-bg);
  border-right: 1px solid rgba(212, 175, 55, 0.2);
  transition: var(--alfa-sidebar-transition);
  z-index: 900;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.alfa-sidebar.collapsed {
  width: var(--alfa-sidebar-collapsed);
}

.alfa-sidebar.hidden {
  transform: translateX(-100%) !important;
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  border-right: none;
}

.alfa-sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.alfa-sidebar-group {
  margin-bottom: 24px;
}

.alfa-sidebar-group-title {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--alfa-text-muted);
  padding: 8px 16px;
  margin-bottom: 4px;
}

.alfa-sidebar.collapsed .alfa-sidebar-group-title {
  display: none;
}

.alfa-sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--alfa-text);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.alfa-sidebar a:hover {
  background: rgba(212, 175, 55, 0.06);
  border-left-color: var(--alfa-border);
}

.alfa-sidebar a.active {
  background: rgba(212, 175, 55, 0.08);
  border-left-color: var(--alfa-border);
  color: var(--alfa-text);
}

.alfa-sidebar a .icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.alfa-sidebar a span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alfa-sidebar.collapsed a span {
  display: none;
}

/* Contact discret – footer sidebar */
.alfa-sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.alfa-sidebar-toggle-wrap {
  padding: 8px 16px 16px;
  flex-shrink: 0;
}

.alfa-sidebar-footer a {
  font-size: 0.75rem;
  color: var(--alfa-text-muted);
  padding: 4px 0;
  border: none;
}

.alfa-sidebar-footer a:hover {
  color: var(--alfa-border);
  background: transparent;
}

.alfa-sidebar.collapsed .alfa-sidebar-footer span {
  display: none;
}

/* Toggle sidebar */
.alfa-sidebar-toggle {
  width: 32px;
  margin-left: auto;
  display: block;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: transparent;
  color: var(--alfa-text-muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
}

.alfa-sidebar-toggle:hover {
  color: var(--alfa-border);
  border-color: var(--alfa-border);
}

/* Buton expand – în header, vizibil când sidebar e ascuns */
.alfa-sidebar-expand {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  margin-right: 8px;
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 6px;
  color: var(--alfa-text);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.alfa-sidebar-expand.is-visible {
  display: flex;
}
.alfa-sidebar-expand:hover {
  color: var(--alfa-border);
  border-color: var(--alfa-border);
  background: rgba(212, 175, 55, 0.08);
}

/* ========== Content area ========== */
.alfa-content {
  margin-left: var(--alfa-sidebar-w);
  margin-top: 56px;
  padding: 24px;
  min-height: calc(100vh - 56px);
  transition: margin-left 0.3s ease;
}

.alfa-sidebar.collapsed ~ .alfa-content,
.alfa-sidebar.collapsed + .alfa-content {
  margin-left: var(--alfa-sidebar-collapsed);
}

.alfa-sidebar.hidden ~ .alfa-content,
.alfa-sidebar.hidden + .alfa-content {
  margin-left: 0;
}

.alfa-page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--alfa-text);
}

/* ========== Stats cards (dashboard) ========== */
.alfa-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.alfa-stat-card {
  background: var(--alfa-card-bg);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--alfa-card-glow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.alfa-stat-card:hover {
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.1);
}

.alfa-stat-card .value {
  font-family: var(--alfa-font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--alfa-text);
  margin-bottom: 4px;
}

.alfa-stat-card .label {
  font-size: 0.85rem;
  color: var(--alfa-text-muted);
}

/* ========== User Cards (Card Grid) ========== */
.alfa-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.alfa-user-card {
  background: var(--alfa-card-bg);
  border: 1px solid var(--alfa-border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--alfa-card-glow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.alfa-user-card:hover {
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.1);
}

.alfa-user-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* Status indicator – cerc pulsant */
.alfa-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alfa-status-dot.online {
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  animation: alfa-pulse 2s ease-in-out infinite;
}

.alfa-status-dot.offline {
  background: #555;
  box-shadow: none;
}

@keyframes alfa-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }
  50% { opacity: 0.8; box-shadow: 0 0 12px rgba(255, 255, 255, 0.4); }
}

.alfa-user-card .username {
  font-weight: 600;
  font-size: 1rem;
  color: var(--alfa-text);
}

.alfa-user-card .meta {
  font-size: 0.8rem;
  color: var(--alfa-text-muted);
  margin-bottom: 16px;
  font-family: var(--alfa-font-mono);
}

.alfa-user-card-actions {
  display: flex;
  gap: 8px;
}

.alfa-btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-family: var(--alfa-font-ui);
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: transparent;
  color: var(--alfa-text);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.alfa-btn-sm:hover {
  border-color: var(--alfa-border);
  background: rgba(212, 175, 55, 0.08);
  color: var(--alfa-border);
}

.alfa-btn-sm.primary {
  border-color: var(--alfa-border);
  color: var(--alfa-border);
}

/* ========== Modal ========== */
.alfa-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.alfa-modal-backdrop.is-open {
  display: flex;
}

.alfa-modal {
  position: relative;
  background: var(--alfa-card-bg);
  border: 1px solid var(--alfa-border);
  border-radius: 12px;
  padding: 24px;
  padding-top: 48px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--alfa-card-glow), 0 0 24px rgba(212, 175, 55, 0.06);
}

.alfa-modal h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--alfa-text);
}

.alfa-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--alfa-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.alfa-modal-close:hover {
  color: var(--alfa-text);
}

/* ========== Mobile ========== */
@media (max-width: 768px) {
  .alfa-menu-mobile {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .alfa-search-wrap {
    width: 120px;
  }

  .alfa-sidebar {
    transform: translateX(-100%);
    width: var(--alfa-sidebar-w);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .alfa-sidebar.is-open {
    transform: translateX(0);
  }

  .alfa-sidebar.collapsed {
    width: var(--alfa-sidebar-w); /* pe mobile nu colapsează la 60px, doar hide */
  }

  .alfa-content {
    margin-left: 0 !important;
  }

  .alfa-sidebar-overlay {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 899;
  }

  .alfa-sidebar-overlay.is-visible {
    display: block;
  }

  .alfa-sidebar-toggle {
    display: none; /* on mobile use overlay to close */
  }

  .alfa-sidebar-expand {
    display: none !important; /* mobile: folosește menu hamburger */
  }

  /* Responsive table wrapper - scroll horizontally on small screens */
  .alfa-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .alfa-table-wrap table {
    min-width: 480px;
  }

  .alfa-header-right {
    gap: 12px;
    flex-wrap: wrap;
  }

  .alfa-credits {
    font-size: 0.8rem;
  }

  .alfa-user-card-actions {
    flex-wrap: wrap;
  }
}
