/* ─── Variables ───────────────────────────────────────────────────────────── */
:root {
  --bg: #F8FAF6;
  --sidebar-bg: #333333;
  --sidebar-text: #ffffff;
  --sidebar-hover: #444444;
  --sidebar-active: #FF6B35;
  --primary: #FF6B35;
  --primary-hover: #e55a2b;
  --text: #222222;
  --text-muted: #888888;
  --border: #e0e0e0;
  --white: #ffffff;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 8px;
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ─── Login ───────────────────────────────────────────────────────────────── */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--sidebar-bg); }
.login-box { background: var(--white); padding: 48px 40px; border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 400px; text-align: center; }
.login-box h1 { font-size: 24px; margin-bottom: 8px; color: var(--sidebar-bg); }
.login-box p { color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }
.login-box input { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 16px; margin-bottom: 16px; outline: none; transition: border-color 0.2s; }
.login-box input:focus { border-color: var(--primary); }
.login-box button { width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: var(--radius); font-size: 16px; font-weight: 600; transition: background 0.2s; }
.login-box button:hover { background: var(--primary-hover); }
.login-error { color: var(--danger); font-size: 14px; margin-top: 12px; display: none; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.sidebar-logo { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo h2 { font-size: 18px; font-weight: 700; color: var(--primary); }
.sidebar-logo span { font-size: 11px; color: rgba(255,255,255,0.5); display: block; margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: rgba(255,255,255,0.8); font-size: 14px; transition: all 0.2s; border-left: 3px solid transparent; }
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: var(--sidebar-hover); color: white; border-left-color: var(--primary); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn { display: flex; align-items: center; gap: 10px; background: none; border: none; color: rgba(255,255,255,0.6); font-size: 14px; width: 100%; padding: 8px 0; transition: color 0.2s; }
.logout-btn:hover { color: white; }
.main { flex: 1; margin-left: 240px; padding: 32px; }
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 28px; font-weight: 700; color: var(--text); }
.page-header p { color: var(--text-muted); margin-top: 4px; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 18px; font-weight: 600; }
.card-header h3 { font-size: 16px; font-weight: 600; }

/* ─── Stats Grid ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--sidebar-bg); }
.stat-card .stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.highlight { background: var(--primary); color: white; }
.stat-card.highlight .stat-label, .stat-card.highlight .stat-sub { color: rgba(255,255,255,0.8); }
.stat-card.highlight .stat-value { color: white; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500; border: none; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #e0e0e0; color: var(--text); }
.btn-secondary:hover { background: #d0d0d0; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-refunded { background: #f8d7da; color: #721c24; }
.badge-published { background: #d4edda; color: #155724; }
.badge-draft { background: #e0e0e0; color: #555; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.2s; background: white; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group input[readonly], .form-group input[disabled] { background: #f0f0f0; color: var(--text-muted); cursor: not-allowed; }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }

/* ─── Search & Filters ────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.search-box { display: flex; align-items: center; background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; flex: 1; min-width: 200px; }
.search-box input { border: none; padding: 10px 14px; font-size: 14px; flex: 1; outline: none; }
.search-box input:focus { border-color: transparent; }
.search-box button { background: none; border: none; padding: 10px 14px; color: var(--text-muted); }
.filter-select { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; background: white; outline: none; cursor: pointer; }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.2s; }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal { background: white; border-radius: var(--radius); width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; padding: 32px; position: relative; }
.modal-large { max-width: 800px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { font-size: 20px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* ─── Toggle Switch ───────────────────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 24px; cursor: pointer; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; background: white; border-radius: 50%; top: 3px; left: 3px; transition: 0.2s; }
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── Image Upload ────────────────────────────────────────────────────────── */
.image-upload { border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px; text-align: center; cursor: pointer; transition: border-color 0.2s; }
.image-upload:hover { border-color: var(--primary); }
.image-upload input { display: none; }
.image-upload img { max-width: 200px; max-height: 150px; border-radius: var(--radius); margin-bottom: 12px; }
.image-upload p { font-size: 14px; color: var(--text-muted); }
.image-preview { max-width: 120px; max-height: 80px; border-radius: var(--radius); margin-top: 8px; }
.image-upload-wrapper { display: flex; flex-direction: column; gap: 8px; }
.image-upload-wrapper input[type="text"] { margin-bottom: 0; }
.image-upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer; transition: all 0.2s; min-height: 80px; display: flex; align-items: center; justify-content: center; }
.image-upload-area:hover { border-color: var(--primary); background: #fafafa; }
.image-upload-area.dragover { border-color: var(--primary); background: #fff5f0; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.upload-placeholder svg { opacity: 0.5; }
.image-upload-area img { max-height: 140px; border-radius: 6px; }

/* ─── Preview ──────────────────────────────────────────────────────────────── */
.preview-content { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; margin-top: 16px; }
.preview-content h1 { font-size: 28px; margin-bottom: 8px; }
.preview-meta { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.preview-body { font-size: 16px; line-height: 1.7; }
.preview-body h1, .preview-body h2, .preview-body h3 { margin: 24px 0 12px; }
.preview-body p { margin-bottom: 16px; }
.preview-body ul, .preview-body ol { margin: 16px 0; padding-left: 24px; }
.preview-body li { margin-bottom: 8px; }
.preview-body blockquote { border-left: 4px solid var(--primary); padding-left: 16px; color: var(--text-muted); font-style: italic; margin: 16px 0; }

/* ─── Empty State ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 64px; height: 64px; color: #ddd; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }

/* ─── Toast ───────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500; color: white; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideIn 0.3s ease; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo h2, .sidebar-logo span, .nav-item span { display: none; }
  .sidebar-logo { padding: 16px; text-align: center; }
  .nav-item { justify-content: center; padding: 14px; }
  .sidebar-footer span { display: none; }
  .main { margin-left: 60px; padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { margin: 16px; padding: 20px; }
}

/* ─── Product Grid ────────────────────────────────────────────────────────── */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.product-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.product-card-header { padding: 16px 20px; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.product-card-header h3 { font-size: 16px; font-weight: 600; }
.product-card-body { padding: 20px; }
.product-price { font-size: 24px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.product-price span { font-size: 14px; font-weight: 400; color: var(--text-muted); text-decoration: line-through; margin-left: 8px; }
