/* ==========================================================================
   Ferme Floating Cart v2 - Noir & Blanc sobre
   ========================================================================== */

:root {
    --ffc-black: #111111;
    --ffc-dark: #1e293b;
    --ffc-text: #333333;
    --ffc-text-light: #666666;
    --ffc-gray: #999999;
    --ffc-border: #e0e0e0;
    --ffc-bg: #ffffff;
    --ffc-bg-light: #f5f5f5;
    --ffc-red: #d32f2f;
    --ffc-red-hover: #b71c1c;
    --ffc-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --ffc-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --ffc-drawer-width: 400px;
    --ffc-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ffc-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   Toggle Button - Fond noir, icône blanche
   ========================================================================== */

.ffc-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ffc-black) !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform var(--ffc-transition), box-shadow var(--ffc-transition);
    padding: 0;
    margin: 0;
    outline: none;
}

.ffc-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.ffc-toggle:active {
    transform: scale(0.96);
}

/* Force SVG blanc dans le toggle */
.ffc-cart-icon {
    width: 24px !important;
    height: 24px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#ffc-toggle svg,
#ffc-toggle svg *,
.ffc-toggle svg,
.ffc-toggle svg * {
    visibility: visible !important;
    opacity: 1 !important;
    display: inline !important;
}

#ffc-toggle svg,
.ffc-toggle svg {
    fill: none !important;
    stroke: #ffffff !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

#ffc-toggle svg path,
#ffc-toggle svg line,
.ffc-toggle svg path,
.ffc-toggle svg line {
    stroke: #ffffff !important;
    fill: none !important;
    stroke-width: 2 !important;
}

/* Badge compteur - fond rouge */

.ffc-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--ffc-red) !important;
    color: #ffffff !important;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    font-family: var(--ffc-font);
    border: 2px solid var(--ffc-black);
    transition: transform 0.2s ease;
}

.ffc-count:empty,
.ffc-count[data-count="0"] {
    display: none;
}

.ffc-count.ffc-bump {
    animation: ffc-bump 0.4s ease;
}

@keyframes ffc-bump {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.ffc-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ffc-transition), visibility var(--ffc-transition);
}

.ffc-overlay.ffc-active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Drawer
   ========================================================================== */

.ffc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 99999;
    width: var(--ffc-drawer-width);
    max-width: 92vw;
    height: 100vh;
    height: 100dvh;
    background: var(--ffc-bg);
    box-shadow: var(--ffc-shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--ffc-transition);
    font-family: var(--ffc-font);
}

.ffc-drawer.ffc-active {
    transform: translateX(0);
}

/* SVG dans le drawer */
.ffc-drawer svg,
.ffc-drawer svg path,
.ffc-drawer svg line,
.ffc-drawer svg polyline,
.ffc-drawer svg circle {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Header */

.ffc-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--ffc-border);
    flex-shrink: 0;
}

.ffc-drawer-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ffc-black);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ffc-drawer-title svg {
    flex-shrink: 0;
}

#ffc-header-count {
    font-weight: 400;
    color: var(--ffc-gray);
    font-size: 14px;
}

.ffc-close {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    border: none;
    background: var(--ffc-bg-light);
    color: var(--ffc-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.ffc-close:hover {
    background: var(--ffc-border);
    color: var(--ffc-black);
}

/* Scrollable Body */

.ffc-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ffc-drawer-body::-webkit-scrollbar {
    width: 3px;
}

.ffc-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.ffc-drawer-body::-webkit-scrollbar-thumb {
    background: var(--ffc-border);
    border-radius: 2px;
}

/* Items */

.ffc-items {
    padding: 8px 24px;
}

/* Empty State */

.ffc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 72px 24px 40px;
    text-align: center;
}

.ffc-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--ffc-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.ffc-empty-icon svg {
    opacity: 0.25;
}

.ffc-empty p {
    margin: 0;
    font-size: 15px;
    color: var(--ffc-black);
    font-weight: 600;
}

.ffc-empty-sub {
    font-size: 13px;
    color: var(--ffc-gray);
}

.ffc-empty .ffc-btn {
    margin-top: 8px;
}

/* ==========================================================================
   Cart Item
   ========================================================================== */

.ffc-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--ffc-border);
    position: relative;
    animation: ffc-fade-in 0.3s ease;
}

.ffc-item:last-child {
    border-bottom: none;
}

@keyframes ffc-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.ffc-item.ffc-removing {
    animation: ffc-slide-out 0.3s ease forwards;
}

@keyframes ffc-slide-out {
    to { opacity: 0; transform: translateX(40px); height: 0; padding: 0; margin: 0; overflow: hidden; }
}

.ffc-item-image {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--ffc-bg-light);
}

.ffc-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ffc-item-image a {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 4px;
}

.ffc-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-right: 28px;
}

.ffc-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ffc-black);
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ffc-item-name:hover {
    text-decoration: underline;
}

.ffc-item-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--ffc-text);
}

.ffc-item-variation {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.ffc-item-variation span {
    font-size: 11px;
    color: var(--ffc-gray);
    background: var(--ffc-bg-light);
    padding: 1px 6px;
    border-radius: 3px;
}

/* Quantity */

.ffc-qty-wrap {
    display: flex;
    align-items: center;
    margin-top: 6px;
    width: fit-content;
    border: 1px solid var(--ffc-border);
    border-radius: 4px;
    overflow: hidden;
}

.ffc-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--ffc-bg-light);
    color: var(--ffc-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.ffc-qty-btn:hover {
    background: var(--ffc-black);
    color: #fff;
}

.ffc-qty-input {
    width: 34px;
    height: 28px;
    border: none;
    border-left: 1px solid var(--ffc-border);
    border-right: 1px solid var(--ffc-border);
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--ffc-black);
    background: var(--ffc-bg);
    -moz-appearance: textfield;
    padding: 0;
    font-family: var(--ffc-font);
}

.ffc-qty-input::-webkit-inner-spin-button,
.ffc-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ffc-qty-input:focus {
    outline: none;
}

/* Remove */

.ffc-item-remove {
    position: absolute;
    top: 16px;
    right: 0;
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}

.ffc-item-remove:hover {
    color: var(--ffc-red);
    background: #fff0f0;
}

/* ==========================================================================
   Suggestions
   ========================================================================== */

.ffc-suggestions {
    padding: 0 24px;
}

.ffc-suggestions:empty {
    display: none;
}

.ffc-suggestions-inner {
    padding: 16px 0 20px;
    border-top: 1px solid var(--ffc-border);
}

.ffc-suggestions-title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ffc-black);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ffc-suggestions-title svg {
    color: var(--ffc-red);
}

.ffc-suggestions-grid {
    display: flex;
    flex-direction: column;
}

.ffc-suggest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--ffc-bg-light);
}

.ffc-suggest-item:last-child {
    border-bottom: none;
}

.ffc-suggest-image {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--ffc-bg-light);
    display: block;
}

.ffc-suggest-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ffc-suggest-info {
    flex: 1;
    min-width: 0;
}

.ffc-suggest-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--ffc-black);
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ffc-suggest-name:hover {
    text-decoration: underline;
}

.ffc-suggest-price {
    font-size: 12px;
    font-weight: 700;
    color: var(--ffc-text);
    margin-top: 1px;
}

.ffc-suggest-add {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--ffc-border);
    background: var(--ffc-bg);
    color: var(--ffc-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    text-decoration: none;
    padding: 0;
}

.ffc-suggest-add:hover {
    background: var(--ffc-black);
    border-color: var(--ffc-black);
    color: #fff;
}

.ffc-suggest-add.ffc-adding {
    pointer-events: none;
    opacity: 0.4;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.ffc-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--ffc-border);
    padding: 18px 24px;
    background: var(--ffc-bg);
}

.ffc-subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.ffc-subtotal > span:first-child {
    font-size: 13px;
    color: var(--ffc-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ffc-total-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--ffc-black);
}

.ffc-actions {
    display: flex;
    gap: 8px;
}

/* Boutons sobres noir/blanc */

.ffc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    flex: 1;
    text-align: center;
    font-family: var(--ffc-font);
}

.ffc-btn-primary {
    background: var(--ffc-black);
    color: #ffffff;
}

.ffc-btn-primary:hover {
    background: #333333;
    color: #ffffff;
}

.ffc-btn-secondary {
    background: var(--ffc-bg);
    color: var(--ffc-black);
    border: 1px solid var(--ffc-black);
}

.ffc-btn-secondary:hover {
    background: var(--ffc-black);
    color: #ffffff;
}

/* ==========================================================================
   Loading
   ========================================================================== */

.ffc-loading .ffc-items {
    opacity: 0.4;
    pointer-events: none;
}

.ffc-item.ffc-updating {
    opacity: 0.4;
    pointer-events: none;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.ffc-toast {
    position: fixed;
    bottom: 96px;
    right: 28px;
    z-index: 100000;
    background: var(--ffc-black);
    color: #fff;
    padding: 10px 18px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: ffc-toast-in 0.25s ease;
    font-family: var(--ffc-font);
}

.ffc-toast.ffc-toast-out {
    animation: ffc-toast-out 0.25s ease forwards;
}

@keyframes ffc-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ffc-toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(8px); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 921px) {
    .ffc-drawer {
        --ffc-drawer-width: 340px;
    }

    .ffc-drawer-header { padding: 16px 20px; }
    .ffc-items { padding: 8px 20px; }
    .ffc-suggestions { padding: 0 20px; }
    .ffc-footer { padding: 16px 20px; }
}

@media (max-width: 480px) {
    .ffc-drawer {
        --ffc-drawer-width: 100vw;
        max-width: 100vw;
    }

    .ffc-toggle {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .ffc-toast {
        right: 20px;
        bottom: 80px;
        left: 20px;
    }

    .ffc-item-image {
        width: 56px;
        height: 56px;
    }
}

@media print {
    .ffc-toggle,
    .ffc-drawer,
    .ffc-overlay,
    .ffc-toast {
        display: none !important;
    }
}
