/* ============================================
   FOUR DE - Admin Panel Styles
   ============================================ */

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

:root {
  --orange: #E87722;
  --orange-dark: #C9651A;
  --brown: #3D2817;
  --brown-dark: #2A1A0E;
  --cream: #FFF8F0;
  --cream-dark: #F5EBDB;
  --white: #ffffff;
  --gray-50: #FAFAFA;
  --gray-100: #F4F4F5;
  --gray-200: #E4E4E7;
  --gray-300: #D4D4D8;
  --gray-500: #71717A;
  --gray-700: #3F3F46;
  --gray-900: #18181B;
  --red: #DC2626;
  --green: #16A34A;
  --blue: #2563EB;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.1);
  --radius: 12px;
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  direction: rtl;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ============================================
   LOGIN
   ============================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 30%, rgba(232,119,34,0.1), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(61,40,23,0.1), transparent 50%),
    var(--gray-100);
}

.login-card {
  background: var(--white);
  padding: 48px 40px;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card .logo {
  margin: 0 auto 24px;
  width: 80px;
  height: 80px;
}

.login-card h1 {
  font-size: 24px;
  color: var(--brown);
  margin-bottom: 6px;
  font-weight: 800;
}

.login-card p {
  color: var(--gray-500);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-card .form-group {
  text-align: right;
  margin-bottom: 16px;
}

.login-card label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-700);
}

.login-card input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  background: var(--gray-50);
  transition: all 0.2s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--orange);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(232,119,34,0.1);
}

.login-card .btn-login {
  width: 100%;
  background: var(--orange);
  color: var(--white);
  padding: 14px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 16px;
  margin-top: 8px;
  transition: all 0.2s;
}

.login-card .btn-login:hover { background: var(--orange-dark); }

.login-card .hint {
  margin-top: 24px;
  padding: 12px;
  background: var(--cream);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--brown);
}

.error-msg {
  background: #FEE2E2;
  color: var(--red);
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
}

/* ============================================
   ADMIN LAYOUT
   ============================================ */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--brown-dark);
  color: var(--white);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo img { width: 44px; height: 44px; object-fit: contain; }

.sidebar-logo h2 {
  font-size: 18px;
  color: var(--orange);
  font-weight: 800;
  line-height: 1.2;
}

.sidebar-logo p {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.sidebar-menu { padding: 0 12px; }

.sidebar-menu li button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  text-align: right;
  margin-bottom: 4px;
}

.sidebar-menu li button:hover { background: rgba(255,255,255,0.05); color: var(--white); }

.sidebar-menu li button.active {
  background: var(--orange);
  color: var(--white);
}

.sidebar-menu svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 16px 12px;
}

.sidebar-bottom {
  padding: 12px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-logout:hover { background: rgba(220,38,38,0.15); color: #FCA5A5; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  padding: 32px 40px;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 28px;
  color: var(--brown);
  font-weight: 800;
}

.page-header p {
  color: var(--gray-500);
  font-size: 14px;
  margin-top: 4px;
}

.page-actions { display: flex; gap: 10px; }

.btn {
  padding: 11px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--orange);
  color: var(--white);
}

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

.btn-secondary {
  background: var(--white);
  color: var(--brown);
  border: 1.5px solid var(--gray-200);
}

.btn-secondary:hover { background: var(--gray-50); }

.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #B91C1C; }

.btn-sm { padding: 8px 14px; font-size: 13px; }

.btn svg { width: 16px; height: 16px; }

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

.stat-card {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 16px;
  align-items: center;
}

.stat-card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon svg { width: 28px; height: 28px; }

.stat-card-info p {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.stat-card-info strong {
  font-size: 24px;
  color: var(--brown);
  font-weight: 800;
  display: block;
}

/* ============================================
   CARDS / PANELS
   ============================================ */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h3 {
  font-size: 18px;
  color: var(--brown);
  font-weight: 800;
}

.panel-body { padding: 24px; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-700);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  background: var(--white);
  color: var(--gray-900);
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,119,34,0.1);
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ============================================
   TABLES
   ============================================ */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.data-table th {
  background: var(--gray-50);
  padding: 14px 16px;
  text-align: right;
  font-weight: 700;
  font-size: 13px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  color: var(--gray-900);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--gray-50); }

.data-table .product-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
}

.actions-cell {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  transition: all 0.2s;
}

.icon-btn:hover { background: var(--gray-200); transform: scale(1.05); }
.icon-btn.delete:hover { background: #FEE2E2; color: var(--red); }
.icon-btn svg { width: 16px; height: 16px; }

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tag-success { background: #DCFCE7; color: var(--green); }
.tag-orange { background: #FFEDD5; color: var(--orange-dark); }
.tag-blue { background: #DBEAFE; color: var(--blue); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

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

.modal {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}

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

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

.modal-header h3 {
  font-size: 19px;
  color: var(--brown);
  font-weight: 800;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  transition: all 0.2s;
}

.modal-close:hover { background: var(--gray-200); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}

/* ============================================
   PRICING TABLE EDITOR
   ============================================ */
.pricing-editor {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.pricing-editor th {
  background: var(--brown);
  color: var(--white);
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
}

.pricing-editor td {
  padding: 6px;
  border: 1px solid var(--gray-200);
}

.pricing-editor td:first-child {
  background: var(--cream);
  text-align: center;
  font-weight: 700;
  color: var(--brown);
  padding: 12px;
}

.pricing-editor input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-family: inherit;
  background: var(--white);
}

.pricing-editor input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(232,119,34,0.1);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  min-width: 280px;
  border-right: 4px solid var(--green);
  animation: toastIn 0.3s ease;
}

.toast.error { border-right-color: var(--red); }
.toast.warning { border-right-color: #F59E0B; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-500);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--gray-300);
}

.empty-state h4 {
  font-size: 18px;
  color: var(--brown);
  margin-bottom: 6px;
}

.empty-state p { font-size: 14px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    right: -260px;
    transition: right 0.3s;
    z-index: 99;
    width: 260px;
    height: 100vh;
  }
  .sidebar.open { right: 0; }
  .mobile-menu-btn { display: flex !important; }
}

@media (max-width: 768px) {
  .main-content { padding: 20px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  background: var(--white);
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  color: var(--brown);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

/* Section sections inside main */
.admin-section { display: none; }
.admin-section.active { display: block; animation: fadeIn 0.3s ease; }

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