/* ========================================
   DESIGN TOKENS
   ======================================== */
:root {
  /* Colors — Dark Discord-inspired palette */
  --bg-dark: #0b0d14;
  --bg-surface: #111420;
  --bg-card: #161924;
  --bg-elevated: #1c2030;
  --bg-hover: #222640;
  --bg-input: #1a1d2e;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-input: rgba(255, 255, 255, 0.1);
  --border-focus: #5865f2;

  --text-primary: #e8eaf0;
  --text-secondary: #8b90a0;
  --text-muted: #5c6070;
  --text-accent: #5865f2;

  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-glow: rgba(88, 101, 242, 0.25);
  --success: #57f287;
  --danger: #ed4245;
  --warning: #fee75c;
  --gold: #f0b232;

  /* Sizing */
  --sidebar-width: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Fonts */
  --font-main: "Inter", sans-serif;
  --font-arabic: "Cairo", sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   LOGIN SCREEN
   ======================================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.login-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
  }
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
  animation: card-enter 0.6s var(--transition-slow) both;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

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

.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ========================================
   INPUTS
   ======================================== */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group .optional {
  text-transform: none;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.input-group input[type="text"],
.input-group input[type="password"],
.input-group input[type="url"],
.input-group textarea,
.input-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  outline: none;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group 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='%238b90a0' d='M6 8.825a.5.5 0 0 1-.354-.146l-4-4a.5.5 0 0 1 .708-.708L6 7.617l3.646-3.646a.5.5 0 0 1 .708.708l-4 4A.5.5 0 0 1 6 8.825z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  padding-right: 36px;
}

.input-group select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 8px;
}

.input-group textarea {
  resize: vertical;
  min-height: 80px;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
  color: var(--text-muted);
}

/* Color Picker */
.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
}

.color-picker-wrap input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.color-label {
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  padding-top: 24px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--text-primary) !important;
  font-weight: 400 !important;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-input);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-label input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input:checked + .checkmark::after {
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4752c4);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), #3d47b0);
  transform: translateY(-1px);
  box-shadow: 0 6px 30px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-full {
  width: 100%;
}

.btn-send {
  margin-top: 8px;
  padding: 14px 32px;
  font-size: 1rem;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.logo-icon-sm {
  font-size: 28px;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(88, 101, 242, 0.15),
    rgba(88, 101, 242, 0.08)
  );
  color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.2rem;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-subtle);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(17, 20, 32, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

.status-badge {
  font-size: 0.8rem;
  color: var(--success);
  background: rgba(87, 242, 135, 0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 500;
}

/* Tab Content */
.tab-content {
  display: none;
  padding: 32px;
  animation: fade-in 0.3s ease;
}

.tab-content.active {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.tab-content.active > .form-card {
  flex: 1.4;
  min-width: 0;
  margin-bottom: 0;
}

.tab-content.active > .preview-card {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  position: sticky;
  top: 80px;
}

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

/* ========================================
   FORM CARD
   ======================================== */
.form-card,
.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}

.card-header {
  margin-bottom: 28px;
}

.card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Form Grid */
.form-row {
  display: grid;
  gap: 16px;
}

.form-row.two-col {
  grid-template-columns: 1fr 1fr;
}

.form-row.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ========================================
   DISCORD PREVIEW
   ======================================== */
.discord-preview {
  background: #313338;
  border-radius: var(--radius-md);
  padding: 20px;
  font-family:
    "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.discord-msg {
  display: flex;
  gap: 16px;
}

.discord-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #f0b232, #e8900c);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.discord-body {
  flex: 1;
  min-width: 0;
}

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

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

.discord-badge {
  background: #5865f2;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.discord-time {
  color: #949ba4;
  font-size: 0.75rem;
}

.discord-mention {
  color: #c9cdfb;
  background: rgba(88, 101, 242, 0.15);
  display: inline-block;
  padding: 0 3px;
  border-radius: 3px;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.discord-embed {
  display: flex;
  max-width: 520px;
  border-radius: 4px;
  overflow: hidden;
  background: #2b2d31;
  margin-top: 4px;
}

.embed-accent {
  width: 4px;
  background: #ffa315;
  flex-shrink: 0;
}

.embed-content {
  padding: 12px 16px;
  flex: 1;
}

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

.embed-desc {
  font-size: 0.88rem;
  color: #dcddde;
  margin-bottom: 12px;
  line-height: 1.4;
}

.embed-field {
  font-size: 0.85rem;
  color: #dcddde;
  margin-bottom: 4px;
  line-height: 1.4;
}

.embed-field strong {
  color: #f2f3f5;
}

.embed-separator {
  color: #4e5058;
  font-size: 0.75rem;
  margin-bottom: 4px;
  user-select: none;
}

.discord-plain-text {
  font-size: 0.9rem;
  color: #dcddde;
  line-height: 1.5;
  word-break: break-word;
  margin-top: 2px;
}

/* File input */
.file-input-hidden {
  display: none;
}

.file-input-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px dashed var(--border-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast);
  user-select: none;
}

.file-input-label:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.file-input-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.file-input-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.image-thumb-item {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.image-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: block;
}

.remove-one-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  border: none;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.remove-one-btn:hover {
  background: #c0383b;
}

.preview-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.preview-img-item {
  max-height: 180px;
  max-width: 100%;
  border-radius: 4px;
  object-fit: contain;
  flex: 1 1 140px;
}

/* ========================================
   TOAST
   ======================================== */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  animation: toast-in 0.4s var(--transition-slow) both;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.toast.success {
  background: linear-gradient(135deg, #1a3a2a, #1c3024);
  border: 1px solid rgba(87, 242, 135, 0.3);
  color: var(--success);
}

.toast.error {
  background: linear-gradient(135deg, #3a1a1a, #30201c);
  border: 1px solid rgba(237, 66, 69, 0.3);
  color: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
}

/* ========================================
   ERROR TEXT
   ======================================== */
.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 14px;
  text-align: center;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  .tab-content {
    padding: 20px;
  }

  .tab-content.active {
    flex-direction: column;
  }

  .tab-content.active > .form-card,
  .tab-content.active > .preview-card {
    position: static;
    margin-bottom: 20px;
  }

  .form-row.two-col,
  .form-row.three-col {
    grid-template-columns: 1fr;
  }

  .form-card,
  .preview-card {
    padding: 20px;
  }

  .top-bar {
    padding: 16px 20px;
  }

  .checkbox-group {
    padding-top: 0;
  }
}

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}
