:root {
  --primary-color: #4CAF50;
  --secondary-color: #388E3C;
  --tertiary-color: #256D1B;
  --background-color: #FFFBF7;
  --card-hover-color: #ffffff;
  --text-color: #1C1917;
  --gradient-start: #4CAF50;
  --gradient-end: #388E3C;
  --message-background: #FFFFFF;
  --success-green: #4CAF50;
  --gradient-primary: #4CAF50;
  --accent: #4CAF50;
  --surface-alt: #E7F7EE;
  --text-muted: #78716C;
  --glass-border: rgba(18,140,126,0.12);
}

body {
  background-color: var(--background-color) !important;
  color: var(--text-color) !important;
  font-family: "Helvetica Neue", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}

/* ═══════════════════════════════════════════════
   LOGIN SCREEN — Split Layout with Glassmorphism
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

.login-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}

/* ── Illustration Panel (Left) ── */
.login-illustration-panel {
  flex: 1;
  background: #4CAF50;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 3rem;
}

.login-illustration-panel::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(37,211,102,0.2) 0%, transparent 60%),
              radial-gradient(circle at 70% 30%, rgba(255,255,255,0.08) 0%, transparent 50%);
  animation: loginBgShift 15s ease-in-out infinite;
}

@keyframes loginBgShift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

.login-illustration-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2rem;
  max-width: 400px;
}

.login-brand {
  color: white;
}

.login-brand-logo {
  display: block;
  max-width: 280px;
  width: 100%;
  height: auto;
  margin: 0 auto 1.4rem;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.22)) brightness(1.08);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.login-brand-logo:hover {
  transform: scale(1.04);
}

.login-brand p {
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
}

.login-illustration-img {
  width: 100%;
  max-width: 320px;
  height: auto;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,0.15));
  animation: loginFloat 6s ease-in-out infinite;
}

@keyframes loginFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.login-stats {
  display: flex;
  gap: 1.5rem;
}

.login-stat-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.9);
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(255,255,255,0.12);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.login-stat-item:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

.login-stat-item:hover .chat-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.login-stat-item i {
  font-size: 0.9rem;
}

/* ── Chat Bubble Tooltip ── */
.chat-bubble {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: 260px;
  background: #FFFFFF;
  border-radius: 12px 12px 12px 4px;
  padding: 10px 12px 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15), 0 1px 4px rgba(0,0,0,0.08);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 100;
  pointer-events: none;
}

.chat-bubble-tail {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: #FFFFFF;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0,0,0,0.05);
  border-radius: 0 0 2px 0;
}

.chat-bubble-content {
  position: relative;
  z-index: 1;
  min-height: 1.4em;
}

.chat-bubble-text {
  color: #1C1917;
  font-size: 0.8rem;
  line-height: 1.45;
  font-weight: 400;
  letter-spacing: 0;
}

.chat-bubble-cursor {
  color: #4CAF50;
  font-weight: 300;
  animation: blink-cursor 0.6s step-end infinite;
  font-size: 0.85rem;
}

.chat-bubble-cursor.hidden {
  display: none;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-bubble-meta.visible {
  opacity: 1;
}

.chat-bubble-time {
  color: #A8A29E;
  font-size: 0.65rem;
  font-weight: 400;
}

.chat-bubble-check {
  color: #34B7F1;
  font-size: 0.6rem !important;
  margin: 0 !important;
}

/* ── Form Panel (Right) ── */
.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: #FFFBF7;
  position: relative;
  overflow: hidden;
}

.login-form-panel::before {
  content: '';
  position: absolute;
  top: 10%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(18,140,126,0.06) 0%, transparent 70%);
  border-radius: 50%;
}

.login-form-panel::after {
  content: '';
  position: absolute;
  bottom: 5%;
  left: -5%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(37,211,102,0.05) 0%, transparent 70%);
  border-radius: 50%;
}

.login-form-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 2;
}

.login-form-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

/* Avatar circle removed — replaced by toggle selector */

/* ── Login Toggle Group ── */
.login-toggle-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.login-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.2px;
  background: transparent;
  color: var(--primary-color);
  border: 2px solid rgba(18,140,126,0.2);
}

.login-toggle-btn:hover {
  background: rgba(18,140,126,0.06);
  border-color: var(--primary-color);
}

.login-toggle-btn.active {
  background: #4CAF50;
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(18,140,126,0.3);
}

.login-toggle-btn.active:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(18,140,126,0.35);
}

.login-btn-full {
  width: 100%;
}

.login-form-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1C1917;
  margin-bottom: 0.4rem;
  letter-spacing: -0.3px;
}

.login-form-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Form Fields ── */
.login-form {
  margin-bottom: 0 !important;
}

.login-field {
  margin-bottom: 1.5rem !important;
}

.login-field label {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  color: #44403C !important;
  margin-bottom: 0.6rem !important;
  letter-spacing: 0.2px;
}

.login-field label i {
  color: var(--primary-color);
  font-size: 0.85rem;
}

.login-input-wrapper {
  width: 100%;
}

.login-input-wrapper input {
  background: white !important;
  border: 2px solid rgba(18,140,126,0.12) !important;
  border-radius: 14px !important;
  padding: 0.9rem 1rem 0.9rem 2.8rem !important;
  font-size: 0.95rem !important;
  transition: all 0.3s ease !important;
  font-family: 'Inter', sans-serif !important;
  color: #1C1917 !important;
}

.login-input-wrapper input::placeholder {
  color: #A8A29E !important;
  font-weight: 400;
}

.login-input-wrapper input:focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 4px rgba(18,140,126,0.08) !important;
  outline: none;
}

.login-input-wrapper i.icon {
  color: var(--primary-color) !important;
  opacity: 0.6;
}

.login-input-wrapper input:focus + i.icon,
.login-input-wrapper input:focus ~ i.icon {
  opacity: 1;
}

.login-field-hint {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Login Buttons ── */
.login-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

.login-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  border: none;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
}

.login-btn-primary {
  background: #4CAF50;
  color: white;
  box-shadow: 0 4px 16px rgba(18,140,126,0.3);
}

.login-btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(18,140,126,0.4);
  filter: brightness(1.05);
}

.login-btn-primary:active {
  transform: translateY(-1px);
}

.login-btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid rgba(18,140,126,0.2);
}

.login-btn-outline:hover {
  background: rgba(18,140,126,0.06);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

/* ── Info Card ── */
.login-info-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: rgba(18,140,126,0.04);
  border-radius: 14px;
  border: 1px solid rgba(18,140,126,0.08);
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

.login-info-card:hover {
  background: rgba(18,140,126,0.07);
  border-color: rgba(18,140,126,0.15);
}

.login-info-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
}

.login-info-text strong {
  display: block;
  color: #1C1917;
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.login-info-text p {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
}

.login-footer-text {
  text-align: center;
  color: #A8A29E;
  font-size: 0.78rem;
}

/* ── Login Responsive ── */
@media (max-width: 992px) {
  .login-wrapper {
    flex-direction: column;
  }
  .login-illustration-panel {
    min-height: 280px;
    padding: 2rem;
  }
  .login-illustration-img {
    max-width: 220px;
  }
  .login-brand-logo {
    max-width: 220px;
  }
  .login-brand p {
    font-size: 0.88rem;
  }
  .login-stats {
    gap: 0.75rem;
  }
  .login-stat-item {
    font-size: 0.78rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (max-width: 600px) {
  .login-illustration-panel {
    min-height: 200px;
    padding: 1.5rem;
  }
  .login-illustration-img {
    max-width: 160px;
  }
  .login-form-panel {
    padding: 2rem 1.5rem;
  }
  .login-buttons {
    flex-direction: column;
  }
  .login-toggle-group {
    flex-direction: column;
  }
  .login-toggle-btn {
    font-size: 0.82rem;
    padding: 0.65rem 0.75rem;
  }
  .login-brand-logo {
    max-width: 180px;
  }
  .login-stats {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ── Legacy compat (keep for existing JS references) ── */
.whatsapp.icon.bi-whatsapp {
  font-size: 6rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.menu-header {
  background: var(--primary-color) !important;
  color: white !important;
  margin-bottom: 2em !important;
  box-shadow: 
      0 20px 40px rgba(18, 140, 126, 0.2),
      inset 0 0 80px rgba(255, 255, 255, 0.15) !important;
  position: relative;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease-in-out;
}

.login {
  border-radius: 15px !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
  padding: 2em !important;
}

/* Loading state for login form */
.login-wrapper .ui.form.loading::before {
  background: rgba(255,251,247,0.85);
  border-radius: 14px;
}

.login-wrapper .ui.form.loading::after {
  border-color: var(--primary-color) transparent transparent;
}

.container {
  max-width: 1400px !important;
  margin: 0 auto !important;
}

.main-header {
  background: var(--primary-color) !important;
  color: white !important;
  padding: 1.5em 2em !important;
  border-radius: 24px !important;
  margin-bottom: 2em !important;
  box-shadow: 
      0 20px 40px rgba(18, 140, 126, 0.2),
      inset 0 0 80px rgba(255, 255, 255, 0.15) !important;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease-in-out;
}

.hidden {
  display:none !important;
}

.ui.stackable.cards > .card.hidden {
  display: none !important;
}

.menu-header .item::before {
  display: none !important;
}

.menu-header .title-container {
  font-size: clamp(1.5em, 3vw, 1.8em) !important;
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
}
.main-header .title-container {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
}

a#menulogout, a:visited#menulogout {
  color: white;
}

.main-header .whatsapp.icon {
  font-size: 1em !important;
}

.main-header .whatsapp.icon:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.2);
}

@media (min-width: 768px) {
  .main-header {
      padding: 2em !important;
  }

  .main-header .ui.header {
      flex-direction: column;
  }

  .main-header .version-label {
      margin-top: 4px !important;
  }
}

.ui.header {
  font-weight: 600 !important;
  color: var(--text-color) !important;
}

.ui.cards > .card {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05) !important;
  border-radius: 16px !important;
  margin: 0.7em !important;
  background-color: var(--message-background) !important;
  border: 1px solid rgba(18, 140, 126, 0.1);
}

.ui.cards > .card:not(.no-hover):hover {
  transform: translateY(-8px) !important;
  box-shadow: 0 12px 24px rgba(18, 140, 126, 0.15) !important;
  background-color: var(--card-hover-color) !important;
}

.ui.horizontal.divider {
  font-size: 1.3em !important;
  color: var(--secondary-color) !important;
  margin: 2.5em 0 !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ui.success.message {
  border-radius: 16px !important;
  box-shadow: 0 4px 8px rgba(18, 140, 126, 0.1) !important;
  border: 1px solid rgba(18, 140, 126, 0.2) !important;
  background-color: rgba(231, 247, 232, 0.8) !important;
  color: var(--success-green) !important;
  animation: slideIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(10px);
}

@keyframes slideIn {
  from { transform: translateX(-30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.ui.button {
  border-radius: 12px !important;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  color: white !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px;
}

.ui.primary.button,
.ui.primary.buttons .button {
  background: linear-gradient(135deg, #388E3C, #4CAF50) !important;
  color: white !important;
}

.ui.primary.button:hover,
.ui.primary.buttons .button:hover {
  background: linear-gradient(135deg, #4CAF50, #388E3C) !important;
}

.ui.teal.button,
.ui.teal.buttons .button {
  background: linear-gradient(135deg, #388E3C, #4CAF50) !important;
  color: white !important;
}

.ui.green.card,
.ui.green.cards > .card {
  box-shadow: 0 0 0 1px #4CAF50, 0 4px 8px rgba(18,140,126,0.08) !important;
}

.ui.teal.label,
.ui.teal.labels .label,
.ui.green.label,
.ui.green.labels .label {
  background-color: #4CAF50 !important;
  color: white !important;
}

.ui.teal.right.ribbon.label {
  background-color: #4CAF50 !important;
  border-color: #256D1B !important;
}

.ui.button:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 16px rgba(18, 140, 126, 0.2) !important;
  filter: brightness(0.95);
}

.ui.form input, .ui.form textarea {
  border-radius: 12px !important;
  border: 2px solid rgba(18, 140, 126, 0.1) !important;
  transition: all 0.3s ease;
}

.ui.form input:focus, .ui.form textarea:focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.1) !important;
}

.ui.grid {
  margin: -0.7em !important;
}

.ui.grid > .column {
  padding: 0.7em !important;
}

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

.ui.modal {
  border-radius: 20px !important;
  background-color: var(--message-background) !important;
  overflow: hidden;
}

.ui.modal > .header {
  border-radius: 20px 20px 0 0 !important;
  background: var(--gradient-start) !important;
  color: white !important;
  padding: 1.5em !important;
}

.ui.modal > .actions {
  border-radius: 0 0 20px 20px !important;
  background-color: rgba(248, 248, 248, 0.8) !important;
  backdrop-filter: blur(10px);
}

.ui.modal > .actions > .ui.button {
  font-weight: 600 !important;
  letter-spacing: 0.5px;
}

.mb-4 {
  margin-bottom: 1.5em !important;
}

#user-role-indicator.admin {
  color: #db2828; 
  font-weight: bold;
}
  
#user-role-indicator.admin div.label {
  background-color:#d31616; 
}

#user-role-indicator.admin i.icon {
  color:#d31616;
}
  
#user-role-indicator.user {
  color: #a3f298;
}
  
#user-role-indicator.user i.icon {
  color: #a3f298;
}
  
#user-role-indicator.user div.label {
  background-color: #a3f298;
  color: #000;
}

.ui.secondary.pointing.menu {
  margin-bottom: 0;
  border-bottom: none;
}

.p1 {
  padding-right:1em;
  padding-left:1em;
}

.adminlogin {
  display:none;
}

.required {
  color: #db2828;
}

/* Groups Specific Styles */
.group-card {
  transition: all 0.3s ease !important;
  max-height: 180px !important;
}

.group-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(18, 140, 126, 0.15) !important;
}

.group-card .content {
  padding: 1em !important;
}

.group-card .header {
  font-size: 1.1em !important;
  margin-bottom: 0.3em !important;
  font-weight: 600 !important;
}

.group-photo {
  width: 45px !important;
  height: 45px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

.group-photo-placeholder {
  width: 45px !important;
  height: 45px !important;
  border-radius: 50% !important;
  background: var(--primary-color) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: white !important;
  font-size: 1.2em !important;
}

.participant-item {
  padding: 0.75rem 0 !important;
}

.participant-item .content .header {
  font-size: 1rem !important;
}

.participant-item .right.floated.content {
  float: none !important;
  margin-top: 0.5rem !important;
}

.admin-badge {
  background: #4CAF50 !important;
  color: white !important;
  font-size: 0.7em !important;
  padding: 0.2em 0.4em !important;
  border-radius: 3px !important;
  margin-left: 0.5em !important;
}

.super-admin-badge {
  background: #db2828 !important;
  color: white !important;
  font-size: 0.7em !important;
  padding: 0.2em 0.4em !important;
  border-radius: 3px !important;
  margin-left: 0.5em !important;
}

.group-stats {
  display: flex !important;
  gap: 0.8em !important;
  margin-top: 0.4em !important;
  flex-wrap: wrap !important;
}

.group-stat {
  display: flex !important;
  align-items: center !important;
  gap: 0.2em !important;
  font-size: 0.8em !important;
  color: #666 !important;
}

.groups-search-container {
  margin-bottom: 1em !important;
}

.group-actions {
  display: flex !important;
  gap: 0.3em !important;
  margin-top: 0.8em !important;
}

.group-action-btn {
  flex: 1 !important;
  font-size: 0.7em !important;
  padding: 0.4em 0.6em !important;
}

.group-card .description {
  font-size: 0.85em !important;
  color: #666 !important;
  margin-bottom: 0.4em !important;
  line-height: 1.3 !important;
}

.read-more-link {
  color: var(--primary-color) !important;
  text-decoration: none !important;
  font-weight: 500 !important;
}

.read-more-link:hover {
  text-decoration: underline !important;
}

.group-preview-photo {
  width: 80px !important;
  height: 80px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  margin-right: 1em !important;
}

.disappearing-timer-indicator {
  color: var(--primary-color) !important;
  font-weight: bold !important;
}

.invite-link-container {
  background: #f8f9fa !important;
  padding: 1em !important;
  border-radius: 8px !important;
  border: 1px solid #e9ecef !important;
}

.participant-actions {
  display: flex !important;
  gap: 0.3em !important;
}

.participant-action-btn {
  padding: 0.3em 0.6em !important;
  font-size: 0.7em !important;
}

@media (max-width: 768px) {
  .group-actions {
    flex-direction: column !important;
  }
  
  .group-action-btn {
    width: 100% !important;
  }
  
  .group-stats {
    flex-direction: column !important;
    gap: 0.5em !important;
  }
}

/* Groups Manager Styles */
#groupsMainContainer .main-header {
    margin-bottom: 2em !important;
}

#groupsMainContainer .main-header .ui.header {
    color: white !important;
}

#groupsMainContainer .main-header .sub.header {
    color: rgba(255, 255, 255, 0.8) !important;
}

.group-list-item {
    padding: 1rem 0;
    transition: background-color 0.3s ease;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.group-list-item:hover {
    background-color: #f8f9fa;
}

.group-list-item .header {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.group-list-item .meta {
    color: #666;
    font-size: 0.9em;
}

.group-list-item .meta span {
    margin-right: 1rem;
}

.group-list-item .description {
    margin: 0.5rem 0;
    color: #555;
    line-height: 1.4;
}

.read-more-link {
    color: #0084ff;
    cursor: pointer;
    font-weight: 500;
}

.read-more-link:hover {
    text-decoration: underline;
}

/* Group type and role badges */
.group-list-item .ui.mini.label {
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Group action buttons */
.group-list-item .ui.small.buttons .button {
    border: none !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    margin-right: 0.5rem !important;
}

.group-list-item .ui.small.buttons .button.primary {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.group-list-item .ui.small.buttons .button.primary:hover {
    background-color: var(--secondary-color) !important;
    transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(18, 140, 126, 0.3) !important;
    background-color: #6c757d !important;
    color: white !important;
}

.group-list-item .ui.small.buttons .button.secondary:hover {
    background-color: #5a6268 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3) !important;
}

.group-list-item .ui.small.buttons .button.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Remove the old basic button styles for groups */
.group-list-item .ui.small.basic.buttons .button {
    border: none !important;
}

.group-list-item .ui.small.basic.buttons .button:hover {
    border: none !important;
}

/* Participant item styles */
.participant-item {
    padding: 0.75rem 0 !important;
}

.participant-item .content .header {
    font-size: 1rem !important;
}

.participant-item .right.floated.content {
    float: none !important;
    margin-top: 0.5rem !important;
}

/* Groups loading state */
#groupsLoading {
    min-height: 200px;
}

/* Groups filter section */
#groupsMainContainer .ui.segment {
    border: 1px solid #e1e8ed;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    margin-bottom: 1rem;
}

/* No groups message */
#noGroupsMessage {
    margin-top: 2rem;
    text-align: center;
}

/* Responsive design for groups */
@media (max-width: 768px) {
    .group-list-item .ui.grid .column {
        padding: 0.5rem;
    }
    
    .group-list-item .four.wide.column {
        width: 100% !important;
        text-align: left !important;
        margin-top: 1rem;
    }
    
    .group-list-item .eleven.wide.column {
        width: 100% !important;
    }
    
    .group-list-item .one.wide.column {
        width: auto !important;
        margin-right: 1rem;
    }
}

/* Group type specific styling */
.group-list-item .ui.mini.label.purple {
    background-color: #8e44ad !important;
    color: white !important;
}

.group-list-item .ui.mini.label.blue {
    background-color: #3498db !important;
    color: white !important;
}

.group-list-item .ui.mini.label.green {
    background-color: var(--success-green) !important;
    color: white !important;
}

/* Group icons with specific colors */
.group-list-item .building.icon.purple {
    color: #8e44ad !important;
}

.group-list-item .users.icon.blue {
    color: #3498db !important;
}

.group-list-item .users.icon.green {
    color: var(--success-green) !important;
}

/* Feature badges styling */
.group-list-item .ui.mini.grey.label {
    background-color: #95a5a6 !important;
    color: white !important;
    margin: 0.2rem 0.3rem 0.2rem 0 !important;
}

/* Role badges styling */
.group-list-item .ui.mini.red.label,
.group-list-item .ui.mini.orange.label {
    font-weight: bold !important;
    margin-left: 0.5rem !important;
}

/* Parent community info styling */
.group-list-item .meta .sitemap.icon {
    color: #8e44ad !important;
}

/* Improved meta information spacing */
.group-list-item .meta {
    margin-top: 0.5rem !important;
    line-height: 1.6 !important;
}

.group-list-item .meta span {
    margin-right: 1rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
}

/* Refresh button styling */
#refreshGroups.ui.button {
    background-color: var(--secondary-color) !important;
    color: white !important;
    border: none !important;
    font-weight: 600 !important;
}

#refreshGroups.ui.button:hover {
    background-color: var(--tertiary-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(7, 94, 84, 0.3) !important;
}

/* Modal responsiveness improvements */
.ui.modal#modalGroupDetails {
    max-width: 90vw !important;
    width: auto !important;
}

.ui.modal#modalGroupDetails .content {
    max-height: 70vh !important;
    overflow-y: auto !important;
}

.ui.modal#modalGroupDetails .actions .ui.stackable.buttons {
    flex-wrap: wrap !important;
}

.ui.modal#modalGroupDetails .actions .ui.stackable.buttons .button {
    flex: 1 1 auto !important;
    min-width: 120px !important;
    margin: 0.25rem !important;
}

/* Mobile responsiveness for group details */
@media (max-width: 768px) {
    .ui.modal#modalGroupDetails {
        margin: 1rem !important;
        max-width: calc(100vw - 2rem) !important;
    }
    
    .ui.modal#modalGroupDetails .actions .ui.stackable.buttons {
        flex-direction: column !important;
    }
    
    .ui.modal#modalGroupDetails .actions .ui.stackable.buttons .button {
        width: 100% !important;
        margin: 0.25rem 0 !important;
    }
    
    .participant-item {
        padding: 0.75rem 0 !important;
    }
    
    .participant-item .content .header {
        font-size: 1rem !important;
    }
    
    .participant-item .right.floated.content {
        float: none !important;
        margin-top: 0.5rem !important;
    }
}

/* Groups filter section button styling */
.ui.segment .ui.basic.buttons .ui.button {
    background-color: var(--secondary-color) !important;
    color: white !important;
    border: none !important;
    font-weight: 600 !important;
}

.ui.segment .ui.basic.buttons .ui.button:hover {
    background-color: var(--tertiary-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(7, 94, 84, 0.3) !important;
}

/* Group Management Modal Styles */
.ui.modal#modalEditGroupInfo,
.ui.modal#modalGroupSettings,
.ui.modal#modalGroupInviteLink,
.ui.modal#modalManageParticipants {
    max-width: 90vw !important;
    width: auto !important;
}

.ui.modal#modalManageParticipants {
    max-width: 95vw !important;
}

.ui.modal#modalEditGroupInfo .content,
.ui.modal#modalGroupSettings .content,
.ui.modal#modalGroupInviteLink .content,
.ui.modal#modalManageParticipants .content {
    max-height: 70vh !important;
    overflow-y: auto !important;
}

/* Group Details Modal Actions Grid */
.ui.modal#modalGroupDetails .actions .ui.stackable.grid {
    margin: 0 !important;
}

.ui.modal#modalGroupDetails .actions .ui.stackable.grid .column {
    padding: 0.5rem !important;
}

.ui.modal#modalGroupDetails .actions h5.ui.header {
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
    color: var(--secondary-color) !important;
}

/* Group Settings Sections */
.ui.modal#modalGroupSettings .ui.dividing.header {
    color: var(--secondary-color) !important;
  border-bottom-color: rgba(18, 140, 126, 0.2) !important;
}
.ui.modal#modalGroupSettings .ui.toggle.checkbox {
    margin-bottom: 0.5rem !important;
}

/* Group Photo Container */
#currentGroupPhotoContainer {
    min-height: 80px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#currentGroupPhotoContainer img {
    max-width: 80px !important;
    max-height: 80px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}

/* Invite Link Input */
.ui.modal#modalGroupInviteLink .ui.action.input {
    margin-bottom: 1rem !important;
}

/* Participants Management */
.ui.modal#modalManageParticipants .ui.header {
    color: var(--secondary-color) !important;
}

.ui.modal#modalManageParticipants .ui.info.message {
    border-radius: 8px !important;
  border-color: rgba(18, 140, 126, 0.3) !important;
  background-color: rgba(18, 140, 126, 0.05) !important;
}
/* Participant Item in Management */
.ui.modal#modalManageParticipants .participant-item {
    padding: 0.75rem 0 !important;
    border-bottom: 1px solid #f0f0f0 !important;
}

.ui.modal#modalManageParticipants .participant-item:last-child {
    border-bottom: none !important;
}

.ui.modal#modalManageParticipants .participant-item .ui.mini.button {
    font-size: 0.7rem !important;
    padding: 0.4rem 0.6rem !important;
}

.ui.modal#modalManageParticipants .participant-item .ui.mini.buttons {
    margin-bottom: 0.5rem !important;
}

.ui.modal#modalManageParticipants .participant-item .ui.mini.buttons .button {
    margin: 0.1rem !important;
}

/* Participant action buttons styling */
.ui.modal#modalManageParticipants .participant-item .ui.mini.red.button {
    background-color: #db2828 !important;
    color: white !important;
}

.ui.modal#modalManageParticipants .participant-item .ui.mini.red.button:hover {
    background-color: #c82121 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(219, 40, 40, 0.3) !important;
}

.ui.modal#modalManageParticipants .participant-item .ui.mini.orange.button {
  background-color: #4CAF50 !important;
}

.ui.modal#modalManageParticipants .participant-item .ui.mini.orange.button:hover {
  background-color: #388E3C !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 8px rgba(18, 140, 126, 0.3) !important;
}

.ui.modal#modalManageParticipants .participant-item .ui.mini.grey.button {
    background-color: #767676 !important;
    color: white !important;
}

.ui.modal#modalManageParticipants .participant-item .ui.mini.grey.button:hover {
    background-color: #666666 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(118, 118, 118, 0.3) !important;
}

/* Participant item content layout */
.ui.modal#modalManageParticipants .participant-item .content {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    width: 100% !important;
}

.ui.modal#modalManageParticipants .participant-item .participant-info {
    flex: 1 !important;
}

.ui.modal#modalManageParticipants .participant-item .participant-actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 0.5rem !important;
    margin-left: 1rem !important;
}

.ui.modal#modalManageParticipants .participant-item .participant-labels {
    display: flex !important;
    gap: 0.3rem !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
}

.ui.modal#modalManageParticipants .participant-item .participant-buttons .right.floated.content {
    float: none !important;
    margin: 0 !important;
}

/* Proxy Configuration Styles */
#proxyUrlField {
  display: none;
}

#proxyUrlField.show {
  display: block;
}

/* S3 Configuration Styles */
#deleteS3Config {
  display: none;
}

/* Mobile Responsiveness for Group Management */
@media (max-width: 768px) {
    .ui.modal#modalGroupDetails .actions .ui.stackable.grid .column {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .ui.modal#modalGroupDetails .actions .ui.fluid.buttons {
        flex-direction: column !important;
    }
    
    .ui.modal#modalGroupDetails .actions .ui.fluid.buttons .button {
        margin: 0.25rem 0 !important;
        width: 100% !important;
    }
    
    .ui.modal#modalManageParticipants .ui.stackable.grid .column {
        width: 100% !important;
        margin-bottom: 2rem !important;
    }
    
    .ui.modal#modalGroupSettings .ui.segment .ui.stackable.grid .column {
        width: 100% !important;
        text-align: center !important;
    }
    
    .ui.modal#modalGroupSettings .ui.buttons {
        flex-direction: column !important;
    }
    
    .ui.modal#modalGroupSettings .ui.buttons .button {
        margin: 0.25rem 0 !important;
        width: 100% !important;
    }
    
    /* Mobile layout for participant items */
    .ui.modal#modalManageParticipants .participant-item .content {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .ui.modal#modalManageParticipants .participant-item .participant-actions {
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
        align-items: flex-start !important;
        width: 100% !important;
    }
    
    .ui.modal#modalManageParticipants .participant-item .participant-labels {
        justify-content: flex-start !important;
        margin-bottom: 0.5rem !important;
    }
    
    .ui.modal#modalManageParticipants .participant-item .ui.mini.buttons {
        width: 100% !important;
    }
    
    .ui.modal#modalManageParticipants .participant-item .ui.mini.buttons .button {
        flex: 1 !important;
        margin: 0.1rem !important;
    }
}

/* Button Styling for Group Actions */
.ui.modal .actions .ui.button {
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.ui.modal .actions .ui.blue.button {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.ui.modal .actions .ui.blue.button:hover {
    background-color: var(--secondary-color) !important;
    transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(18, 140, 126, 0.3) !important;
    background-color: var(--success-green) !important;
    color: white !important;
}

.ui.modal .actions .ui.green.button:hover {
    background-color: var(--secondary-color) !important;
    transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(18, 140, 126, 0.3) !important;
  background-color: #4CAF50 !important;
}

.ui.modal .actions .ui.orange.button:hover {
  background-color: #388E3C !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(18, 140, 126, 0.3) !important;
}

.ui.modal .actions .ui.purple.button {
    background-color: #8e44ad !important;
    color: white !important;
}

.ui.modal .actions .ui.purple.button:hover {
    background-color: #7d3c98 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.3) !important;
}

/* Loading States */
.ui.modal .ui.button.loading {
    pointer-events: none !important;
    opacity: 0.7 !important;
}

/* Form Validation */
.ui.modal .ui.form .field.error input,
.ui.modal .ui.form .field.error textarea {
    border-color: #db2828 !important;
    box-shadow: 0 0 0 3px rgba(219, 40, 40, 0.1) !important;
}

/* Success/Error Messages in Modals */
.ui.modal .ui.success.message {
    border-radius: 8px !important;
  border-color: rgba(18, 140, 126, 0.3) !important;
  background-color: rgba(18, 140, 126, 0.05) !important;
}

.ui.modal .ui.error.message {
    border-radius: 8px !important;
    border-color: rgba(219, 40, 40, 0.3) !important;
    background-color: rgba(219, 40, 40, 0.05) !important;
    color: #db2828 !important;
}
/* ═══════════════════════════════════════════════
   CLICKABLE ROWS - Secondary Admins Table
   ═══════════════════════════════════════════════ */

tr.clickable-row {
    transition: background-color 0.2s ease !important;
}

tr.clickable-row td[style*="cursor: pointer"] {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

tr.clickable-row td[style*="cursor: pointer"]:hover {
  background-color: rgba(18, 140, 126, 0.08) !important;
}

/* ═══════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════ */

/* Smooth transitions */
body,
.ui.menu,
.ui.table,
.ui.modal,
.ui.segment,
.ui.message,
.ui.card,
.ui.form input,
.ui.form textarea,
.ui.form select,
.ui.dropdown,
.ui.dropdown .menu {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ── Base ── */
body.dark-mode {
  background-color: #1b1c1d !important;
  color: #e0e0e0 !important;
}

/* ── Top Menu / Header ── */
body.dark-mode .ui.menu,
body.dark-mode .menu-header {
  background-color: #1b1c1d !important;
  color: #e0e0e0 !important;
}

body.dark-mode .ui.fixed.menu {
  background-color: #1b1c1d !important;
  border-bottom: 1px solid #444 !important;
}

body.dark-mode .ui.menu .item {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.menu .item:hover {
  background-color: rgba(255,255,255,0.08) !important;
}

body.dark-mode .ui.menu .active.item {
  background-color: rgba(255,255,255,0.12) !important;
}

/* ── Tables ── */
body.dark-mode .ui.table {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

body.dark-mode .ui.table thead th {
  background: #363636 !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

body.dark-mode .ui.table tbody tr {
  background: #2d2d2d !important;
}

body.dark-mode .ui.table tbody tr:hover {
  background: #363636 !important;
}

body.dark-mode .ui.celled.table td,
body.dark-mode .ui.celled.table th {
  border-color: #444 !important;
}

body.dark-mode .ui.table td {
  border-color: #444 !important;
  color: #e0e0e0 !important;
}

body.dark-mode tr.clickable-row td[style*="cursor: pointer"]:hover {
  background-color: rgba(18, 140, 126, 0.15) !important;
}

/* ── Modals ── */
body.dark-mode .ui.modal {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-mode .ui.modal > .header {
  background: #363636 !important;
  color: #e0e0e0 !important;
  border-bottom: 1px solid #444 !important;
}

body.dark-mode .ui.modal > .content {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-mode .ui.modal > .actions {
  background: #363636 !important;
  border-top: 1px solid #444 !important;
}

/* ── Forms ── */
body.dark-mode .ui.form .field > label {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.form input[type="text"],
body.dark-mode .ui.form input[type="number"],
body.dark-mode .ui.form input[type="password"],
body.dark-mode .ui.form input[type="url"],
body.dark-mode .ui.form textarea,
body.dark-mode .ui.form select,
body.dark-mode .ui.input input {
  background: #3a3a3a !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

body.dark-mode .ui.form input::placeholder,
body.dark-mode .ui.input input::placeholder {
  color: #888 !important;
}

/* ── Dropdowns ── */
body.dark-mode .ui.dropdown {
  background: #3a3a3a !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

body.dark-mode .ui.dropdown .menu {
  background: #3a3a3a !important;
  border-color: #555 !important;
}

body.dark-mode .ui.dropdown .menu > .item {
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

body.dark-mode .ui.dropdown .menu > .item:hover {
  background: #4a4a4a !important;
  color: #fff !important;
}

body.dark-mode .ui.dropdown .menu > .item.active {
  background: rgba(18, 140, 126, 0.2) !important;
  color: #4CAF50 !important;
}

body.dark-mode .ui.dropdown > .text {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.selection.dropdown {
  background: #3a3a3a !important;
  border-color: #555 !important;
}

body.dark-mode .ui.multiple.dropdown > .label {
  background: #4a4a4a !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

/* ── Buttons ── */
body.dark-mode .ui.button {
  background: #3a3a3a !important;
  color: #e0e0e0 !important;
}

body.dark-mode .ui.button:hover {
  background: #4a4a4a !important;
}

body.dark-mode .ui.primary.button,
body.dark-mode .ui.primary.button:hover {
  background: var(--gradient-primary) !important;
  color: #fff !important;
}

body.dark-mode .ui.secondary.button {
  background: #4a4a4a !important;
  color: #e0e0e0 !important;
}

body.dark-mode .ui.negative.button,
body.dark-mode .ui.red.button {
  background: #db2828 !important;
  color: #fff !important;
}

body.dark-mode .ui.positive.button,
body.dark-mode .ui.green.button {
  background: #21ba45 !important;
  color: #fff !important;
}

/* ── Segments ── */
body.dark-mode .ui.segment {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

/* ── Messages ── */
body.dark-mode .ui.message {
  background: #363636 !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
  box-shadow: 0 0 0 1px #444 inset !important;
}

body.dark-mode .ui.info.message {
  background: rgba(33, 133, 208, 0.15) !important;
  color: #6dbbf5 !important;
  box-shadow: 0 0 0 1px rgba(33, 133, 208, 0.3) inset !important;
}

body.dark-mode .ui.success.message,
body.dark-mode .ui.positive.message {
  background: rgba(33, 186, 69, 0.15) !important;
  color: #5cd679 !important;
  box-shadow: 0 0 0 1px rgba(33, 186, 69, 0.3) inset !important;
}

body.dark-mode .ui.warning.message {
  background: rgba(251, 189, 8, 0.15) !important;
  color: #f5c842 !important;
  box-shadow: 0 0 0 1px rgba(251, 189, 8, 0.3) inset !important;
}

body.dark-mode .ui.error.message,
body.dark-mode .ui.negative.message {
  background: rgba(219, 40, 40, 0.15) !important;
  color: #f56d6d !important;
  box-shadow: 0 0 0 1px rgba(219, 40, 40, 0.3) inset !important;
}

/* ── Cards ── */
body.dark-mode .ui.card,
body.dark-mode .ui.cards > .card {
  background: #2d2d2d !important;
  border-color: #444 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
}

body.dark-mode .ui.card > .content,
body.dark-mode .ui.cards > .card > .content {
  border-color: #444 !important;
}

/* ── Card Content (Instance Cards) ── */
body.dark-mode .ui.card .meta,
body.dark-mode .ui.cards > .card .meta {
  color: #aaaaaa !important;
}

body.dark-mode .ui.card .content .description,
body.dark-mode .ui.cards > .card .content .description {
  color: #d0d0d0 !important;
}

body.dark-mode .ui.card > .extra.content,
body.dark-mode .ui.cards > .card > .extra.content {
  background: #363636 !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

body.dark-mode .ui.list > .item > .header,
body.dark-mode .ui.list .item > .header {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.list > .item > .content,
body.dark-mode .ui.list .item > .content {
  color: #cccccc !important;
}

body.dark-mode .ui.icon.header .sub.header {
  color: #aaaaaa !important;
}

body.dark-mode .ui.card .header:not(.ui),
body.dark-mode .ui.cards > .card .header:not(.ui) {
  color: #e0e0e0 !important;
}

/* ── Headers ── */
body.dark-mode .ui.header {
  color: #e0e0e0 !important;
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6 {
  color: #e0e0e0 !important;
}

/* ── Labels ── */
body.dark-mode .ui.label {
  background: #3a3a3a !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

body.dark-mode .ui.primary.label {
  background: var(--primary-color) !important;
  color: #fff !important;
}

body.dark-mode .ui.green.label {
  background: #21ba45 !important;
  color: #fff !important;
}

body.dark-mode .ui.red.label {
  background: #db2828 !important;
  color: #fff !important;
}

body.dark-mode .ui.orange.label {
  background: #4CAF50 !important;
  color: #fff !important;
}

/* ── Checkbox / Toggle ── */
body.dark-mode .ui.checkbox label,
body.dark-mode .ui.toggle.checkbox label {
  color: #e0e0e0 !important;
}

/* ── Loader / Dimmer ── */
body.dark-mode .ui.loader {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.loader::after {
  border-color: #4CAF50 transparent transparent !important;
}

body.dark-mode .ui.dimmer {
  background-color: rgba(0,0,0,0.7) !important;
}

/* ── Progress Bar ── */
body.dark-mode .ui.progress {
  background: #3a3a3a !important;
}

body.dark-mode .ui.progress .bar {
  /* Keep bar colors as-is */
}

/* ── Secondary Menu (Tabs) ── */
body.dark-mode .ui.pointing.secondary.menu .item {
  color: #b0b0b0 !important;
}

body.dark-mode .ui.pointing.secondary.menu .active.item {
  color: #4CAF50 !important;
  border-color: #4CAF50 !important;
}

/* ── Popups / Tooltips ── */
body.dark-mode .ui.popup {
  background: #363636 !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

/* ── Dividers ── */
body.dark-mode .ui.divider {
  border-color: #444 !important;
  color: #888 !important;
}

/* ── Dashboard-Specific ── */
body.dark-mode .admingrid,
body.dark-mode .maingrid {
  background: transparent !important;
}

body.dark-mode #instances-table,
body.dark-mode #secondary-admins-table {
  /* Covered by .ui.table rules above */
}

/* Instance status badges */
body.dark-mode .ui.table .ui.label {
  border: none !important;
}

/* Links */
body.dark-mode a {
  color: #4CAF50 !important;
}

body.dark-mode a:hover {
  color: #388E3C !important;
}

body.dark-mode .ui.menu a.item {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.primary.button a,
body.dark-mode .ui.button.primary a {
  color: #fff !important;
}

/* Scrollbar */
body.dark-mode ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.dark-mode ::-webkit-scrollbar-track {
  background: #2d2d2d;
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* ── Dark Mode Toggle Button ── */
#darkModeToggle {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#darkModeToggle:hover {
  opacity: 0.8;
}

#darkModeToggle .icon {
  font-size: 1.15em;
  margin: 0 !important;
}

body.dark-mode #darkModeToggle .icon {
  color: #4CAF50 !important;
}

/* ── Ensure Login Page Is NOT Affected ── */
body.dark-mode .login-wrapper {
  color: inherit;
}

body.dark-mode .login-illustration-panel {
  /* Preserve original gradient */
  background: linear-gradient(145deg, #388E3C, #4CAF50, #256D1B) !important;
}

body.dark-mode .login-form-panel {
  background: #2d2d2d !important;
}

body.dark-mode .login-form-panel .login-card {
  background: #363636 !important;
  border-color: #444 !important;
}

body.dark-mode .login-form-panel input {
  background: #3a3a3a !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

body.dark-mode .login-form-panel label {
  color: #e0e0e0 !important;
}

body.dark-mode .login-form-panel .login-title,
body.dark-mode .login-form-panel .login-subtitle {
  color: #e0e0e0 !important;
}

/* ── Misc Fomantic Overrides ── */
body.dark-mode .ui.attached.segment {
  background: #2d2d2d !important;
  border-color: #444 !important;
}

body.dark-mode .ui.attached.header {
  background: #363636 !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

body.dark-mode .ui.list .item {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.grid > .row {
  /* Transparent */
}

body.dark-mode .ui.icon.input > i.icon {
  color: #888 !important;
}

body.dark-mode .ui.breadcrumb .section {
  color: #b0b0b0 !important;
}

body.dark-mode .ui.breadcrumb .active.section {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.statistics .statistic > .value,
body.dark-mode .ui.statistic > .value {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.statistics .statistic > .label,
body.dark-mode .ui.statistic > .label {
  color: #b0b0b0 !important;
}

body.dark-mode .ui.accordion .title {
  color: #e0e0e0 !important;
}

body.dark-mode .ui.tab {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVENESS
   ═══════════════════════════════════════════════ */

/* Mobile Menu */
.mobile-menu-trigger {
  display: none !important;
}

.mobile-dropdown-menu {
  display: none;
  position: fixed;
  top: 42px;
  right: 0;
  width: 250px;
  background: #ffffff;
  box-shadow: -2px 2px 10px rgba(0,0,0,0.15);
  z-index: 1001;
  border-radius: 0 0 0 8px;
  overflow: hidden;
}

.mobile-dropdown-menu.visible {
  display: block;
}

.mobile-dropdown-menu .item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 14px 18px !important;
  color: #333 !important;
  font-size: 0.95rem;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}

.mobile-dropdown-menu .item:hover {
  background: #f5f5f5;
}

.mobile-dropdown-menu .item:last-child {
  border-bottom: none;
}

.mobile-dropdown-menu .item i.icon {
  font-size: 1.1em;
  width: 20px;
  text-align: center;
}

/* Dark mode for mobile dropdown */
body.dark-mode .mobile-dropdown-menu {
  background: #2d2d2d !important;
  box-shadow: -2px 2px 10px rgba(0,0,0,0.4);
}

body.dark-mode .mobile-dropdown-menu .item {
  color: #e0e0e0 !important;
  border-bottom-color: #444;
}

body.dark-mode .mobile-dropdown-menu .item:hover {
  background: #3a3a3a;
}

@media (max-width: 768px) {
  .desktop-menu {
    display: none !important;
  }
  .mobile-menu-trigger {
    display: flex !important;
  }
}

/* ── Secondary Admins Table Mobile ── */
@media (max-width: 768px) {
  #secondaryAdminsSection .ui.stackable.grid .row {
    flex-direction: column !important;
  }

  #secondaryAdminsSection .ui.stackable.grid .row > .column {
    width: 100% !important;
    text-align: left !important;
    margin-bottom: 0.5em;
  }

  #secondaryAdminsSection .ui.stackable.grid .row > .column:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  #secondaryAdminsSection .ui.stackable.grid .row > .column:last-child .ui.button {
    flex: 1;
    min-width: 120px;
  }

  #secondaryAdminsSection h1.ui.header {
    font-size: 1.3em !important;
  }

  /* Make the table horizontally scrollable on mobile */
  #secondaryAdminsSection .ui.mb-4 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #secondary-admins-table {
    min-width: 700px;
  }
}

/* Also make instances table scrollable on mobile */
@media (max-width: 768px) {
  .admingrid .ui.mb-4 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #instances-table {
    min-width: 500px;
  }

  .admingrid .ui.stackable.grid .row > .column {
    width: 100% !important;
    text-align: left !important;
  }

  .admingrid h1.ui.header {
    font-size: 1.3em !important;
  }
}

/* COPY BUTTON */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 2px 10px;
  font-size: 0.78em;
  font-weight: 600;
  border: 1.5px solid var(--primary-color);
  border-radius: 20px;
  background: transparent;
  color: var(--primary-color);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  vertical-align: middle;
  white-space: nowrap;
  margin-left: 8px;
  line-height: 1.6;
}
.copy-btn:hover {
  background: var(--primary-color);
  color: #fff;
}
.copy-btn.copied {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
  pointer-events: none;
}