/* -----------------------------------------------------------
   BASE STYLE — Modern dashboard appearance
----------------------------------------------------------- */

:root {
    --radius: 10px;
    --border: #e2e2e2;
    --border-light: #ededed;
    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --text: #111;
    --text-muted: #666;
    --accent: #2563eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px 16px;
    font-family: "Inter", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* -----------------------------------------------------------
   LAYOUT
----------------------------------------------------------- */

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 32px;
    letter-spacing: -0.02em;
}

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

.tab-switch {
    display: flex;
    gap: 10px;
}

.tab-btn {
    border: 1px solid var(--border);
    background: white;
    color: #333;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    background: #f3f4f6;
}

.tab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.tab-panel {
    margin-bottom: 16px;
}

.machine-browser {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.machine-browser-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.machine-browser-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 14px;
}

.machine-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.column-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 700;
}

.machine-list-box {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    min-height: 220px;
    max-height: 360px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.machine-pill {
    width: 100%;
    text-align: left;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.machine-pill .pill-title {
    font-weight: 600;
    color: #111;
}

.machine-pill .pill-sub {
    font-size: 12px;
    color: #6b7280;
}

.machine-pill.small {
    padding: 10px 12px;
}

.machine-pill:hover {
    border-color: #d1d5db;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.machine-pill.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: white;
}

.machine-pill.active .pill-sub {
    color: #dbeafe;
}

.machine-empty {
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    padding: 12px 8px;
}

.machine-selection {
    margin-top: 4px;
    font-size: 13px;
    color: #4b5563;
}

.machine-selection strong {
    color: #1d4ed8;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .machine-browser-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .machine-browser-grid {
        grid-template-columns: 1fr;
    }
}

/* -----------------------------------------------------------
   SEARCH HERO
----------------------------------------------------------- */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 26px;
    margin-bottom: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.search-hero {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-hero label {
    font-size: 16px;
    margin-bottom: 4px;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.input {
    width: 100%;
    padding: 14px 46px 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: 0.15s all;
    background: #fafafa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.input:focus {
    border-color: var(--accent);
    background: white;
    outline: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    color: #666;
}

.btn-search-icon:hover {
    background: #eee;
    color: #111;
}

.hint {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0 0;
}

.result-count {
    margin-top: 14px;
    font-size: 14px;
    color: var(--text-muted);
}

.quick-filters {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-filters-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    font-weight: 700;
}

.quick-filters-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-filter {
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #111827;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.badge-filter:hover {
    border-color: #d1d5db;
    background: #eef2ff;
}

.badge-filter.active {
    background: #1f5bff;
    color: white;
    border-color: #1f5bff;
    box-shadow: 0 4px 12px rgba(31, 91, 255, 0.25);
}

.quick-keyword-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* -----------------------------------------------------------
   CHIPS (Machine Filters)
----------------------------------------------------------- */

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: white;
    border: 1px solid var(--border);
    font-size: 13px;
    cursor: pointer;
    transition: 0.15s;
    color: #444;
}

.chip:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* -----------------------------------------------------------
   TABLE
----------------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    text-align: left;
    padding: 14px;
    background: #fafafa;
    border-bottom: 2px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

td {
    padding: 16px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    vertical-align: middle;
}

tr:hover {
    background: #fafbfc;
}

/* -----------------------------------------------------------
   TABLE CONTENT STYLING (clean classes)
----------------------------------------------------------- */

.product-ref {
    font-weight: 600;
    color: #333;
}

.product-name {
    font-weight: 500;
    margin-bottom: 4px;
    color: #111;
}

.product-family {
    font-size: 12px;
    color: #888;
}

.product-price {
    font-weight: 600;
    color: #2563eb;
}

.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.price-original {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 12px;
}

.price-discounted {
    color: #10b981;
    font-weight: 700;
    font-size: 14px;
}

/* -----------------------------------------------------------
   MACHINE TAGS
----------------------------------------------------------- */

.machine-tag {
    display: inline-block;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #0369a1;
    margin: 2px 2px 0 0;
    white-space: nowrap;
    font-weight: 500;
}

.machine-tag-more {
    display: inline-block;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #6b7280;
    margin: 2px 2px 0 0;
    font-weight: 500;
}

.machine-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* -----------------------------------------------------------
   DISPO BADGES (avec pseudo-element pour le point)
----------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.badge::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-green::before {
    background: #22c55e;
}

.badge-orange::before {
    background: #f59e0b;
}

.badge-red::before {
    background: #ef4444;
}

/* -----------------------------------------------------------
   PAGINATION
----------------------------------------------------------- */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 20px;
}

/* Skeleton loader (shadcn-like shimmer) */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #e5e7eb;
    border-radius: 8px;
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
    100% { transform: translateX(100%); }
}

button {
    appearance: none;
    border: 1px solid var(--border);
    background: white;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.15s;
}

button:hover:not(:disabled) {
    background: #0b2075;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

/* -----------------------------------------------------------
   CART BUTTONS & QUANTITY CONTROLS
----------------------------------------------------------- */

.btn-add-cart {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-add-cart:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-add-cart:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.quantity-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 6px;
}

.qty-btn {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.qty-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

/* -----------------------------------------------------------
   SPINNER
----------------------------------------------------------- */

.spinner {
    border: 3px solid #f3f3f3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.price-original {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 12px;
}

.price-discounted {
    color: #10b981;
    font-weight: 700;
    font-size: 14px;
}

/* -----------------------------------------------------------
   MACHINE TAGS
----------------------------------------------------------- */

.machine-tag {
    display: inline-block;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #0369a1;
    margin: 2px 2px 0 0;
    white-space: nowrap;
    font-weight: 500;
}

.machine-tag-more {
    display: inline-block;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #6b7280;
    margin: 2px 2px 0 0;
    font-weight: 500;
}

.machine-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* -----------------------------------------------------------
   DISPO BADGES (avec pseudo-element pour le point)
----------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.badge::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-green::before {
    background: #22c55e;
}

.badge-orange::before {
    background: #f59e0b;
}

.badge-red::before {
    background: #ef4444;
}

/* -----------------------------------------------------------
   PAGINATION
----------------------------------------------------------- */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 20px;
}

button {
    appearance: none;
    border: 1px solid var(--border);
    background: white;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.15s;
}

button:hover:not(:disabled) {
    background: #0b2075;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

/* -----------------------------------------------------------
   CART BUTTONS & QUANTITY CONTROLS
----------------------------------------------------------- */

.btn-add-cart {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-add-cart:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-add-cart:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.quantity-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 6px;
}

.qty-btn {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.qty-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

/* -----------------------------------------------------------
   SPINNER
----------------------------------------------------------- */

.spinner {
    border: 3px solid #f3f3f3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.price-original {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 12px;
}

.price-discounted {
    color: #10b981;
    font-weight: 700;
    font-size: 14px;
}

/* -----------------------------------------------------------
   MACHINE TAGS
----------------------------------------------------------- */

.machine-tag {
    display: inline-block;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #0369a1;
    margin: 2px 2px 0 0;
    white-space: nowrap;
    font-weight: 500;
}

.machine-tag-more {
    display: inline-block;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #6b7280;
    margin: 2px 2px 0 0;
    font-weight: 500;
}

.machine-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* -----------------------------------------------------------
   DISPO BADGES (avec pseudo-element pour le point)
----------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.badge::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-green::before {
    background: #22c55e;
}

.badge-orange::before {
    background: #f59e0b;
}

.badge-red::before {
    background: #ef4444;
}

/* -----------------------------------------------------------
   PAGINATION
----------------------------------------------------------- */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 20px;
}

button {
    appearance: none;
    border: 1px solid var(--border);
    background: white;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.15s;
}

button:hover:not(:disabled) {
    background: #0b2075;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

/* -----------------------------------------------------------
   CART BUTTONS & QUANTITY CONTROLS
----------------------------------------------------------- */

.btn-add-cart {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-add-cart:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-add-cart:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.quantity-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 6px;
}

.qty-btn {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.qty-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

/* -----------------------------------------------------------
   SPINNER
----------------------------------------------------------- */

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    width: 40px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* -----------------------------------------------------------
   MAIN LAYOUT - Keep content centered, sidebar fixed right
----------------------------------------------------------- */

.main-with-sidebar {
    display: block;
}

.results-column {
    width: 100%;
    max-width: 100%;
}

/* -----------------------------------------------------------
   CART SIDEBAR - Fixed on right side (desktop)
----------------------------------------------------------- */

.cart-sidebar-column {
    position: fixed;
    right: 0;
    top: 100px;
    width: clamp(320px, 32vw, 420px);
    height: calc(100vh - 120px);
    background: white;
    border-left: 1px solid #e5e7eb;
    border-radius: 12px 0 0 12px;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 18px rgba(0, 0, 0, 0.08);
    z-index: 200;
    transition: transform 0.3s ease;
}

/* On mobile, hide by default and show as overlay when cart has items */
@media (max-width: 768px) {
    .cart-sidebar-column {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 400px;
        height: 100vh;
        border-radius: 0;
        transform: translateX(100%);
        z-index: 1000;
    }

    .cart-sidebar-column.has-items {
        transform: translateX(0);
    }

    /* Add overlay for mobile */
    .cart-sidebar-column.has-items::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
}

.cart-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111;
}

.close-cart-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

@media (max-width: 768px) {
    .close-cart-mobile {
        display: flex;
    }

    .close-cart-mobile:hover {
        background: #f3f4f6;
        color: #374151;
    }
}

.cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    gap: 10px;
}

.btn-remove {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #9ca3af;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    transition: 0.15s;
}

.btn-remove:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: #fff1f2;
}

.cart-item-info {
    flex: 1;
}

.cart-item-ref {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
}

.cart-item-name {
    font-size: 12px;
    color: #888;
}

.cart-item-qty {
    font-size: 13px;
    color: #666;
    min-width: 40px;
    text-align: center;
}

.cart-item-price {
    font-weight: 600;
    color: #2563eb;
    font-size: 14px;
    min-width: 80px;
    text-align: right;
}

.cart-footer {
    border-top: 1px solid #e5e7eb;
    padding: 20px 24px;
}

.cart-delivery {
    display: none;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px dashed #d1d5db;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: #111827;
}

.cart-delivery-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.cart-delivery-sub {
    color: #4b5563;
    font-weight: 500;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.btn-submit-cart {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-submit-cart:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-submit-cart:active {
    transform: translateY(0);
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.cart-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Cart badge indicator (optional - shows item count) */
.cart-badge {
    position: fixed;
    right: 280px;
    top: 140px;
    background: #ef4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    z-index: 101;
}

.cart-badge.visible {
    display: flex;
}

@media (max-width: 768px) {
    .cart-badge {
        right: 20px;
        top: 80px;
    }
}

/* -----------------------------------------------------------
   ADMIN DASHBOARD
----------------------------------------------------------- */
.eyebrow {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    margin: 0;
}

.admin-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.admin-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-status {
    padding: 8px 12px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #374151;
    font-weight: 600;
    font-size: 13px;
}

.admin-status.success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.admin-status.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecdd3;
}

.admin-status.info {
    background: #eef2ff;
    color: #312e81;
    border: 1px solid #c7d2fe;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 1100px) {
    .admin-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.admin-card h3 {
    margin: 4px 0;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.table-scroll {
    overflow: auto;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    background: #fff;
}

.admin-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    background: #f9fafb;
}

.col-action {
    width: 90px;
    text-align: right;
}

.align-right {
    text-align: right;
}

.table-input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
    font-size: 14px;
}

.table-input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.admin-textarea {
    width: 100%;
    min-height: 240px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    background: #fafafa;
    resize: vertical;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.btn-admin {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #111827;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-admin.primary {
    background: #111827;
    color: white;
    border-color: #111827;
}

.btn-admin.ghost {
    background: white;
}

.btn-admin.small {
    padding: 8px 12px;
}

.btn-admin.tiny {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-admin:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.file-meta {
    margin-top: 6px;
    font-size: 12px;
    color: #4b5563;
}

/* -----------------------------------------------------------
   MOBILE RESPONSIVE (< 768px)
----------------------------------------------------------- */

@media (max-width: 768px) {

    /* --- Global --- */
    body {
        padding: 12px 10px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 16px;
    }

    .container {
        max-width: 100%;
    }

    /* --- User bar --- */
    .user-bar {
        flex-direction: column;
        gap: 10px;
        padding: 10px 12px !important;
        align-items: stretch !important;
    }

    .user-bar > div:last-child {
        justify-content: space-between;
    }

    .user-info {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    /* --- Tab buttons --- */
    .tab-switch {
        flex-wrap: wrap;
        gap: 6px;
    }

    .tab-btn {
        font-size: 13px;
        padding: 6px 10px;
        flex: 1;
        min-width: 0;
        text-align: center;
        white-space: nowrap;
    }

    /* --- Cards --- */
    .card {
        padding: 16px 14px;
        margin-bottom: 16px;
    }

    /* --- Search hero --- */
    .search-hero {
        padding: 18px 14px;
    }

    .search-wrapper {
        max-width: 100%;
    }

    .input {
        font-size: 16px;
        padding: 12px 42px 12px 14px;
    }

    /* --- Machine filter section --- */
    #machineFilterSection > div:first-child {
        flex-direction: column !important;
        gap: 8px;
    }

    #machineSearch {
        width: 100% !important;
    }

    /* --- TABLE -> CARD LAYOUT on mobile --- */
    table {
        display: block;
        border: none;
        background: transparent;
    }

    thead {
        display: none;
    }

    tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    tr {
        display: flex;
        flex-direction: column;
        background: white;
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 14px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        position: relative;
    }

    tr:hover {
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

    td {
        display: block;
        padding: 4px 0;
        border: none;
    }

    td:nth-child(1)::before {
        content: 'Ref. ';
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
    }

    td:nth-child(2) {
        order: -1;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid #f3f4f6;
    }

    td:nth-child(3)::before {
        content: 'Prix ';
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
    }

    td:nth-child(4)::before {
        content: 'Dispo ';
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
    }

    td:nth-child(5)::before {
        content: 'Compatibilite ';
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
    }

    td:nth-child(5) {
        padding: 6px 0;
    }

    td:nth-child(6) {
        padding-top: 8px;
        margin-top: 8px;
        border-top: 1px solid #f3f4f6;
    }

    .product-actions-inline {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-add-cart {
        width: 100%;
        text-align: center;
        padding: 10px;
    }

    .quantity-control {
        width: 100%;
        justify-content: center;
    }

    .favorite-toggle-btn {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    /* --- Machine tags on mobile --- */
    .machine-list {
        gap: 6px;
    }

    .machine-tag {
        font-size: 12px;
        padding: 4px 10px;
    }

    /* --- Cart sidebar mobile --- */
    .cart-sidebar-column {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        transform: translateX(100%);
        z-index: 1000;
    }

    .cart-sidebar-column.has-items {
        transform: translateX(0);
    }

    .cart-sidebar-column.has-items::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: -1;
    }

    .close-cart-mobile {
        display: flex;
    }

    .cart-content {
        padding: 12px 14px;
    }

    .cart-footer {
        padding: 14px;
    }

    .cart-header {
        padding: 14px;
    }

    /* Quick-add in cart */
    #cartSidebar .card {
        margin: 8px !important;
        padding: 10px !important;
    }

    #cartSidebar .card > div:nth-child(2) {
        flex-direction: column !important;
        gap: 6px;
    }

    #cartSidebar .card input {
        width: 100% !important;
    }

    /* --- Pagination --- */
    .pagination {
        padding: 12px 8px;
        gap: 8px;
    }

    .pagination button {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* --- Machine browser --- */
    .machine-browser-grid {
        grid-template-columns: 1fr;
    }

    .machine-list-box {
        min-height: 160px;
        max-height: 260px;
    }

    /* --- View all products button --- */
    #viewAllMachineBtn > div {
        flex-direction: column !important;
        gap: 10px;
    }

    #btnViewAllProducts {
        width: 100%;
        text-align: center;
    }

    /* --- Favorites --- */
    .favorite-row {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .favorite-actions {
        justify-content: flex-start;
    }

    /* --- Cart badge --- */
    .cart-badge {
        right: 16px;
        top: 80px;
    }

    /* --- Result count --- */
    .result-count {
        padding: 0 4px;
        font-size: 13px;
    }

    /* --- Quick filters --- */
    .quick-filters-row {
        flex-wrap: wrap;
    }

    .badge-filter {
        padding: 5px 10px;
        font-size: 12px;
    }

    /* --- Admin --- */
    .admin-hero {
        flex-direction: column;
        gap: 12px;
    }

    .admin-hero-actions {
        flex-wrap: wrap;
    }

    .table-scroll {
        margin: 0 -10px;
        border-radius: 0;
    }

    .admin-table {
        min-width: 480px;
    }

    .btn-admin {
        padding: 8px 12px;
        font-size: 13px;
    }

    .card-actions {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    /* --- Login page --- */
    .login-card {
        margin: 16px;
        padding: 1.5rem !important;
    }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
    .qty-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .btn-add-cart {
        padding: 10px 18px;
    }

    .badge-filter {
        padding: 8px 14px;
    }

    .machine-pill {
        padding: 12px 14px;
    }

    .tab-btn {
        padding: 10px 14px;
    }

    button, .btn-requests, .btn-logout {
        min-height: 40px;
    }

    .favorite-toggle-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }

    .btn-remove {
        padding: 8px 12px;
        min-height: 40px;
    }

    .close-cart-mobile {
        width: 44px;
        height: 44px;
    }
}
