/* Base styles for chat (shared mobile/desktop) */

/* Generic containers */
.chat-header { grid-area: header; }
.chat-input-footer { grid-area: footer; }
.chat-messages {
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Bubbles beginnen links und umbrechen darunter */
}

/* Main layout container – Desktop-Grid wird zentral in chat-layout.css gesetzt */
.main-layout { height: 100vh; overflow: hidden; }
/* Sidebar-Layout wird in sidebar.css verwaltet */
/* .sidebar: Layout nur in sidebar.css definieren */
/* .chat-content: veraltet – nicht mehr verwenden */
.chat-header { min-height:56px; max-height:56px; }
.chat-messages { flex:1 1 auto; min-height:0; }
.chat-input-footer {
  background:#f8f9fa; border-top:1px solid #e9ecef; padding:10px;
  flex:0 0 72px; min-height:72px; max-height:120px; position:relative; left:0; right:0; z-index:1000;
}
.mobile-only { display:none; }

.message-input-container {
  background:#fff; outline:none; z-index:10; position:relative; overflow-x:visible;
  flex-direction:column; display:flex; align-items:stretch; gap:4px;
}
.message-form-icons { display:flex; flex-wrap:wrap; gap:5px; justify-content:flex-start; }
.message-form-icons .btn {
  padding:8px 12px; border:1px solid #ddd; background:#fff; border-radius:4px; cursor:pointer; transition: background-color 0.2s;
  display:inline-flex; align-items:center; justify-content:center;
}
.message-form-icons .btn:hover { background:#f0f0f0; }
.message-form-icons .btn img { width:20px; height:20px; }
.form-control { flex:1; padding:10px; border:1px solid #ccc; border-radius:4px; font-size:14px; color:#f00; font-weight:bold; }

/* Chat container background layering */
#chat-container { position:relative; width:100%; height:100%; min-height:400px; grid-area:content; }
#chat-container #chat-messages {
  background:transparent !important; grid-area:unset; padding-bottom:0 !important;
}
#chat-container #chat-messages .message-item,
#chat-container #chat-messages .message,
#chat-container #chat-messages .chat-message {
  display: inline-block;            /* Bubble statt ganzer Zeile */
  background: rgba(255,255,255,0.85); 
  backdrop-filter: blur(2px);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 0 8px 0;              /* leicht verdichteter Abstand */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  width: auto;                      /* nur so breit wie Inhalt */
  max-width: 90%;                   /* bei langen Texten umbrechen */
}

.send-btn-mobile {
  background:#4a90e2; color:#fff; border:none; border-radius:8px; min-width:44px; min-height:44px; display:flex; align-items:center; justify-content:center; cursor:pointer;
}

/* Current room badge in header */
.current-room-display {
  text-align: center;
  padding: 5px 0;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin: 0 10px;
}

/* Support mail popup content */
#support-mail-popup { display: none; }
.popup-content.support-mail {
  max-width: 400px;
  padding: 2em 2em 1.5em 2em;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  background: #fff;
  position: relative;
}

.popup-content.support-mail h2 {
  margin-top: 0;
  color: #ff9800;
  text-align: center;
}

.popup-content.support-mail p {
  text-align: center;
  color: #444;
  margin-bottom: 1.5em;
}

.popup-content.support-mail form {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.popup-content.support-mail label {
  font-weight: 500;
}

.popup-content.support-mail input[type="email"],
.popup-content.support-mail select,
.popup-content.support-mail textarea {
  padding: 0.6em;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.popup-content.support-mail textarea {
  resize: vertical;
}

.popup-content.support-mail button[type="submit"] {
  background: #ff9800;
  color: #fff;
  font-weight: bold;
  padding: 0.8em;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

#support-mail-feedback {
  margin-top: 1em;
  text-align: center;
}

.popup-content.support-mail .popup-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

/* Utility */
.is-hidden { display: none !important; }

/* Header: Sound settings */
#sound-settings-wrapper { display:inline-block; position:relative; vertical-align:middle; }
#sound-settings-btn { background:none; border:none; padding:0; cursor:pointer; }
#sound-settings-icon { width:28px; height:28px; vertical-align:middle; filter:drop-shadow(0 0 2px #333); }
#sound-settings-dropdown {
  display:none;
  position:fixed;
  background:#fff;
  border:1px solid #ccc;
  border-radius:6px;
  box-shadow:0 2px 8px rgba(0,0,0,0.12);
  min-width:180px;
  padding:10px;
  color:#222;
  z-index: 33010; /* über Header-Inhalt */
}

#sound-settings-dropdown label { display:flex; align-items:center; gap:8px; }

/* Current room text styling */
#current-room-display { color:#fff; font-weight:bold; font-size:14px; }

/* Sample message item (initial content) */
.message-item.sample {
  margin-bottom: 10px;
  padding: 8px;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.message-item.sample strong { color: #2c3e50; }
.message-item.sample span { color: #7f8c8d; }

/* Desktop message input row */
.message-input-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  gap: 4px;
  min-height: 44px;
}

/* Reusable icon size */
.icon-22 { width: 22px; height: 22px; }

/* Header notification bell */
#notification-bell img { width: 22px; height: 22px; }

/* Sidebar settings popup (structure only; visual styles in sidebar_settings_popup.css) */
.sidebar-settings-popup { display: none; }

/* Username shop modal */
body.shop-open { overflow: hidden; }

.shop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 20, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2200;
}

.shop-overlay.is-visible { display: flex; }

.shop-modal {
  background: #ffffff;
  color: #1f2937;
  width: min(960px, 96vw);
  max-height: 96vh;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.shop-header h2 { margin: 0; font-size: 1.6rem; color: #111827; }
.shop-subtitle {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 0.95rem;
}

.shop-close {
  background: #f3f4f6;
  border: none;
  color: #4b5563;
  box-shadow: none;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.shop-close:hover { background: #e5e7eb; color: #1f2937; }

.shop-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.shop-user-stat {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.shop-balance-stat {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
  border-color: #a7f3d0;
}

.shop-color-stat {
  background: linear-gradient(135deg, #fff1f2 0%, #ffffff 100%);
  border-color: #fecdd3;
}

.shop-stat-icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.shop-stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.shop-stat-label {
  font-size: 0.85rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.shop-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
}

.shop-color-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.shop-refresh {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
  position: absolute;
  top: 8px;
  right: 8px;
}

.shop-refresh:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #4b5563;
  transform: rotate(180deg);
}

.shop-status {
  min-height: 24px;
  padding: 0 24px;
  font-size: 0.95rem;
  color: #374151;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.shop-status.is-visible { display: block; }
.shop-status.is-error { color: #ef4444; background: #fef2f2; }

.shop-category-grid {
  border-color: #22c55e;
  box-shadow: none;
  gap: 16px;
  padding: 20px 24px 0;
}

.shop-category-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  color: #111827;
  transition: all 0.2s ease;
}

.shop-category-card:hover,
.shop-category-card:focus-visible {
  border-color: #3b82f6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  background: #ffffff;
  color: #111827;
  transform: translateY(-2px);
}
.shop-category-icon {
  font-size: 2rem;
}

.shop-category-title {
  font-size: 1.2rem;
  font-weight: 700;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: initial;
  color: #111827;
}
.shop-category-text {
  color: #0f0f0f;
  font-size: 0.95rem;
}

.shop-plan-section {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.shop-plan-section.is-visible {
  display: flex;
}

.shop-plan-heading {
  margin: 0;
  font-size: 1.2rem;
  color: #111827;
}

.shop-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.shop-plan-card {
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 20px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.shop-plan-card:hover,
.shop-plan-card:focus-visible {
  border-color: #3b82f6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.shop-plan-card.is-active {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.shop-plan-duration {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
}

.shop-plan-price {
  font-size: 1.05rem;
  color: #374151;
}

.shop-plan-note {
  font-size: 0.9rem;
  color: #6b7280;
}

.shop-plan-hint {
  text-align: center;
  margin: 0;
  font-size: 0.95rem;
  color: #6b7280;
}

.shop-hidden {
  display: none !important;
}

.shop-items {
  flex: 1 1 auto;
  padding: 20px 24px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  overflow-y: auto;
}

.shop-item {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s;
}

.shop-item:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.shop-item.is-active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
  background: #eff6ff;
}

.shop-item.is-owned { border-color: #bfdbfe; background: #f0f9ff; }

.shop-color-preview {
  border-radius: 12px;
  height: 48px;
  border: 1px solid #e5e7eb;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.shop-item-info h3 { margin: 0; font-size: 1.1rem; color: #111827; }

.shop-item-info p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 0.95rem;
}

.shop-item-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.shop-price,
.shop-duration {
  font-size: 0.85rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-weight: 500;
}

.shop-item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shop-action-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  background: #3b82f6;
  color: #ffffff;
  transition: background 0.2s;
}

.shop-action-btn:hover {
  background: #2563eb;
}

.shop-action-btn:disabled {
  background: #e5e7eb;
  cursor: not-allowed;
  color: #9ca3af;
}

.shop-expire { font-size: 0.8rem; color: #6b7280; }

.shop-loading,
.shop-empty,
.shop-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 0;
  color: #6b7280;
}

@media (max-width: 640px) {
  .shop-items { grid-template-columns: 1fr; }
  .shop-modal { max-height: 100vh; }
}
.sidebar-settings-popup .popup-header { display:flex; align-items:center; justify-content:space-between; padding:15px; background:#064af7; color:#fff; border-radius:8px 8px 0 0; }
.sidebar-settings-popup .popup-header h3 { margin:0; color:#fff; }
.sidebar-settings-popup .popup-header .close { background:none; border:none; color:#fff; font-size:24px; cursor:pointer; padding:0; line-height:1; }
.sidebar-settings-popup .popup-body { padding:25px; }
.sidebar-settings-popup .popup-body h4 { margin-top:0; color:#333; font-size:18px; margin-bottom:25px; }
.sidebar-settings-popup .form-group { margin-bottom:25px; }
.sidebar-settings-popup label.block { display:block; margin-bottom:12px; font-weight:600; color:#555; }
.sidebar-settings-popup .grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:10px; }
.sidebar-settings-popup .hint { font-size:11px; color:#666; text-align:center; }
.sidebar-settings-popup label.option-row {
  display:flex; align-items:center; margin-bottom:12px; cursor:pointer; padding:8px; border-radius:6px;
}
.sidebar-settings-popup label.option-row:hover { background:#f8f9fa; }
.sidebar-settings-popup label.option-row input { margin-right:12px; transform:scale(1.1); }
#sidebar-preview {
  margin-bottom:25px; padding:15px; background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius:8px; border-left:4px solid #007bff; font-size:13px; color:#495057;
}
.sidebar-settings-popup .actions {
  display:flex; gap:10px; justify-content:flex-end; border-top:1px solid #dee2e6; padding-top:20px; margin-top:25px;
}
.sidebar-settings-popup .actions .sidebar-settings-action-btn {
  border:none; padding:10px 16px; border-radius:6px; cursor:pointer; font-size:14px; transition: all 0.3s; font-weight:500;
}
#sidebar-settings-apply-btn { background:#28a745; color:#fff; box-shadow:0 2px 8px rgba(40,167,69,0.3); padding:10px 20px; font-weight:600; }
#sidebar-settings-reset-btn { background:#6c757d; color:#fff; }
#sidebar-settings-close-btn { background:#dc3545; color:#fff; }

/* Sidebar header close hidden by default (toggled by JS) */
.sidebar .sidebar-close-btn { display: none; }

/* Online users list hidden container (kept for handlers) */
#online-users-list { display: none; }

/* Sidebar header user section */
#sidebar-user-container { position: relative; }
#sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%; vertical-align: middle;
  margin-right: 8px; object-fit: cover; display: none;
}
#sidebar-username { cursor: pointer; vertical-align: middle; position: relative; font-weight: bold; color: #333; }
#sidebar-stones-badge { display: inline-flex; align-items: center; margin-left: 8px; vertical-align: middle; }
#sidebar-invisible-icon { width: 22px; height: 22px; margin-left: 6px; vertical-align: middle; display: none; }
#sidebar-user-dropdown {
  margin-left: 5px; display: none; position: absolute; z-index: 1001;
  background: #fff; border: 1px solid #ccc; border-radius: 6px; min-width: 120px; box-shadow: 0 2px 8px #aaa;
}

/* Moderation Modal default hidden; layering via popupManager */
.moderation-modal { display: none; }

/* Global marquee hidden by default */
#global-marquee { display: none; }

/* Ensure sidebar is fully hidden on small viewports (<=1024px) regardless of file load order */
@media (max-width: 1024px) {
  .sidebar {
    display: none !important; /* überschreibt inline display:flex */
    position: fixed !important;
    left: -9999px !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  body.mobile-sidebar-open .sidebar { display: none !important; }
}

/* Mobile Menu Popup (main + fallback) */
.mobile-menu-popup {
  display: none;
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border: 2px solid #ccc; border-radius: 10px;
  padding: 20px; z-index: 5000; max-width: 90vw; max-height: 80vh;
  overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  width: 300px;
}
.mobile-menu-popup .close-row { text-align: right; margin-bottom: 15px; }
.mobile-menu-popup .mobile-menu-close {
  background: #e74c3c; color: #fff; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer;
}
.mobile-menu-btn {
  display:flex; align-items:center; gap:10px; margin:8px 0; padding:12px; font-size:1.05em; border-radius:8px;
  border:1.5px solid #bbb; background:#f8f8f8; width:100%; cursor:pointer;
}
.mobile-menu-btn img { width:24px; height:24px; }

/* --- Desktop Safety Overrides: verhindern, dass der Nachrichtenbereich alles überdeckt --- */
@media (min-width: 821px) {
  /* Grid-Areas und Layering erzwingen */
  .chat-header { grid-area: header !important; position: relative !important; z-index: 5 !important; }
  #chat-container { grid-area: content !important; position: relative !important; z-index: 1 !important; }
  .chat-input-footer {
    grid-area: footer !important;
    position: relative !important;
    z-index: 5 !important;
    height: 50px !important;       /* Fixe Höhe laut Anforderung */
    min-height: 50px !important;
    max-height: 50px !important;
    flex: 0 0 50px !important;
    padding: 6px 10px !important;  /* leicht kompakteres Padding */
  }
  .sidebar { grid-area: sidebar !important; position: relative !important; z-index: 5 !important; }

  /* Nachrichtenliste darf keine eigene Ebene aufspannen */
  #chat-container #chat-messages,
  .chat-messages,
  #chat-messages {
    position: static !important;
    z-index: auto !important;
    width: auto !important;
    height: auto !important;
    max-height: 95% !important;
    overflow-y: auto !important;
    /* Nur kleiner Abstand unten, Grid Footer ist fix 50px */
    padding-bottom: 12px !important;
  }
}
