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

/* ============ CSS Variables ============ */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f2a;
  --bg-card: rgba(15, 15, 42, 0.7);
  --bg-card-hover: rgba(20, 20, 55, 0.85);
  --bg-input: rgba(15, 15, 42, 0.6);
  --border-color: rgba(139, 92, 246, 0.15);
  --border-hover: rgba(139, 92, 246, 0.4);
  --text-primary: #e8e6f0;
  --text-secondary: #9990b8;
  --text-muted: #6b6490;
  --purple: #8b5cf6;
  --purple-light: #a78bfa;
  --purple-dark: #7c3aed;
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --green: #22c55e;
  --green-light: #4ade80;
  --red: #ef4444;
  --red-light: #f87171;
  --orange: #f59e0b;
  --yellow: #eab308;
  --gradient-primary: linear-gradient(135deg, #8b5cf6, #3b82f6);
  --gradient-secondary: linear-gradient(135deg, #7c3aed, #2563eb);
  --gradient-success: linear-gradient(135deg, #22c55e, #16a34a);
  --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15);
  --shadow-glow-blue: 0 0 30px rgba(59, 130, 246, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Reset & Base ============ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--purple-dark);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--purple);
}

/* ============ Layout ============ */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* ============ Header ============ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-color);
  animation: fadeInDown 0.6s ease;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo .logo-icon {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: var(--shadow-glow);
  animation: pulse-glow 3s ease-in-out infinite;
}

.header-logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.85rem;
  backdrop-filter: blur(12px);
  transition: var(--transition-normal);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  transition: var(--transition-normal);
  position: relative;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

.bot-info {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateX(20px);
  transition: var(--transition-normal);
  pointer-events: none;
}

.bot-info.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
}

.bot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--purple);
  object-fit: cover;
}

.bot-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============ Cards ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
  transition: var(--transition-normal);
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-2px);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.card-title i {
  font-size: 1.1rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Staggered animation */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }
.card:nth-child(7) { animation-delay: 0.7s; }
.card:nth-child(8) { animation-delay: 0.8s; }

/* ============ Section visibility ============ */
.section-hidden {
  display: none !important;
}

.section-visible {
  display: block;
  animation: fadeInUp 0.5s ease forwards;
}

/* ============ Form Elements ============ */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i.input-icon {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
  transition: var(--transition-fast);
}

input[type="text"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  padding-right: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Tajawal', 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: var(--transition-normal);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-hover);
}

textarea {
  resize: vertical;
  min-height: 120px;
  padding-right: 16px;
  line-height: 1.7;
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239990b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
}

input[type="color"] {
  width: 50px;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Tajawal', 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: width 0.6s, height 0.6s, top 0.6s, left 0.6s;
  transform: translate(-50%, -50%);
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.45);
}

.btn-success {
  background: var(--gradient-success);
  color: #fff;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(34, 197, 94, 0.45);
}

.btn-danger {
  background: var(--gradient-danger);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.45);
}

.btn-warning {
  background: var(--gradient-warning);
  color: #fff;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(245, 158, 11, 0.45);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--purple);
  background: rgba(139, 92, 246, 0.1);
  transform: translateY(-2px);
}

.btn-ghost {
  background: rgba(139, 92, 246, 0.1);
  color: var(--purple-light);
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--purple);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 16px 40px;
  font-size: 1.15rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

.btn-send-all {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9, #3b82f6);
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
  color: #fff;
  font-size: 1.2rem;
  padding: 18px 48px;
  border-radius: var(--radius-xl);
  box-shadow: 0 6px 30px rgba(139, 92, 246, 0.4);
  letter-spacing: 0.5px;
}

.btn-send-all:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.6);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Toggle password */
.toggle-password {
  position: absolute;
  left: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
  padding: 4px;
}

.toggle-password:hover {
  color: var(--purple-light);
}

/* ============ Connection Section ============ */
.connect-section {
  text-align: center;
}

.connect-form {
  max-width: 500px;
  margin: 0 auto;
}

.connect-animation {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  box-shadow: var(--shadow-glow);
  transition: var(--transition-slow);
}

.connect-animation.connected {
  background: var(--gradient-success);
  box-shadow: 0 0 40px rgba(34, 197, 94, 0.4);
  animation: bounce-in 0.5s ease;
}

.connecting-spinner {
  animation: spin 1s linear infinite;
}

/* ============ Tabs ============ */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Tajawal', 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.08);
}

.tab-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

/* ============ Multi-Select Roles ============ */
.roles-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
}

.role-chip:hover {
  transform: scale(1.05);
}

.role-chip.selected {
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
  transform: scale(1.05);
}

.role-chip .role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.send-all-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  transition: var(--transition-normal);
}

.switch .slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  top: 2px;
  right: 2px;
  transition: var(--transition-normal);
}

.switch input:checked + .slider {
  background: var(--gradient-primary);
  border-color: var(--purple);
}

.switch input:checked + .slider::before {
  transform: translateX(-22px);
  background: #fff;
}

.member-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 50px;
  font-size: 0.9rem;
  color: var(--purple-light);
  margin-top: 10px;
  transition: var(--transition-normal);
}

/* ============ Discord Preview ============ */
.preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.preview-modal.active {
  opacity: 1;
  visibility: visible;
}

.preview-modal .preview-content {
  background: #36393f;
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: scaleIn 0.3s ease;
  direction: ltr;
  position: relative;
}

.preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  z-index: 10;
}

.preview-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.preview-header {
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 14px;
  color: #b9bbbe;
  font-size: 0.85rem;
}

/* Discord message bubble */
.discord-msg {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  direction: ltr;
}

.discord-msg .msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}

.discord-msg .msg-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.discord-msg .msg-body {
  flex: 1;
}

.discord-msg .msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.discord-msg .msg-username {
  font-weight: 600;
  color: #8b5cf6;
  font-size: 0.95rem;
}

.discord-msg .msg-timestamp {
  font-size: 0.75rem;
  color: #72767d;
}

.discord-msg .msg-text {
  color: #dcddde;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.discord-embed {
  border-radius: 4px;
  margin-top: 8px;
  padding: 12px 16px;
  border-left: 4px solid var(--purple);
  background: #2f3136;
  max-width: 420px;
}

.discord-embed .embed-title {
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.discord-embed .embed-description {
  color: #b9bbbe;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.discord-embed .embed-image {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 10px;
}

.discord-msg .msg-image {
  max-width: 400px;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 8px;
  object-fit: cover;
}

/* ============ Progress Bar ============ */
.progress-container {
  margin: 20px 0;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--bg-input);
  border-radius: 50px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 50px;
  transition: width 0.5s ease;
  position: relative;
  min-width: 0;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-percentage {
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============ Stats Grid ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.stat-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-card.success .stat-icon { color: var(--green); }
.stat-card.danger .stat-icon { color: var(--red); }
.stat-card.info .stat-icon { color: var(--blue); }
.stat-card.warning .stat-icon { color: var(--orange); }
.stat-card.purple .stat-icon { color: var(--purple); }

.current-user-display {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: var(--radius-md);
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--purple-light);
  animation: fadeIn 0.3s ease;
}

/* ============ Templates ============ */
.templates-list {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
}

.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
}

.template-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.template-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.template-actions {
  display: flex;
  gap: 6px;
}

.save-template-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.save-template-form input {
  flex: 1;
  padding-right: 16px;
}

/* ============ Table ============ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: var(--bg-input);
}

th {
  padding: 14px 16px;
  text-align: right;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
}

tr {
  transition: var(--transition-fast);
}

tbody tr:hover {
  background: rgba(139, 92, 246, 0.05);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-light);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-light);
}

/* ============ Overall Stats Cards ============ */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.overview-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 0 0 0 100%;
  opacity: 0.08;
  transition: var(--transition-normal);
}

.overview-card.purple::before { background: var(--purple); }
.overview-card.blue::before { background: var(--blue); }
.overview-card.green::before { background: var(--green); }
.overview-card.orange::before { background: var(--orange); }

.overview-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.overview-card .overview-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 14px;
}

.overview-card.purple .overview-icon { background: var(--gradient-primary); }
.overview-card.blue .overview-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.overview-card.green .overview-icon { background: var(--gradient-success); }
.overview-card.orange .overview-icon { background: var(--gradient-warning); }

.overview-card .overview-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.overview-card .overview-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============ File Upload ============ */
.file-upload {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
  color: var(--text-muted);
}

.file-upload:hover {
  border-color: var(--purple);
  background: rgba(139, 92, 246, 0.05);
  color: var(--purple-light);
}

.file-upload i {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
}

.file-upload .file-name {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--green);
}

/* ============ Color Picker Row ============ */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker-row label {
  margin-bottom: 0;
}

/* ============ Notifications / Toast ============ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  animation: slideInLeft 0.4s ease, fadeOut 0.4s ease 3.6s forwards;
  min-width: 280px;
  max-width: 400px;
  direction: rtl;
  font-size: 0.9rem;
}

.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
.toast.warning { border-color: var(--orange); }
.toast.info { border-color: var(--blue); }

.toast i {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast.success i { color: var(--green); }
.toast.error i { color: var(--red); }
.toast.warning i { color: var(--orange); }
.toast.info i { color: var(--blue); }

/* ============ Animations ============ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
  }
}

@keyframes pulse-dot {
  0%, 100% {
    box-shadow: 0 0 6px var(--green);
  }
  50% {
    box-shadow: 0 0 16px var(--green), 0 0 30px rgba(34, 197, 94, 0.3);
  }
}

@keyframes bounce-in {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============ Loading Skeleton ============ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, rgba(139, 92, 246, 0.08) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  height: 20px;
}

/* ============ Empty State ============ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 14px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .app-container {
    padding: 0 12px 30px;
  }

  .header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .header-status {
    flex-direction: column;
    gap: 8px;
  }

  .header-logo h1 {
    font-size: 1.4rem;
  }

  .card {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-stats {
    grid-template-columns: 1fr;
  }

  .btn-send-all {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .save-template-form {
    flex-direction: column;
  }

  .tabs {
    flex-direction: column;
  }

  .preview-modal .preview-content {
    width: 95%;
    padding: 14px;
  }

  .discord-msg {
    padding: 8px;
  }

  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 10px 8px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .header-logo .logo-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

/* ============ Help Section Details Accordion ============ */
details.help-section {
  max-width: 1200px;
  margin: 0 auto 30px auto;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

details.help-section[open] {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.15);
}

details.help-section[open] .toggle-icon {
  transform: rotate(180deg);
}

details.help-section summary::-webkit-details-marker {
  display: none;
}

