/* ═══════════════════════════════════════════════════════════
   PT-ES Colloquial — Global Styles
   Dark Mode Premium | Glassmorphism | Inter Font
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ──────────────────────────────────────── */
:root {
  --bg-base:        #080c14;
  --bg-surface:     #0d1220;
  --bg-card:        rgba(16, 22, 38, 0.85);
  --bg-card-hover:  rgba(22, 30, 52, 0.95);

  --accent-primary: #7c3aed;
  --accent-secondary:#3b82f6;
  --accent-glow:    rgba(124, 58, 237, 0.35);
  --accent-success: #10b981;
  --accent-danger:  #ef4444;
  --accent-warning: #f59e0b;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --border:         rgba(148, 163, 184, 0.1);
  --border-focus:   rgba(124, 58, 237, 0.6);

  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --radius-xl:      28px;

  --shadow-card:    0 4px 24px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-glow:    0 0 30px rgba(124, 58, 237, 0.25);

  --transition:     all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(124, 58, 237, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 110%, rgba(59, 130, 246, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Layout ─────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 200px;
  max-width: 400px;
  min-height: 100vh;
  background: rgba(13, 18, 32, 0.9);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0; left: 0; bottom: 0;
  resize: horizontal;
  overflow-x: hidden;
  flex-shrink: 0;
}
  z-index: 100;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  display: block;
}

.sidebar-logo .logo-title {
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.sidebar-loading {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 16px;
  text-align: center;
}

/* ─── Group Accordion ──────────────────────────────────── */
.group-section {
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition);
  background: rgba(255,255,255,0.03);
  gap: 6px;
}

.group-header:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.15);
}

.group-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.group-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.group-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.group-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.75rem;
  transition: var(--transition);
  line-height: 1;
}

.group-action-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.1); }
.group-action-btn.delete:hover { color: var(--accent-danger); }

.group-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.group-section.open .group-chevron {
  transform: rotate(180deg);
}

.group-inactive-badge {
  font-size: 0.6rem;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  flex-shrink: 0;
}

.group-nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 4px 16px;
}

.group-section.open .group-nav {
  display: flex;
}

/* ─── Add Group Button ─────────────────────────────────── */
.btn-add-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(59, 130, 246, 0.1));
  border: 1px dashed rgba(124, 58, 237, 0.4);
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
}

.btn-add-group:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(59, 130, 246, 0.2));
  border-color: rgba(124, 58, 237, 0.6);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
  border-color: rgba(124, 58, 237, 0.2);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(59, 130, 246, 0.15));
  color: var(--text-primary);
  border-color: rgba(124, 58, 237, 0.3);
}

.nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 32px 40px;
  min-width: 0; /* allows flex items to shrink below min-content size */
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card:hover { border-color: rgba(148, 163, 184, 0.18); }

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ─── Stats Grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: var(--shadow-card), 0 0 20px rgba(124, 58, 237, 0.15);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.purple { background: rgba(124, 58, 237, 0.15); border: 1px solid rgba(124, 58, 237, 0.3); }
.stat-icon.blue   { background: rgba(59, 130, 246, 0.15);  border: 1px solid rgba(59, 130, 246, 0.3); }
.stat-icon.red    { background: rgba(239, 68, 68, 0.15);   border: 1px solid rgba(239, 68, 68, 0.3); }
.stat-icon.green  { background: rgba(16, 185, 129, 0.15);  border: 1px solid rgba(16, 185, 129, 0.3); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* ─── Status Indicator ───────────────────────────────────── */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-indicator.online {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-indicator.offline {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

.status-indicator.online .status-dot {
  background: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
  animation: pulse 2s infinite;
}

.status-indicator.offline .status-dot { background: var(--accent-danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}

/* ─── Table ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: rgba(148, 163, 184, 0.04); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-text  { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-photo { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.badge-scheduled { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-default   { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-ok    { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); }

/* ─── Form Controls ──────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="file"],
select,
textarea {
  background: rgba(8, 12, 20, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; min-height: 90px; }

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 48px; height: 26px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

input[type="checkbox"]:checked + .toggle-switch {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
}

input[type="checkbox"]:checked + .toggle-switch::after {
  transform: translateX(22px);
  background: #fff;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(124, 58, 237, 0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
  border-color: rgba(148, 163, 184, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ─── Tabs & Views ───────────────────────────────────────── */
.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Side-by-Side Form Layout ───────────────────────────── */
.side-by-side-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .side-by-side-form {
    grid-template-columns: 1fr;
  }
}

.side-panel {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-panel.side-original {
  border-color: rgba(74, 222, 128, 0.25);
}

.side-panel.side-translated {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.03);
}

.panel-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.preview-box-media {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-thumb {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

/* ─── Scheduled & Default Cards Grid ─────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition);
}

.item-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.item-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.item-card-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.item-card-badge.daily   { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.item-card-badge.weekly  { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.item-card-badge.monthly { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.item-card-badge.once    { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.item-card-body {
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.item-card-media {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.item-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── Card Action Buttons ─────────────────────────────────── */
.btn-card-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  outline: none;
}

.btn-card-action:hover {
  transform: translateY(-1px);
}

.btn-card-action.btn-edit {
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
}
.btn-card-action.btn-edit:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.btn-card-action.btn-send {
  border-color: rgba(124, 58, 237, 0.4);
  color: #a78bfa;
  background: rgba(124, 58, 237, 0.1);
}
.btn-card-action.btn-send:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: #a78bfa;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.35);
}

.btn-card-action.btn-delete {
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}
.btn-card-action.btn-delete:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: #f87171;
}

/* ─── Modal System ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.85);
  backdrop-filter: blur(12px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.open,
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-xl);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8), var(--shadow-glow);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.modal-overlay.open .modal-container,
.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.1);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-media-preview {
  width: 100%;
  max-height: 350px;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.preview-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.preview-box-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-box-label.pt { color: #4ade80; }
.preview-box-label.es { color: #fbbf24; }

.preview-box-text {
  font-size: 0.92rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* ─── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(16, 185, 129, 0.95);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.error {
  background: rgba(239, 68, 68, 0.95);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Input Wrapper & Eye Button ────────────────────────────── */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-wrapper input {
  padding-right: 44px !important;
}

.input-toggle-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: var(--transition);
}

.input-toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* ─── Group Divisions Grid & Responsive Layout ─────────── */
.group-divisions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.group-division-card {
  background: rgba(16, 22, 38, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.group-division-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.group-division-card:hover {
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.division-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.division-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.division-badge-tag {
  background: rgba(124, 58, 237, 0.2);
  color: var(--accent-primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.division-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.division-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.04);
}

.division-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.division-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Responsive Media Queries ──────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
    max-width: 300px;
  }
  .main-content {
    padding: 24px 20px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-wrapper {
    flex-direction: column;
  }
  .sidebar {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    resize: none;
  }
  .main-content {
    padding: 20px 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .side-by-side-form {
    grid-template-columns: 1fr;
  }
  .page-title {
    font-size: 1.4rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .group-divisions-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Overlapping Circular Avatars Badge ─────────────────────── */
.group-avatar-stack {
  display: inline-flex;
  align-items: center;
  position: relative;
  width: 52px;
  height: 34px;
  vertical-align: middle;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  position: absolute;
  top: 1px;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-circle.source-avatar {
  left: 0;
  z-index: 2;
  border: 2px solid #10b981; /* Green PT border */
}

.avatar-circle.dest-avatar {
  left: 18px; /* Overlapping by ~14px */
  z-index: 1;
  border: 2px solid #7c3aed; /* Purple ES border */
}

.group-avatar-stack:hover .avatar-circle.source-avatar {
  transform: scale(1.12) translateX(-3px);
}

.group-avatar-stack:hover .avatar-circle.dest-avatar {
  transform: scale(1.12) translateX(3px);
}

.group-avatar-single {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.group-avatar-single:hover {
  transform: scale(1.08);
}
.avatar-circle-single {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
}
.avatar-circle-single img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-flag-pill {
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: 0.62rem;
  line-height: 1;
  background: rgba(4, 7, 14, 0.9);
  border-radius: 50%;
  padding: 1px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
