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

:root {
  --bg-dark: #0a0c12;
  --card-bg: rgba(18, 22, 34, 0.82);
  --card-border: rgba(255, 255, 255, 0.08);
  --primary: #5865f2;
  --primary-hover: #4752c4;
  --accent: #57f287;
  --danger: #ed4245;
  --warning: #fee75c;
  --pink: #eb459e;
  --text-main: #ffffff;
  --text-muted: #949ba4;
  --font-family: 'Cairo', 'Inter', sans-serif;
  --radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(88, 101, 242, 0.16) 0px, transparent 55%),
    radial-gradient(at 90% 90%, rgba(235, 69, 158, 0.12) 0px, transparent 55%),
    radial-gradient(at 50% 50%, rgba(87, 242, 135, 0.05) 0px, transparent 60%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  direction: rtl;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Layout */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  display: none;
  width: 280px;
  background: rgba(12, 14, 22, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--card-border);
  padding: 22px 16px;
  flex-direction: column;
  gap: 14px;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

body.dashboard-mode .sidebar {
  display: flex !important;
}

body.landing-mode .sidebar {
  display: none !important;
}

body.dashboard-mode .main-content {
  margin-right: 280px !important;
  max-width: calc(100% - 280px) !important;
  width: calc(100% - 280px) !important;
}

body.landing-mode .main-content {
  margin: 0 auto !important;
  max-width: 1300px !important;
  width: 100% !important;
}

body.dashboard-mode #dashboard-header {
  display: flex !important;
}

body.landing-mode #dashboard-header {
  display: none !important;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
  min-width: 0;
}

.brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  box-shadow: 0 0 14px rgba(88, 101, 242, 0.45);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.status-badge {
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
}

.guild-selector {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  width: 100%;
  outline: none;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.guild-selector:focus, .guild-selector:hover {
  border-color: var(--primary);
  background: rgba(88, 101, 242, 0.1);
}

/* Nav Menu & Categories */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
}

.nav-category {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.38);
  margin-top: 14px;
  margin-bottom: 4px;
  padding-right: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 0.88rem;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  transform: translateX(-3px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(88, 101, 242, 0.22) 0%, rgba(88, 101, 242, 0.06) 100%);
  color: #fff;
  border-right: 3.5px solid var(--primary);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.15);
}

.nav-icon {
  font-size: 1.15rem;
  width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Main Content Area */
.main-content {
  margin-right: 280px;
  flex: 1;
  padding: 32px 40px;
  max-width: calc(100% - 280px);
  width: calc(100% - 280px);
}

.header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: #fff;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.stat-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Module Grid Cards (ProBot & MEE6 Style) */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 22px;
  margin-top: 24px;
}

.module-card {
  background: linear-gradient(145deg, rgba(22, 26, 40, 0.85) 0%, rgba(16, 19, 30, 0.9) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #5865f2, #eb459e);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.module-card:hover {
  transform: translateY(-5px);
  border-color: rgba(88, 101, 242, 0.35);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 0 25px rgba(88, 101, 242, 0.15);
}

.module-card:hover::before {
  opacity: 1;
}

.module-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.module-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.module-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.module-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.module-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.badge-status {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-active {
  background: rgba(87, 242, 135, 0.15);
  color: #57f287;
  border: 1px solid rgba(87, 242, 135, 0.3);
}

.badge-inactive {
  background: rgba(148, 155, 164, 0.15);
  color: #949ba4;
  border: 1px solid rgba(148, 155, 164, 0.3);
}

/* Card Sections */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 30px 34px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 14px;
}

/* VISUAL DRAG & DROP DESIGNER STAGE */
.designer-container {
  width: 100%;
  overflow-x: auto;
  background: #050608;
  border-radius: 16px;
  border: 2px dashed rgba(88, 101, 242, 0.4);
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.designer-stage {
  position: relative;
  width: 1024px;
  height: 680px;
  background: #11131a;
  overflow: hidden;
  user-select: none;
  border-radius: 8px;
}

.stage-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Draggable UI Elements */
.drag-element {
  position: absolute;
  cursor: move;
  transform: translate(-50%, -50%);
  user-select: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s ease;
}

.drag-avatar-box {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px dashed var(--accent);
  box-shadow: 0 0 18px rgba(87, 242, 135, 0.5);
  background: rgba(0, 0, 0, 0.4);
}

.drag-avatar-box img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}

.drag-label {
  position: absolute;
  bottom: -24px;
  background: var(--accent);
  color: #000;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.drag-username-box {
  padding: 8px 16px;
  border: 2px dashed var(--primary);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: 40px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 0 16px rgba(88, 101, 242, 0.5);
}

.drag-subtext-box {
  padding: 6px 14px;
  border: 2px dashed var(--warning);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #d4af37;
  font-size: 32px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 0 16px rgba(254, 231, 92, 0.5);
}

.drag-element.active {
  box-shadow: 0 0 24px #ffffff;
  z-index: 20;
}

/* Form Controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #e0e2e5;
}

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  background: rgba(11, 13, 20, 0.75);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25);
  background: rgba(15, 18, 28, 0.9);
}

/* Toggle Switch */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(11, 13, 20, 0.6);
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
  direction: ltr !important;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #3f434a;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
  border-radius: 28px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background-color: #ffffff;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

input:checked + .slider {
  background-color: #57f287;
  box-shadow: 0 0 14px rgba(87, 242, 135, 0.35);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.22s ease;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(88, 101, 242, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4752c4 0%, #3c45a5 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(88, 101, 242, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, #ed4245 0%, #c03537 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(237, 66, 69, 0.3);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #c03537 0%, #9e2a2c 100%);
  transform: translateY(-2px);
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.data-table th, .data-table td {
  padding: 14px 16px;
  text-align: right;
  border-bottom: 1px solid var(--card-border);
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #161822;
  border-right: 4px solid var(--accent);
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

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

/* Discord Live Message Preview */
.discord-preview-card {
  background: #2b2d31;
  border-radius: 14px;
  padding: 18px;
  margin-top: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.discord-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.discord-preview-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.discord-preview-username {
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
}

.discord-preview-bot-tag {
  background: #5865f2;
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  margin-right: 6px;
}

.discord-embed-box {
  border-right: 4px solid #5865f2;
  background: #1e1f22;
  padding: 14px 18px;
  border-radius: 8px;
  margin-top: 8px;
}

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

.discord-embed-desc {
  font-size: 0.9rem;
  color: #dbdee1;
  white-space: pre-wrap;
  word-break: break-word;
}

.discord-embed-image {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  margin-top: 12px;
  object-fit: contain;
  background: rgba(0,0,0,0.2);
}

/* Glassmorphism Login Overlay */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 10, 16, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.login-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: all !important;
}

.login-card {
  background: rgba(20, 24, 36, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(88, 101, 242, 0.15);
  border-radius: 22px;
  padding: 36px 40px;
  width: 100%;
  max-width: 440px;
  animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
