/* ============================================
   PharmaScoot Admin Panel - Styles
   ============================================ */

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

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

:root {
    --green-900: #0f3d1b;
    --green-800: #1a5c2e;
    --green-700: #227a3a;
    --green-600: #2a9847;
    --green-500: #34b854;
    --green-400: #5ccc74;
    --green-100: #e0f5e6;
    --green-50: #f0faf3;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --red-500: #ef4444;
    --red-100: #fee2e2;
    --orange-500: #f97316;
    --orange-100: #ffedd5;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --yellow-500: #eab308;
    --yellow-100: #fef9c3;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --transition: .2s ease;
}

html { font-size: 15px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-600); }
img { max-width: 100%; }

/* ---------- Login Page ---------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 100%);
}
.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
}
.login-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-card .logo-icon {
    width: 56px;
    height: 56px;
    background: var(--green-800);
    color: #fff;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: .75rem;
}
.login-card .logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--green-800);
}
.login-card .logo p {
    color: var(--gray-500);
    font-size: .875rem;
    margin-top: .25rem;
}

/* ---------- Layout ---------- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--green-900);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .logo-icon {
    width: 40px; height: 40px;
    background: var(--green-600);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}
.sidebar-logo span {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -.02em;
}
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: rgba(255,255,255,.7);
    font-size: .9rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,.07);
}
.sidebar-nav a.active {
    color: #fff;
    background: rgba(255,255,255,.12);
    border-left-color: var(--green-400);
}
.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}
.sidebar-nav .nav-section {
    padding: .5rem 1.25rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    margin-top: .75rem;
}
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: rgba(255,255,255,.6);
    font-size: .85rem;
    transition: color var(--transition);
}
.sidebar-footer a:hover { color: #fff; }

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Header ---------- */
.top-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}
.top-header .page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gray-900);
}
.top-header .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.top-header .user-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--gray-600);
}
.top-header .user-avatar {
    width: 34px; height: 34px;
    background: var(--green-100);
    color: var(--green-800);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .8rem;
}
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: .25rem;
}

/* ---------- Page Content ---------- */
.page-content {
    flex: 1;
    padding: 1.5rem;
}

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}
.card-body { padding: 1.25rem; }

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}
.kpi-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.kpi-icon.green { background: var(--green-100); color: var(--green-700); }
.kpi-icon.blue { background: var(--blue-100); color: var(--blue-500); }
.kpi-icon.orange { background: var(--orange-100); color: var(--orange-500); }
.kpi-icon.red { background: var(--red-100); color: var(--red-500); }
.kpi-info h3 {
    font-size: .8rem;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .25rem;
}
.kpi-info .kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}
.kpi-info .kpi-sub {
    font-size: .8rem;
    color: var(--gray-400);
    margin-top: .15rem;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
table th, table td {
    padding: .75rem 1rem;
    text-align: left;
    font-size: .875rem;
}
table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--gray-200);
}
table td {
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
table tbody tr:hover { background: var(--gray-50); }
table tbody tr { cursor: pointer; transition: background var(--transition); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.4;
}
.badge-green { background: var(--green-100); color: var(--green-700); }
.badge-blue { background: var(--blue-100); color: var(--blue-500); }
.badge-orange { background: var(--orange-100); color: var(--orange-500); }
.badge-red { background: var(--red-100); color: var(--red-500); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-yellow { background: var(--yellow-100); color: #92400e; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .55rem 1.15rem;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
    background: var(--green-700);
    color: #fff;
    border-color: var(--green-700);
}
.btn-primary:hover:not(:disabled) { background: var(--green-800); border-color: var(--green-800); }
.btn-secondary {
    background: #fff;
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); }
.btn-danger {
    background: var(--red-500);
    color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: .35rem;
}
.form-control {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
    color: var(--gray-800);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(42,152,71,.15);
}
.form-control::placeholder { color: var(--gray-400); }
select.form-control { appearance: auto; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all .25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform .25s ease;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: .25rem;
}
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.toast {
    padding: .75rem 1.25rem;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    animation: toastIn .3s ease;
    display: flex;
    align-items: center;
    gap: .5rem;
    max-width: 380px;
}
.toast.success { background: var(--green-700); }
.toast.error { background: var(--red-500); }
.toast.info { background: var(--blue-500); }
.toast.fadeout { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(40px); } }

/* ---------- Product Grid (Produits Phares) ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.product-card {
    background: #fff;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.product-card:hover { border-color: var(--gray-300); box-shadow: var(--shadow); }
.product-card.selected {
    border-color: var(--green-500);
    background: var(--green-50);
    box-shadow: 0 0 0 3px rgba(42,152,71,.15);
}
.product-card .check-indicator {
    position: absolute;
    top: .5rem; right: .5rem;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: transparent;
    transition: all var(--transition);
    background: #fff;
}
.product-card.selected .check-indicator {
    border-color: var(--green-600);
    background: var(--green-600);
    color: #fff;
}
.product-card .product-img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    margin-bottom: .75rem;
    border-radius: var(--radius);
    background: var(--gray-50);
}
.product-card .product-img-placeholder {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius);
    color: var(--gray-400);
    font-size: 2rem;
    margin-bottom: .75rem;
}
.product-card .product-name {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: .25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-card .product-price {
    font-size: .9rem;
    font-weight: 700;
    color: var(--green-700);
}

/* ---------- Analytics ---------- */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}
.funnel-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--gray-100);
}
.funnel-step:last-child { border-bottom: none; }
.funnel-bar {
    height: 32px;
    background: var(--green-100);
    border-radius: var(--radius);
    position: relative;
    min-width: 40px;
}
.funnel-bar-fill {
    height: 100%;
    background: var(--green-600);
    border-radius: var(--radius);
    transition: width .5s ease;
}
.funnel-label { font-size: .85rem; font-weight: 500; min-width: 120px; }
.funnel-value { font-size: .85rem; font-weight: 600; color: var(--gray-600); min-width: 60px; text-align: right; }

/* ---------- Settings ---------- */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.status-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}
.status-card .status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .75rem;
}
.status-card .status-header h3 {
    font-size: .95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.green { background: var(--green-500); }
.status-dot.red { background: var(--red-500); }
.status-dot.orange { background: var(--orange-500); }
.status-card .status-detail {
    font-size: .8rem;
    color: var(--gray-500);
    line-height: 1.6;
}

/* ---------- Search / Filter Bar ---------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filter-bar .search-input {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.filter-bar .search-input i {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: .9rem;
}
.filter-bar .search-input input {
    padding-left: 2.25rem;
}

/* ---------- Loading ---------- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--gray-400);
}
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--green-600);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-400);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-state p { font-size: .9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .page-content { padding: 1rem; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .modal { width: 95%; }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
}

/* Backdrop for mobile sidebar */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}
.sidebar-backdrop.active { display: block; }

/* ---------- Misc ---------- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: .8rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }

/* Detail list (order details etc) */
.detail-list dt {
    font-size: .8rem;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: .15rem;
}
.detail-list dd {
    font-size: .9rem;
    color: var(--gray-800);
    margin-bottom: .85rem;
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
}

/* Sticky save bar */
.sticky-save {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 40;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}

/* Quick link cards */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.quick-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    font-weight: 500;
    font-size: .9rem;
    color: var(--gray-700);
}
.quick-link:hover {
    border-color: var(--green-500);
    color: var(--green-700);
    box-shadow: var(--shadow);
}
.quick-link i {
    font-size: 1.2rem;
    color: var(--green-600);
}

/* ---------- Onboarding Banner ---------- */
.onboarding-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--green-50) 0%, #fff 100%);
    border: 1px solid var(--green-400);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}
.onboarding-banner > i {
    font-size: 1.5rem;
    color: var(--green-600);
    flex-shrink: 0;
}
.onboarding-banner > div {
    flex: 1;
}
.onboarding-banner strong {
    display: block;
    font-size: .95rem;
    color: var(--gray-900);
}
.onboarding-banner span {
    font-size: .85rem;
    color: var(--gray-500);
}
.onboarding-banner .btn-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: .25rem;
    line-height: 1;
    transition: color var(--transition);
}
.onboarding-banner .btn-close:hover {
    color: var(--gray-700);
}

/* ---------- Help Button & Tooltip ---------- */
.help-btn {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: .7rem;
    padding: 0 .15rem;
    vertical-align: middle;
    transition: opacity 0.2s, color 0.2s;
    opacity: 0;
}
h3:hover .help-btn,
.kpi-card:hover .help-btn,
.help-btn:focus {
    opacity: 1;
}
.help-btn:hover {
    color: var(--green-600);
    opacity: 1;
}
.help-tooltip {
    position: fixed;
    z-index: 10000;
    background: var(--gray-900);
    color: #fff;
    font-size: .825rem;
    font-weight: 400;
    line-height: 1.5;
    padding: .75rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 320px;
    animation: helpFadeIn .2s ease;
    pointer-events: auto;
}
.help-tooltip::after {
    content: '';
    position: absolute;
    top: -.5rem;
    left: 1rem;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid var(--gray-900);
}
.help-tooltip .help-close {
    position: absolute;
    top: .35rem;
    right: .5rem;
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.help-tooltip .help-close:hover {
    color: #fff;
}
@keyframes helpFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================
   COMPREHENSIVE RESPONSIVE MEDIA QUERIES
   Mobile-first admin panel for shop owner on the go
   ============================================ */

/* ---------- Tablet breakpoint (992px) ---------- */
@media (max-width: 992px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    .status-grid {
        grid-template-columns: 1fr 1fr;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .quick-links {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------- Mobile breakpoint (768px) ---------- */
@media (max-width: 768px) {

    /* Sidebar: fixed off-screen, slides in when .open */
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .top-header {
        padding-left: 12px;
    }

    /* Hamburger toggle visible on mobile */
    .hamburger {
        display: flex;
        align-items: center;
        background: none;
        border: none;
        color: var(--green-800);
        font-size: 1.2rem;
        cursor: pointer;
        padding: 8px;
    }

    /* Page content reduced padding */
    .page-content {
        padding: 1rem;
    }

    /* Page headers */
    .page-content h1,
    [style*="font-size:1.5rem"],
    [style*="font-size:1.3rem"] {
        font-size: 1.3rem !important;
    }
    .page-content h1 + p,
    .page-content h1 + .text-muted {
        font-size: 0.85rem;
    }

    /* Tables: horizontal scroll */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .card-body > table,
    .table-wrap > table {
        min-width: 600px;
    }
    table th, table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    /* KPI Cards */
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Product grid */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Filter bar stacks vertically */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .search-input {
        min-width: 0;
        width: 100%;
    }
    .filter-bar select.form-control,
    .filter-bar input.form-control {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    /* Toolbar (produits page etc) */
    .toolbar {
        flex-direction: column;
        gap: 8px;
    }
    .toolbar input,
    .toolbar select {
        width: 100%;
    }
    .toolbar-left {
        flex-direction: column;
    }
    .toolbar-left .search-input {
        max-width: none;
        min-width: 0;
    }
    .toolbar-right {
        justify-content: flex-end;
    }

    /* Marketplace cards */
    .mp-grid {
        grid-template-columns: 1fr;
    }
    .mp-config-panel {
        padding: 12px;
    }
    .mp-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Buttons */
    .btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    /* Modal */
    .modal {
        width: 95%;
        margin: 10px auto;
    }

    /* Status grid */
    .status-grid {
        grid-template-columns: 1fr;
    }

    /* Quick links */
    .quick-links {
        grid-template-columns: 1fr 1fr;
    }

    /* Sticky save bar */
    .sticky-save {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }

    /* Inline flex containers need wrapping */
    [style*="display:flex"][style*="gap"] {
        flex-wrap: wrap;
    }

    /* Card body flex overrides for inline styles */
    .card-body[style*="display:flex"] {
        flex-wrap: wrap !important;
    }

    /* Funnel chart labels */
    .funnel-label {
        min-width: 80px;
        font-size: 0.8rem;
    }
    .funnel-value {
        min-width: 40px;
        font-size: 0.8rem;
    }
}

/* ---------- Small phone breakpoint (576px) ---------- */
@media (max-width: 576px) {
    .main-content {
        margin-left: 0;
    }
    .page-content {
        padding: 12px;
    }

    /* KPI cards single column */
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .kpi-card {
        padding: 12px;
    }
    .kpi-info .kpi-value {
        font-size: 1.5rem;
    }
    .kpi-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Modal full-width on small screens */
    .modal {
        width: 95%;
        margin: 10px;
        max-height: 90vh;
    }
    .modal-header {
        padding: 1rem;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-footer {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }

    /* Forms: prevent iOS zoom */
    .form-group input,
    .form-group select,
    .form-group textarea,
    .form-control {
        font-size: 16px;
    }

    /* Status grid */
    .status-grid {
        grid-template-columns: 1fr;
    }

    /* Quick links stack */
    .quick-links {
        grid-template-columns: 1fr;
    }

    /* Card headers stack on small screens */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Detail grid single column */
    .detail-grid {
        grid-template-columns: 1fr;
    }

    /* Buttons in groups need wrapping */
    .modal-footer,
    .d-flex {
        flex-wrap: wrap;
    }

    /* Toast narrower on mobile */
    .toast {
        max-width: calc(100vw - 2rem);
    }
    .toast-container {
        right: 0.5rem;
        left: 0.5rem;
    }

    /* Top header compact */
    .top-header {
        padding: 0 0.75rem;
        height: 56px;
    }
    .top-header .page-title {
        font-size: 1rem;
    }
    .top-header .user-info span {
        display: none;
    }

    /* Login card mobile */
    .login-card {
        padding: 1.5rem;
        margin: 0.75rem;
    }
}

/* ---------- Extra small phone (480px) ---------- */
@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .product-grid {
        grid-template-columns: 1fr;
    }
    .product-card .product-img,
    .product-card .product-img-placeholder {
        height: 110px;
    }

    /* Analytics grid */
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    /* Badges smaller */
    .badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.5rem;
    }

    /* Quick links */
    .quick-links {
        grid-template-columns: 1fr;
    }
    .quick-link {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    /* Sidebar width reduced on very small screens */
    .sidebar {
        width: 240px;
    }
    .sidebar-nav a {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ---------- Overlay close when clicking backdrop on mobile ---------- */
@media (max-width: 768px) {
    .sidebar-backdrop.active {
        display: block;
        z-index: 999;
    }
}

/* ---------- Landscape phone ---------- */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar-nav {
        padding: 0.5rem 0;
    }
    .sidebar-nav a {
        padding: 0.45rem 1.25rem;
    }
    .modal {
        max-height: 95vh;
    }
}

/* ---------- Print: hide sidebar and non-essential ---------- */
@media print {
    .sidebar,
    .sidebar-backdrop,
    .hamburger,
    .top-header,
    .toast-container {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .page-content {
        padding: 0 !important;
    }
}
