:root {
  --primary-red: #E5192D;
  --primary-red-hover: #C71223;
  --primary-red-glow: rgba(229, 25, 45, 0.25);
  --bg-dark: #0B0C10;
  --bg-surface: #14161F;
  --bg-card: #1B1E2B;
  --bg-input: #232738;
  --border-color: #2D3247;
  --text-main: #FFFFFF;
  --text-muted: #9499AD;
  --text-highlight: #F3F4F6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.6;
}

/* Header */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 36px;
  background-color: var(--bg-surface);
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-box {
  display: flex;
  flex-direction: column;
}

.logo-3box {
  font-size: 30px;
  font-weight: 900;
  color: var(--primary-red);
  letter-spacing: 1px;
  line-height: 1;
}

.logo-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 3px;
}

.system-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background-color: rgba(229, 25, 45, 0.08);
  border: 1px solid rgba(229, 25, 45, 0.25);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-red);
  box-shadow: 0 0 10px var(--primary-red);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Main Container */
.main-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

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

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--primary-red);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.stat-icon {
  font-size: 32px;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  display: block;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  margin-top: 4px;
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 25px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--primary-red);
  border-bottom-color: var(--primary-red);
}

.tab-badge {
  background-color: var(--primary-red);
  color: #FFF;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.section-header h3 {
  font-size: 20px;
  font-weight: 800;
}

.section-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Drafts Grid */
.drafts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 22px;
}

.draft-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.draft-card:hover {
  border-color: rgba(229, 25, 45, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}

.draft-media-thumb {
  width: 100%;
  height: 220px;
  background-color: var(--bg-dark);
  position: relative;
  overflow: hidden;
}

.draft-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.draft-card:hover .draft-media-thumb img {
  transform: scale(1.03);
}

.draft-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.badge-waiting {
  background-color: rgba(245, 158, 11, 0.9);
  color: #000;
}

.badge-published {
  background-color: rgba(16, 185, 129, 0.9);
  color: #FFF;
}

.badge-rejected {
  background-color: rgba(239, 68, 68, 0.9);
  color: #FFF;
}

.draft-body {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.draft-title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.4;
}

.draft-hook {
  font-size: 13px;
  color: var(--primary-red);
  font-weight: 700;
  margin-bottom: 12px;
}

.draft-caption-preview {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.draft-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.draft-actions {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  background-color: rgba(0,0,0,0.15);
  border-top: 1px solid var(--border-color);
}

/* Buttons */
.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary-red);
  color: #FFF;
  box-shadow: 0 4px 14px var(--primary-red-glow);
}

.btn-primary:hover {
  background-color: var(--primary-red-hover);
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--success);
  color: #FFF;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: var(--danger);
  color: #FFF;
}

.btn-danger:hover {
  background-color: #DC2626;
}

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

.btn-secondary:hover {
  background-color: var(--bg-input);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Tables */
.table-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 14px;
}

.data-table th, .data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: var(--bg-card);
  color: var(--text-muted);
  font-weight: 700;
}

.data-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Settings Form */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
}

.settings-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.settings-card h4 {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-red);
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 2px var(--primary-red-glow);
}

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Switch */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-red);
}

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

.toggle-label {
  font-size: 14px;
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 15px;
}
