/* --- DESIGN SYSTEM & CSS VARIABLES --- */
:root {
  /* Colors */
  --bg-main: #0c0c0e;
  --bg-sidebar: #131316;
  --bg-card: rgba(26, 26, 32, 0.7);
  --bg-card-hover: rgba(36, 36, 45, 0.85);
  --bg-input: #17171d;
  
  --border-color: rgba(184, 134, 11, 0.2);
  --border-glow: rgba(212, 175, 55, 0.4);
  
  /* Primary Accent: Amber Gold */
  --primary: #d4af37;
  --primary-hover: #f3cf65;
  --primary-glow: rgba(212, 175, 55, 0.25);
  
  /* Secondary Accent: Deep Amber */
  --secondary: #b8860b;
  
  /* Status Colors */
  --color-admin: #e06c75;
  --color-mod: #61afef;
  --color-player: #98c379;
  
  --color-attending: #4caf50;
  --color-maybe: #ffeb3b;
  --color-absent: #f44336;
  
  --text-main: #e2e2e7;
  --text-muted: #8e8e9f;
  --text-dark: #0c0c0e;
  
  /* Fonts */
  --font-serif: 'Cinzel', serif;
  --font-fantasy: 'Cinzel Decorative', serif;
  --font-sans: 'Inter', sans-serif;
  
  /* Layout */
  --sidebar-width: 280px;
  --header-height: 80px;
  --border-radius: 12px;
  
  /* Transition */
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(21, 21, 28, 0.4) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(184, 134, 11, 0.05) 0%, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Custom Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #2a2a35;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* --- TYPOGRAPHY --- */
.fantasy-title {
  font-family: var(--font-fantasy);
  color: var(--primary);
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.fantasy-title-sm {
  font-family: var(--font-serif);
  color: var(--primary);
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
  font-weight: 700;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
  text-shadow: 0 0 8px var(--primary-glow);
}

/* --- BUTTONS & CONTROLS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  gap: 0.5rem;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--text-dark);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.05);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
  transform: translateY(-1px);
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-block {
  display: flex;
  width: 100%;
}

.glow-on-hover {
  position: relative;
  overflow: hidden;
}

.glow-on-hover::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: 0.5s;
}

.glow-on-hover:hover::after {
  left: 100%;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(20, 20, 25, 0.95);
  border-left: 4px solid var(--primary);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem 1.5rem;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: var(--text-main);
  min-width: 300px;
  max-width: 450px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.3s ease forwards;
}

.toast.success { border-left-color: var(--color-player); }
.toast.error { border-left-color: var(--color-admin); }
.toast.info { border-left-color: var(--color-mod); }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: 1rem;
}

/* --- UTILITY CLASSES --- */
.hidden { display: none !important; }
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- AUTH PAGE STYLES --- */
.auth-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 3rem;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-accent {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); text-shadow: 0 0 15px var(--primary); }
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-method-selectors {
  display: flex;
  background: var(--bg-main);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem;
  border-radius: 6px;
  font-family: var(--font-serif);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.auth-tab-btn.active {
  background: rgba(212, 175, 55, 0.1);
  color: var(--primary);
  border: 1px solid var(--border-color);
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
}

/* OAuth layout */
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
  border-radius: 8px;
  font-weight: 600;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-discord {
  background: #5865F2;
  color: #fff;
}
.btn-discord:hover {
  background: #4752C4;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.35);
}

.btn-google {
  background: #ffffff;
  color: #1f1f1f;
}
.btn-google:hover {
  background: #f1f1f1;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.btn-icon {
  width: 18px;
  height: 18px;
  margin-right: 12px;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.5rem 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.divider:not(:empty)::before { margin-right: 1em; }
.divider:not(:empty)::after { margin-left: 1em; }

/* Dev fallback box */
.dev-magic-box {
  margin-top: 1.5rem;
  background: rgba(212, 175, 55, 0.05);
  border: 1px dashed var(--primary);
  padding: 1rem;
  border-radius: 8px;
}

.dev-header {
  margin-bottom: 0.8rem;
}

.dev-badge {
  font-size: 0.7rem;
  font-weight: bold;
  background: var(--primary);
  color: #000;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.3rem;
}

.dev-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dev-link-button {
  display: block;
  text-align: center;
  background: var(--primary);
  color: var(--text-dark);
  font-weight: bold;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.dev-link-button:hover {
  background: var(--primary-hover);
  color: var(--text-dark);
  text-shadow: none;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.form-row {
  display: flex;
  gap: 15px;
}

.col-6 { flex: 0 0 calc(50% - 7.5px); }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  background: var(--bg-main);
}

textarea {
  resize: vertical;
}

.auth-toggle-text {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-error-banner {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: #ff8a80;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.db-status-bar {
  margin-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-dot.green {
  background: var(--color-player);
  box-shadow: 0 0 8px var(--color-player);
}

/* --- APP LAYOUT (Authenticated Dashboard) --- */
.app-section {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2.5rem;
  padding-left: 0.5rem;
}

.rune {
  color: var(--primary);
  font-size: 1.2rem;
  text-shadow: 0 0 10px var(--primary);
}

.user-badge {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2.5rem;
}

.avatar-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--primary);
  background: var(--bg-input);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-displayname {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.user-role-tag.admin { color: var(--color-admin); }
.user-role-tag.moderator { color: var(--color-mod); }
.user-role-tag.player { color: var(--color-player); }

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.nav-icon {
  width: 20px;
  height: 20px;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.nav-btn.active {
  color: var(--primary);
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--primary);
  padding-left: calc(1rem - 3px);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: auto;
  text-align: left;
  transition: var(--transition);
}

.btn-logout:hover {
  color: var(--color-admin);
  background: rgba(244, 67, 54, 0.05);
}

.sidebar-legal-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.sidebar-legal-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  transition: var(--transition);
}

.sidebar-legal-link:hover {
  color: var(--primary);
}

.sidebar-legal-separator {
  color: rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
}

/* MAIN CONTENT */
.main-content {
  flex-grow: 1;
  padding: 3rem;
  overflow-y: auto;
  height: 100vh;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1.5rem;
}

.panel-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

/* --- GAME SESSIONS TAB PANEL --- */
.sessions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius);
  gap: 1rem;
}

.empty-state p {
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

/* Session Card */
.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.session-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.session-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.session-badge {
  font-size: 0.75rem;
  background: rgba(212, 175, 55, 0.1);
  color: var(--primary);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-serif);
}

.session-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  background: rgba(0, 0, 0, 0.2);
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.meta-val {
  font-size: 0.95rem;
  font-weight: 500;
  margin-top: 2px;
}

.meta-val a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.session-desc {
  font-size: 0.95rem;
  color: #cbcbdf;
  white-space: pre-line;
  line-height: 1.6;
}

/* RSVPs Layout */
.session-rsvps {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1.5rem;
}

.rsvp-header {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.rsvp-status-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.rsvp-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.rsvp-group-label {
  font-size: 0.8rem;
  width: 110px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: bold;
}
.rsvp-group-label.attending { color: var(--color-attending); }
.rsvp-group-label.maybe { color: var(--color-maybe); }
.rsvp-group-label.absent { color: var(--color-absent); }

.rsvp-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  font-size: 0.8rem;
}

.rsvp-chip-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

.rsvp-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rsvp-prompt {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-rsvp {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-serif);
  font-weight: bold;
  transition: var(--transition);
}

.btn-rsvp:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-rsvp.attending.active {
  background: rgba(76, 175, 80, 0.15);
  border-color: var(--color-attending);
  color: var(--color-attending);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}

.btn-rsvp.maybe.active {
  background: rgba(255, 235, 59, 0.1);
  border-color: var(--color-maybe);
  color: var(--color-maybe);
  box-shadow: 0 0 10px rgba(255, 235, 59, 0.15);
}

.btn-rsvp.absent.active {
  background: rgba(244, 67, 54, 0.15);
  border-color: var(--color-absent);
  color: var(--color-absent);
  box-shadow: 0 0 10px rgba(244, 67, 54, 0.2);
}

/* Mod control buttons */
.session-admin-controls {
  display: flex;
  gap: 10px;
}

.btn-icon-only {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon-only:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(212, 175, 55, 0.05);
}

.btn-icon-only.btn-delete-session:hover {
  color: var(--color-admin);
  border-color: var(--color-admin);
  background: rgba(244, 67, 54, 0.05);
}

.icon-svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* --- PLAYER RESOURCES PANEL --- */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 170px;
}

.resource-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.resource-main {
  margin-bottom: 1.25rem;
}

.resource-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
}

.resource-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.resource-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.resource-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-resource-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- TAVERN CHAT PANEL --- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.chat-messages-area {
  flex-grow: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-message-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: messageIn 0.3s ease-out forwards;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-input);
}

.chat-msg-body {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 0.8rem 1.2rem;
  border-radius: 0 12px 12px 12px;
  max-width: 85%;
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.chat-msg-author {
  font-weight: 600;
  font-size: 0.9rem;
}

.chat-msg-role {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: bold;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}
.chat-msg-role.admin { color: var(--color-admin); background: rgba(224, 108, 117, 0.1); }
.chat-msg-role.moderator { color: var(--color-mod); background: rgba(97, 175, 239, 0.1); }
.chat-msg-role.player { color: var(--color-player); background: rgba(152, 195, 121, 0.1); }

.chat-msg-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-msg-content {
  font-size: 0.9rem;
  color: #cbcbdf;
  word-break: break-word;
}

.chat-msg-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  padding: 0.25rem;
}

.chat-message-row:hover .chat-msg-delete-btn {
  opacity: 1;
}

.chat-msg-delete-btn:hover {
  color: var(--color-admin);
}

.chat-input-bar {
  display: flex;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  gap: 12px;
}

.chat-input-bar input {
  flex-grow: 1;
}

.btn-send {
  background: var(--primary);
  border: none;
  color: var(--text-dark);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-send:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 12px var(--primary-glow);
}

.send-icon {
  width: 18px;
  height: 18px;
}

/* --- ADMIN PANEL USER MANAGEMENT --- */
.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.admin-table-container {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  border-bottom: 2px solid var(--border-color);
  padding: 1rem;
  color: var(--primary);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: bold;
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
  font-size: 0.9rem;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

.admin-user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-input);
}

.role-select {
  max-width: 150px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* --- MODALS --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out forwards;
}

.modal-card {
  background: #15151c;
  border: 1px solid var(--primary);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 15px rgba(212, 175, 55, 0.1);
  padding: 2.5rem;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalUp 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes modalUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover {
  color: var(--primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1.5rem;
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 992px) {
  .app-section {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  
  .sidebar-header {
    margin-bottom: 0;
  }
  
  .user-badge {
    margin-bottom: 0;
    padding: 0.5rem;
    background: none;
    border: none;
  }
  
  .nav-menu {
    flex-direction: row;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    padding: 8px;
    z-index: 999;
    justify-content: space-around;
  }
  
  .nav-btn {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    padding: 0.4rem 0.2rem;
    flex: 1;
  }
  
  .nav-btn.active {
    border-left: none;
    border-bottom: 2px solid var(--primary);
    padding-left: 0.2rem;
    padding-bottom: calc(0.4rem - 2px);
  }
  
  .btn-logout {
    margin-top: 0;
    padding: 0.5rem;
    font-size: 0.85rem;
  }
  
  .main-content {
    padding: 2rem 1.5rem 6rem 1.5rem;
    height: auto;
  }
  
  .chat-container {
    height: 50vh;
  }
}

@media (max-width: 600px) {
  .auth-card {
    padding: 1.5rem;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .col-6 {
    flex: 0 0 100%;
  }
  
  .session-header-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .session-card {
    padding: 1.25rem;
  }
  
  .sidebar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .modal-card {
    padding: 1.5rem;
    max-height: 95vh;
  }
}

/* --- PROFILE AVATAR PRESET STYLING --- */
.avatar-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 0.5rem;
}

.avatar-preset-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.avatar-preset-item:hover {
  border-color: var(--primary);
  background: rgba(212, 175, 55, 0.05);
  transform: translateY(-2px);
}

.avatar-preset-item.selected {
  border-color: var(--primary);
  background: rgba(212, 175, 55, 0.15);
  box-shadow: 0 0 12px var(--primary-glow);
}

.avatar-preset-item img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid transparent;
  margin-bottom: 0.4rem;
  background: var(--bg-input);
  transition: transform 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.avatar-preset-item:hover img {
  border-color: var(--primary);
  transform: scale(1.05);
}

.avatar-preset-item span {
  font-size: 0.7rem;
  font-family: var(--font-serif);
  font-weight: bold;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.avatar-preset-item:hover span {
  color: var(--primary);
}

@media (max-width: 480px) {
  .avatar-preset-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .avatar-preset-item {
    padding: 0.25rem;
  }
  .avatar-preset-item img {
    width: 50px;
    height: 50px;
    border-width: 1.5px;
  }
  .avatar-preset-item span {
    font-size: 0.6rem;
  }
}
