/* Yassine Pâtisserie - Styles Globaux */
:root {
  --primary: #6B3FA0;
  --primary-dark: #4a2d70;
  --primary-light: #9B6FD0;
  --secondary: #D4A853;
  --accent: #E91E8C;
  --bg: #f8f5ff;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Loading */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #4a2d70 0%, #6B3FA0 50%, #9B6FD0 100%);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.loading-logo { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; box-shadow: 0 8px 32px rgba(0,0,0,0.4); animation: pulse 1.5s ease-in-out infinite; }
.loading-text { color: white; margin-top: 20px; font-size: 1.3rem; font-weight: 600; }
.loading-sub { color: rgba(255,255,255,0.8); font-size: 0.9rem; margin-top: 8px; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Spinner */
.spinner { width: 40px; height: 40px; border: 4px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; margin-top: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast notifications */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 12px 20px; border-radius: 12px; color: white; font-weight: 500; box-shadow: 0 4px 20px rgba(0,0,0,0.15); animation: toastIn 0.3s ease; max-width: 320px; display: flex; align-items: center; gap: 10px; }
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #6B3FA0; }
.toast.warning { background: #f59e0b; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 10px; font-weight: 600; font-size: 0.95rem; border: none; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-success { background: #10b981; color: white; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.1rem; }

/* Cards */
.card { background: white; border-radius: 16px; box-shadow: 0 2px 16px rgba(107,63,160,0.08); overflow: hidden; transition: all 0.2s; }
.card:hover { box-shadow: 0 6px 24px rgba(107,63,160,0.15); }
.card-header { padding: 20px 24px; border-bottom: 1px solid #f3f4f6; }
.card-body { padding: 24px; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; color: #374151; margin-bottom: 6px; font-size: 0.9rem; }
.form-input { width: 100%; padding: 11px 14px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: 1rem; transition: border-color 0.2s; outline: none; background: white; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(107,63,160,0.1); }
.form-select { width: 100%; padding: 11px 14px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: 1rem; outline: none; background: white; }
.form-select:focus { border-color: var(--primary); }

/* Navigation */
.navbar { background: white; border-bottom: 1px solid #e5e7eb; padding: 0 20px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(107,63,160,0.08); }
.navbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--primary); font-size: 1.1rem; }
.navbar-brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.nav-menu { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; }
.nav-item { cursor: pointer; padding: 6px 12px; border-radius: 8px; transition: all 0.2s; font-weight: 500; color: #6b7280; font-size: 0.9rem; }
.nav-item:hover { background: #f3f4f6; color: var(--primary); }
.nav-item.active { background: var(--primary); color: white; }

/* Bottom Nav Mobile */
.bottom-nav { display: none; }
@media (max-width: 768px) {
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: white; border-top: 1px solid #e5e7eb; padding: 8px 0; z-index: 100; box-shadow: 0 -4px 20px rgba(0,0,0,0.08); }
  .bottom-nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.7rem; color: #9ca3af; cursor: pointer; padding: 4px; transition: color 0.2s; }
  .bottom-nav-item.active { color: var(--primary); }
  .bottom-nav-item i { font-size: 1.3rem; }
  .main-content { padding-bottom: 80px !important; }
  .navbar { display: none; }
}

/* Produit Card */
.product-card { position: relative; cursor: pointer; }
.product-img { width: 100%; height: 200px; object-fit: cover; background: #f9fafb; }
.product-badge { position: absolute; top: 10px; left: 10px; background: var(--accent); color: white; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.product-price { color: var(--primary); font-weight: 700; font-size: 1.2rem; }
.product-stock { font-size: 0.8rem; }
.stock-ok { color: #10b981; }
.stock-low { color: #f59e0b; }
.stock-out { color: #ef4444; }

/* Cart */
.cart-badge { position: absolute; top: -8px; right: -8px; background: var(--accent); color: white; width: 20px; height: 20px; border-radius: 50%; font-size: 0.7rem; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.cart-item { display: flex; gap: 12px; padding: 12px; border-bottom: 1px solid #f3f4f6; align-items: center; }
.cart-item-img { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; background: #f9fafb; }
.cart-qty-btn { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--primary); background: white; color: var(--primary); font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* Order Status */
.status-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.status-pending { background: #fef9c3; color: #854d0e; }
.status-confirmed { background: #dbeafe; color: #1e40af; }
.status-preparing { background: #fce7f3; color: #9d174d; }
.status-ready { background: #d1fae5; color: #065f46; }
.status-delivering { background: #e0e7ff; color: #3730a3; }
.status-delivered { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* Tracking Timeline */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: #e5e7eb; }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-dot { position: absolute; left: -24px; width: 20px; height: 20px; border-radius: 50%; border: 3px solid #e5e7eb; background: white; top: 2px; }
.timeline-dot.done { background: #10b981; border-color: #10b981; }
.timeline-dot.current { background: var(--primary); border-color: var(--primary); animation: pulse 1.5s infinite; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal { background: white; border-radius: 20px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: white; z-index: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f3f4f6; display: flex; gap: 12px; justify-content: flex-end; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #9ca3af; line-height: 1; padding: 4px; }

/* Admin Sidebar */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%); flex-shrink: 0; display: flex; flex-direction: column; }
.admin-sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 12px; }
.admin-sidebar-header img { width: 48px; height: 48px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); }
.admin-sidebar-header h2 { color: white; font-size: 0.95rem; margin: 0; }
.admin-sidebar-header p { color: rgba(255,255,255,0.7); font-size: 0.8rem; margin: 0; }
.admin-nav { padding: 16px 12px; flex: 1; }
.admin-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,0.8); cursor: pointer; transition: all 0.2s; font-weight: 500; margin-bottom: 4px; }
.admin-nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.admin-nav-item.active { background: rgba(255,255,255,0.2); color: white; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.admin-nav-item i { width: 20px; text-align: center; }
.admin-main { flex: 1; overflow-y: auto; background: #f8f5ff; }
.admin-topbar { background: white; padding: 16px 24px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }

@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-sidebar.open { display: flex; position: fixed; inset-y: 0; left: 0; z-index: 200; }
  .admin-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 199; display: none; }
  .admin-overlay.show { display: block; }
}

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 0.85rem; font-weight: 600; color: #6b7280; background: #f9fafb; border-bottom: 2px solid #e5e7eb; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid #f3f4f6; font-size: 0.9rem; vertical-align: middle; }
.data-table tr:hover td { background: #fafafa; }
.data-table-container { overflow-x: auto; border-radius: 12px; border: 1px solid #e5e7eb; background: white; }

/* Media Upload */
.upload-zone { border: 2px dashed #d1d5db; border-radius: 12px; padding: 30px; text-align: center; cursor: pointer; transition: all 0.2s; background: #f9fafb; }
.upload-zone:hover { border-color: var(--primary); background: #f5f0ff; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.media-item { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: #f3f4f6; }
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; }
.media-item-del { position: absolute; top: 4px; right: 4px; background: rgba(239,68,68,0.9); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; }
.media-item-primary { position: absolute; bottom: 4px; left: 4px; background: #10b981; color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: 700; }

/* Homepage Editor */
.editor-preview { border: 2px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.color-swatch { width: 36px; height: 36px; border-radius: 8px; border: 2px solid #e5e7eb; cursor: pointer; }

/* Stats Cards */
.stat-card { background: white; border-radius: 16px; padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: 0 2px 12px rgba(107,63,160,0.06); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: #1f2937; line-height: 1; }
.stat-label { font-size: 0.85rem; color: #6b7280; margin-top: 4px; }

/* QR/Barcode */
.code-display { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; text-align: center; }
.barcode-svg { max-width: 100%; }

/* Responsive Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Animations */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.slide-up { animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Hero Section */
.hero-section { background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%); color: white; position: relative; overflow: hidden; }
.hero-section::before { content: ''; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }

/* Annouce bar */
.announce-bar { background: var(--secondary); color: white; text-align: center; padding: 8px 16px; font-size: 0.9rem; font-weight: 600; }

/* Cart Drawer */
.cart-drawer { position: fixed; right: 0; top: 0; bottom: 0; width: 380px; background: white; z-index: 500; transform: translateX(100%); transition: transform 0.3s ease; box-shadow: -4px 0 30px rgba(0,0,0,0.15); display: flex; flex-direction: column; }
.cart-drawer.open { transform: translateX(0); }
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 499; display: none; }
.cart-overlay.show { display: block; }
@media (max-width: 768px) { .cart-drawer { width: 100%; } }

/* Print QR */
@media print { body * { visibility: hidden; } .print-area, .print-area * { visibility: visible; } .print-area { position: absolute; left: 0; top: 0; } }
