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

:root {
  --primary: #00b884;
  --primary-dark: #00966b;
  --primary-light: #e6f7f1;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e0e0e0;
  --orange: #f59e0b;
  --red: #ef4444;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
}

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

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

.sidebar {
  width: 250px;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  box-shadow: var(--shadow);
}

.main-content {
  flex: 1;
  margin-right: 250px;
  padding: 30px;
}

/* ===== Sidebar ===== */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  margin-bottom: 30px;
}
.logo-icon { font-size: 28px; }
.logo-text { font-weight: 700; font-size: 18px; color: var(--primary); }

.nav { flex: 1; }
.nav-item {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 4px;
  transition: all 0.2s;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary); color: white; }

.store-info {
  padding: 15px;
  background: var(--primary-light);
  border-radius: 8px;
  text-align: center;
}
.store-name { font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.store-status { font-size: 12px; }

/* ===== Header ===== */
.page-header { margin-bottom: 30px; }
.page-header h1 { font-size: 24px; font-weight: 700; }
.subtitle { color: var(--text-muted); margin-top: 5px; }

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow);
}
.stat-icon { font-size: 32px; }
.stat-number { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ===== Action Cards ===== */
.actions-section { margin-bottom: 30px; }
.actions-section h2 { font-size: 18px; margin-bottom: 15px; }
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}
.action-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.2s;
  border: 2px solid transparent;
}
.action-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.action-icon { font-size: 32px; margin-bottom: 10px; }
.action-card h3 { font-size: 16px; margin-bottom: 5px; }
.action-card p { font-size: 13px; color: var(--text-muted); }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d0d0d0; }
.btn-large { padding: 14px 28px; font-size: 16px; }
.btn-small { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-green { background: #d4edda; color: #155724; }
.badge-blue { background: #d1ecf1; color: #0c5460; }
.badge-orange { background: #fff3cd; color: #856404; }

/* ===== Products Table ===== */
.bulk-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow);
}
.bulk-progress { font-size: 14px; color: var(--text-muted); }

.products-table {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.products-table table { width: 100%; border-collapse: collapse; }
.products-table th {
  background: #f8f9fa;
  padding: 14px 16px;
  text-align: right;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.products-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.product-name { font-weight: 500; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 5px; margin-top: 20px; justify-content: center; }
.page-link {
  padding: 8px 12px;
  border-radius: 6px;
  background: white;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
}
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-large { max-width: 700px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.modal-close {
  background: none; border: none, font-size: 20px;
  cursor: pointer; color: var(--text-muted);
}

/* ===== Settings Form ===== */
.settings-form { padding: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
}
.form-group select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 14px;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.checkbox-group input { width: 20px; height: 20px; }

/* ===== Result Modal ===== */
.result-content { padding: 20px; }
.result-section {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}
.result-section:last-child { border-bottom: none; }
.result-section h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.result-title { font-size: 18px; font-weight: 700; }
.result-seo { color: var(--primary-dark); font-size: 14px; }
.result-meta { color: var(--text-muted); font-size: 14px; font-style: italic; }
.result-features li { margin-bottom: 5px; }

/* ===== Loading ===== */
.loading-spinner { text-align: center; padding: 40px; }
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 15px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.alert-error { background: #fee; color: #c00; border: 1px solid #faa; }

/* ===== Install Page ===== */
.install-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}
.install-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 450px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.install-icon { font-size: 56px; margin-bottom: 15px; }
.install-card h1 { font-size: 24px; margin-bottom: 10px; }
.install-card > p { color: var(--text-muted); margin-bottom: 25px; }
.features-list {
  list-style: none;
  text-align: right;
  margin-bottom: 30px;
}
.features-list li {
  padding: 8px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.features-list li:last-child { border-bottom: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-right: 0; }
}