/* =========================================
   GROUPS MODULE — Modern Theme
   ========================================= */
.modern-theme .group {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* --- Cover --- */
.modern-theme .group-cover {
  position: relative;
  height: 240px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  margin-bottom: 0 !important;
}

.modern-theme .group-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modern-theme .group-cover .group-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.6));
}

.modern-theme .group-cover .group-cover-edit {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,.2);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .2s;
}

.modern-theme .group-cover .group-cover-edit:hover {
  background: rgba(255,255,255,.35);
}

/* --- Header row (avatar + info + button) --- */
.modern-theme .group-header {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding: 0 20px;
  margin-top: -50px;
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
  margin-bottom: 0 !important;
}

.modern-theme .group-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid var(--card);
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  background: var(--card);
  overflow: hidden;
  flex-shrink: 0;
}

.modern-theme .group-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modern-theme .group-avatar .group-ava-letter {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 36px;
  font-weight: 700;
}

.modern-theme .group-info {
  flex: 1;
  min-width: 200px;
  padding-top: 14px;
}

.modern-theme .group-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
  line-height: 1.2;
}

.modern-theme .group-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.modern-theme .group-meta span {
  margin-right: 14px;
}

/* --- Action buttons --- */
.modern-theme .group-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 14px;
  flex-shrink: 0;
}

.modern-theme .group-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}

.modern-theme .group-btn-join {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 2px 8px rgba(102,126,234,.25);
}

.modern-theme .group-btn-join:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102,126,234,.35);
}

.modern-theme .group-btn-leave {
  background: var(--card);
  color: #e74c3c;
  border: 1px solid #e74c3c;
}

.modern-theme .group-btn-leave:hover {
  background: #fdf0ef;
}

.modern-theme .group-btn-leave:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.modern-theme .group-btn-admin {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.modern-theme .group-btn-admin:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.modern-theme .group-btn-ban {
  background: var(--card);
  color: #e74c3c;
  border: 1px solid #e74c3c;
  padding: 4px 10px;
  font-size: 11px;
}

.modern-theme .group-btn-ban:hover {
  background: #fdf0ef;
}

.modern-theme .group-btn-unban {
  background: var(--card);
  color: #27ae60;
  border: 1px solid #27ae60;
  padding: 4px 10px;
  font-size: 11px;
}

.modern-theme .group-btn-unban:hover {
  background: #eafaf1;
}

.modern-theme .group-btn-promote {
  background: var(--card);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 11px;
}

.modern-theme .group-btn-promote:hover {
  border-color: var(--primary);
}

/* --- Banned badge --- */
.modern-theme .group-banned-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #fdf0ef;
  color: #e74c3c;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}

/* --- Content card --- */
.modern-theme .group-content {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-top: 16px;
  overflow: hidden;
}

.modern-theme .group-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  overflow-x: auto;
}

.modern-theme .group-tab {
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .2s;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.modern-theme .group-tab:hover {
  color: var(--text);
}

.modern-theme .group-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.modern-theme .group-tab-panel {
  display: none;
  padding: 16px;
}

.modern-theme .group-tab-panel.active {
  display: block;
}

/* --- About section --- */
.modern-theme .group-description {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}

.modern-theme .group-info-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.modern-theme .group-info-row:last-child {
  border-bottom: none;
}

.modern-theme .group-info-label {
  min-width: 120px;
  color: var(--text-muted);
  font-weight: 600;
}

.modern-theme .group-info-value {
  color: var(--text);
}

/* --- Members list --- */
.modern-theme .group-members {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modern-theme .group-member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  transition: background .15s;
}

.modern-theme .group-member:hover {
  background: var(--bg);
}

.modern-theme .group-member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
}

.modern-theme .group-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modern-theme .group-member-ava-letter {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.modern-theme .group-member-info {
  flex: 1;
  min-width: 0;
}

.modern-theme .group-member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.modern-theme .group-member-name:hover {
  color: var(--primary);
}

.modern-theme .group-member-role {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-left: 6px;
}

.modern-theme .group-member-role--owner {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #fff;
}

.modern-theme .group-member-role--admin {
  background: rgba(102,126,234,.12);
  color: var(--primary);
}

.modern-theme .group-member-role--member {
  background: var(--bg);
  color: var(--text-muted);
}

.modern-theme .group-member-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.modern-theme .group-member-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* --- Admin panel --- */
.modern-theme .group-admin-panel {
  background: #fef9e7;
  border: 1px solid #f9e28b;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
}

.modern-theme .group-admin-title {
  font-size: 12px;
  font-weight: 700;
  color: #7d6608;
  margin-bottom: 10px;
}

.modern-theme .group-admin-input {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.modern-theme .group-admin-input input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color .2s;
}

.modern-theme .group-admin-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

/* --- Create group form --- */
.modern-theme .group-create {
  max-width: 520px;
  margin: 0 auto;
}

.modern-theme .group-create h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--text);
}

.modern-theme .group-create .group-field {
  margin-bottom: 16px;
}

.modern-theme .group-create .group-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.modern-theme .group-create .group-field input,
.modern-theme .group-create .group-field textarea,
.modern-theme .group-create .group-field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  font-family: inherit;
  background: #f8f9fc;
  color: var(--text);
  outline: none;
  transition: all .25s;
}

.modern-theme .group-create .group-field input:focus,
.modern-theme .group-create .group-field textarea:focus,
.modern-theme .group-create .group-field select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

.modern-theme .group-create .group-field textarea {
  min-height: 100px;
  resize: vertical;
}

.modern-theme .group-create .group-field input[type="file"] {
  padding: 6px;
  background: var(--card);
}

/* --- Group list --- */
.modern-theme .group-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modern-theme .group-list-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  transition: box-shadow .2s, transform .2s;
  text-decoration: none;
}

.modern-theme .group-list-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.modern-theme .group-list-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.modern-theme .group-list-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modern-theme .group-list-ava-letter {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.modern-theme .group-list-info {
  flex: 1;
  min-width: 0;
}

.modern-theme .group-list-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.modern-theme .group-list-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modern-theme .group-list-stats {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* --- Create button --- */
.modern-theme .group-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  box-shadow: 0 2px 8px rgba(102,126,234,.25);
  margin-bottom: 16px;
}

.modern-theme .group-create-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102,126,234,.35);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .modern-theme .group-cover { height: 160px; }
  .modern-theme .group-header { margin-top: -36px; gap: 12px; padding: 0 14px; }
  .modern-theme .group-avatar { width: 72px; height: 72px; border-width: 3px; }
  .modern-theme .group-avatar .group-ava-letter { font-size: 26px; }
  .modern-theme .group-name { font-size: 18px; }
  .modern-theme .group-actions { width: 100%; padding-top: 4px; }
  .modern-theme .group-btn { flex: 1; justify-content: center; }
  .modern-theme .group-tabs { padding: 0 8px; }
  .modern-theme .group-tab { padding: 10px 14px; font-size: 11px; }
}

/* =========================================
   GROUPS MODULE — Old Theme Fallback
   ========================================= */
.group-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  border: 1px solid #b3b3b3;
  border-radius: 2px;
  font-size: 11px;
  font-family: tahoma, arial, verdana, sans-serif;
  cursor: pointer;
  background: #e0e0e0;
  color: #444;
  text-decoration: none;
}

.group-btn-join {
  background: #6485aa;
  border-color: #416796;
  color: #fff;
}

.group-btn-leave {
  background: #e0e0e0;
  border-color: #b3b3b3;
  color: #c33;
}

.group-member-role {
  font-size: 10px;
  color: #888;
  margin-left: 4px;
}

.group-member-role--owner { color: #f39c12; font-weight: bold; }
.group-member-role--admin { color: #2b587a; font-weight: bold; }
.group-member-role--member { color: #999; }
