/* ========================================
   Prompter — Main Styles (RTL Arabic-First)
   ======================================== */

:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #5341D6;
  --secondary: #FF6B6B;
  --accent: #FFA502;
  --success: #00B894;
  --warning: #FDCB6E;
  --danger: #E17055;
  --info: #74B9FF;

  --bg: #0F0F1A;
  --bg-card: #1A1A2E;
  --bg-card-hover: #222240;
  --bg-input: #16162A;
  --bg-sidebar: #12121F;

  --text: #E8E8F0;
  --text-secondary: #9B9BB0;
  --text-muted: #6B6B80;
  --border: #2A2A40;
  --border-light: #3A3A55;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: all 0.3s ease;

  --font: 'Tajawal', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  direction: rtl;
  min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

img { max-width: 100%; height: auto; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  justify-content: center;
  line-height: 1.4;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text); }

.btn-accent { background: var(--accent); color: #000; }
.btn-accent:hover { background: #e69500; color: #000; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d35745; color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #00a381; color: #fff; }

.btn-sm { padding: 8px 18px; font-size: 0.875rem; }
.btn-lg { padding: 16px 36px; font-size: 1.125rem; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 8px; font-size: 1.1rem; transition: var(--transition); }
.btn-icon:hover { color: var(--primary-light); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary-light);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

/* ===== Form Elements ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  transition: var(--transition);
  direction: rtl;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 120px; resize: vertical; }
.form-select { appearance: none; cursor: pointer; }
.form-hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-header { margin-bottom: 16px; }
.card-title { font-size: 1.1rem; font-weight: 700; }

/* ===== Grid ===== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ===== Stats Cards ===== */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.stat-icon.purple { background: rgba(108,92,231,0.15); color: var(--primary-light); }
.stat-icon.green { background: rgba(0,184,148,0.15); color: var(--success); }
.stat-icon.orange { background: rgba(255,165,2,0.15); color: var(--accent); }
.stat-icon.red { background: rgba(225,112,85,0.15); color: var(--danger); }
.stat-icon.blue { background: rgba(116,185,255,0.15); color: var(--info); }
.stat-info h3 { font-size: 1.75rem; font-weight: 800; }
.stat-info p { color: var(--text-secondary); font-size: 0.9rem; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.4s ease, toastOut 0.4s ease 4s forwards;
  max-width: 90%;
}
.toast-success { background: #00B894; color: #fff; }
.toast-error { background: #E17055; color: #fff; }

@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(-50%) translateY(-20px); } }

/* ===== Auth Pages ===== */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(ellipse at top, rgba(108,92,231,0.08), transparent 60%);
}
.auth-container { width: 100%; max-width: 440px; padding: 20px; }
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p { color: var(--text-secondary); font-size: 0.95rem; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 24px; color: var(--text-secondary); font-size: 0.9rem; }
.auth-footer a { color: var(--primary-light); font-weight: 600; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 14px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg-input);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tr:hover td { background: rgba(108,92,231,0.03); }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-free { background: rgba(155,155,176,0.15); color: var(--text-secondary); }
.badge-pro { background: rgba(108,92,231,0.15); color: var(--primary-light); }
.badge-business { background: rgba(255,165,2,0.15); color: var(--accent); }
.badge-active { background: rgba(0,184,148,0.15); color: var(--success); }
.badge-expired { background: rgba(225,112,85,0.15); color: var(--danger); }
.badge-pending { background: rgba(253,203,110,0.15); color: var(--warning); }
.badge-trial { background: rgba(116,185,255,0.15); color: var(--info); }

/* ===== Plan badges (sidebar) ===== */
.plan-badge {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}
.plan-free { background: var(--bg-input); color: var(--text-muted); }
.plan-pro { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.plan-business { background: linear-gradient(135deg, var(--accent), #e69500); color: #000; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
}
.pagination a { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }
.pagination a:hover { border-color: var(--primary); color: var(--primary-light); }
.pagination .active { background: var(--primary); color: #fff; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 1.25rem; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-start; margin-top: 24px; }

/* ===== Choice Grid (onboarding, options) ===== */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.choice-item {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  font-size: 0.95rem;
}
.choice-item:hover { border-color: var(--primary); }
.choice-item.selected { border-color: var(--primary); background: rgba(108,92,231,0.1); }
.choice-item .choice-icon { font-size: 1.5rem; margin-bottom: 8px; display: block; }

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ===== Copy Button ===== */
.copy-wrap {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 12px 0;
}
.copy-wrap pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
}
.copy-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.copy-btn:hover { background: var(--primary-dark); }

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