/* =====================================================
   Smoothie Composer – Styles (Responsive)
   ===================================================== */

.sc-composer {
    --sc-primary: #22c55e;
    --sc-primary-dark: #16a34a;
    --sc-accent: #f97316;
    --sc-bg: #f0fdf4;
    --sc-card: #ffffff;
    --sc-text: #1f2937;
    --sc-muted: #6b7280;
    --sc-border: #e5e7eb;
    --sc-radius: 16px;
    --sc-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--sc-text);
    max-width: 1100px;
    margin: 0 auto 40px;
    padding: 16px;
    box-sizing: border-box;
    width: 100%;
}

.sc-composer *,
.sc-composer *::before,
.sc-composer *::after {
    box-sizing: border-box;
}

/* Header */
.sc-header {
    text-align: center;
    margin-bottom: 24px;
}
.sc-title {
    font-size: clamp(1.4rem, 5vw, 2rem);
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--sc-primary-dark);
    line-height: 1.2;
}
.sc-subtitle {
    color: var(--sc-muted);
    font-size: clamp(0.85rem, 2.5vw, 1.05rem);
    margin: 0;
    line-height: 1.45;
}

/* Main layout – desktop */
.sc-main {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

/* Categories */
.sc-category {
    background: var(--sc-card);
    border-radius: var(--sc-radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--sc-shadow);
    border: 1px solid var(--sc-border);
}
.sc-category-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--sc-primary-dark);
}

/* Items grid */
.sc-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.sc-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 6px;
    background: #f9fafb;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 88px;
}
.sc-item:hover {
    background: #ecfdf5;
    border-color: #bbf7d0;
    transform: translateY(-2px);
}
.sc-item.selected {
    background: #dcfce7;
    border-color: var(--sc-primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.sc-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.sc-item-emoji {
    font-size: 1.85rem;
    line-height: 1;
    margin-bottom: 5px;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji", "EmojiOne Color", "Twemoji Mozilla", sans-serif;
}
.sc-item-name {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    color: var(--sc-text);
    line-height: 1.25;
    word-break: break-word;
}
.sc-item-check {
    position: absolute;
    top: 5px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: var(--sc-primary);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}
.sc-item.selected .sc-item-check {
    opacity: 1;
    transform: scale(1);
}

/* Summary panel */
.sc-summary-panel {
    position: sticky;
    top: 20px;
}

/* Blender */
.sc-blender-container {
    background: linear-gradient(160deg, #ecfdf5 0%, #d1fae5 100%);
    border-radius: var(--sc-radius);
    padding: 20px 12px 14px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: var(--sc-shadow);
    border: 1px solid #a7f3d0;
}

.sc-blender {
    width: 130px;
    margin: 0 auto 10px;
    position: relative;
}

.sc-blender-lid {
    width: 64px;
    height: 16px;
    background: #374151;
    border-radius: 8px 8px 4px 4px;
    margin: 0 auto -2px;
    position: relative;
    z-index: 3;
}
.sc-blender-lid::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 9px;
    background: #4b5563;
    border-radius: 4px 4px 0 0;
}

.sc-blender-jar {
    width: 92px;
    height: 110px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.55);
    border: 3px solid #9ca3af;
    border-radius: 12px 12px 18px 18px;
    position: relative;
    overflow: hidden;
    z-index: 2;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.sc-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(180deg, #86efac 0%, #22c55e 60%, #16a34a 100%);
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.6s ease;
    border-radius: 0 0 14px 14px;
}
.sc-liquid.mixing {
    animation: sc-shake-liquid 0.15s infinite alternate;
}

@keyframes sc-shake-liquid {
    0%   { transform: translateX(-2px) rotate(-1deg); }
    100% { transform: translateX(2px) rotate(1deg); }
}

.sc-fruits-in-jar {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}
.sc-fruit-drop {
    position: absolute;
    font-size: 1.3rem;
    animation: sc-drop 0.6s ease-out forwards;
    opacity: 0;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji", "EmojiOne Color", "Twemoji Mozilla", sans-serif;
}
@keyframes sc-drop {
    0%   { transform: translateY(-30px) scale(0.5); opacity: 0; }
    60%  { opacity: 1; }
    100% { transform: translateY(65px) scale(1); opacity: 0.85; }
}

.sc-bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
}
.sc-bubbles.active {
    opacity: 1;
}
.sc-bubble {
    position: absolute;
    bottom: 10%;
    width: 8px;
    height: 8px;
    background: rgba(255,255,255,0.7);
    border-radius: 50%;
    animation: sc-bubble-rise 1.2s ease-in infinite;
}
@keyframes sc-bubble-rise {
    0%   { transform: translateY(0) scale(1); opacity: 0.8; }
    100% { transform: translateY(-90px) scale(0.3); opacity: 0; }
}

.sc-blender-base {
    width: 100px;
    height: 32px;
    background: #1f2937;
    border-radius: 8px 8px 12px 12px;
    margin: -4px auto 0;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sc-blender-button {
    width: 24px;
    height: 24px;
    background: #ef4444;
    border-radius: 50%;
    border: 3px solid #991b1b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: background 0.2s, transform 0.15s;
}
.sc-blender.mixing .sc-blender-button {
    background: #22c55e;
    border-color: #166534;
    animation: sc-pulse-btn 0.4s infinite alternate;
}
@keyframes sc-pulse-btn {
    from { transform: scale(1); }
    to   { transform: scale(1.1); }
}

.sc-blender.mixing {
    animation: sc-shake 0.12s infinite alternate;
}
@keyframes sc-shake {
    0%   { transform: rotate(-1.5deg) translateX(-1px); }
    100% { transform: rotate(1.5deg) translateX(1px); }
}

.sc-blender-status {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sc-primary-dark);
    margin: 0;
    min-height: 1.3em;
}

/* Order box */
.sc-order-box {
    background: var(--sc-card);
    border-radius: var(--sc-radius);
    padding: 16px;
    box-shadow: var(--sc-shadow);
    border: 1px solid var(--sc-border);
}
.sc-order-box h3 {
    margin: 0 0 10px;
    font-size: 1.1rem;
    font-weight: 700;
}

.sc-selected-list {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    max-height: 140px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.sc-selected-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px dashed var(--sc-border);
    font-size: 0.9rem;
}
.sc-selected-list li:last-child {
    border-bottom: none;
}
.sc-selected-list .sc-empty {
    color: var(--sc-muted);
    font-style: italic;
    border: none;
}
.sc-selected-list .sc-emoji {
    font-size: 1.15rem;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji", "EmojiOne Color", "Twemoji Mozilla", sans-serif;
}

/* Price */
.sc-price-box {
    background: #f9fafb;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
}
.sc-price-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: var(--sc-muted);
}
.sc-price-row:last-child {
    margin-bottom: 0;
}
.sc-total-row {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--sc-text);
    padding-top: 8px;
    border-top: 1px solid var(--sc-border);
    margin-top: 5px;
}
.sc-total-price {
    color: var(--sc-primary-dark);
}

/* Button */
.sc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.sc-btn-primary {
    background: linear-gradient(135deg, var(--sc-primary) 0%, var(--sc-primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
}
.sc-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}
.sc-btn-primary:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}
.sc-btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: sc-spin 0.7s linear infinite;
}
@keyframes sc-spin {
    to { transform: rotate(360deg); }
}

.sc-min-hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--sc-muted);
    margin: 10px 0 0;
}

.sc-btn.success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

/* =====================================================
   TABLET (max-width: 900px)
   ===================================================== */
@media (max-width: 900px) {
    .sc-main {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .sc-summary-panel {
        position: static;
        order: -1; /* mixeur + résumé en haut sur tablette/mobile */
    }

    .sc-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* =====================================================
   MOBILE (max-width: 600px)
   ===================================================== */
@media (max-width: 600px) {
    .sc-composer {
        padding: 12px 10px 100px; /* espace pour barre fixe en bas */
        margin-bottom: 0;
    }

    .sc-header {
        margin-bottom: 16px;
    }

    .sc-title {
        font-size: 1.35rem;
    }

    .sc-subtitle {
        font-size: 0.82rem;
    }

    .sc-category {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 12px;
    }

    .sc-category-title {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .sc-items-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .sc-item {
        padding: 10px 4px;
        min-height: 78px;
        border-radius: 10px;
    }

    .sc-item-emoji {
        font-size: 1.6rem;
        margin-bottom: 4px;
    }

    .sc-item-name {
        font-size: 0.72rem;
    }

    .sc-item-check {
        width: 16px;
        height: 16px;
        font-size: 10px;
        top: 4px;
        right: 4px;
    }

    /* Blender plus compact */
    .sc-blender-container {
        padding: 14px 10px 10px;
        margin-bottom: 12px;
        border-radius: 12px;
    }

    .sc-blender {
        width: 100px;
    }

    .sc-blender-lid {
        width: 50px;
        height: 13px;
    }

    .sc-blender-lid::before {
        width: 18px;
        height: 7px;
        top: -6px;
    }

    .sc-blender-jar {
        width: 72px;
        height: 85px;
        border-width: 2px;
    }

    .sc-blender-base {
        width: 80px;
        height: 26px;
    }

    .sc-blender-button {
        width: 18px;
        height: 18px;
        border-width: 2px;
    }

    .sc-blender-status {
        font-size: 0.78rem;
    }

    /* Order box – version mobile sticky bottom */
    .sc-order-box {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
        border-radius: 16px 16px 0 0;
        padding: 12px 14px 16px;
        margin: 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
        border: none;
        border-top: 1px solid var(--sc-border);
        max-height: 45vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sc-order-box h3 {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .sc-selected-list {
        max-height: 70px;
        margin-bottom: 10px;
        font-size: 0.85rem;
    }

    .sc-selected-list li {
        padding: 3px 0;
        font-size: 0.82rem;
    }

    .sc-price-box {
        padding: 8px 10px;
        margin-bottom: 10px;
    }

    .sc-price-row {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }

    .sc-total-row {
        font-size: 1rem;
        padding-top: 5px;
        margin-top: 3px;
    }

    .sc-btn {
        padding: 13px 14px;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    .sc-min-hint {
        font-size: 0.75rem;
        margin-top: 8px;
    }

    /* Sur mobile, le mixeur reste visible en haut (pas dans la barre fixe) */
    .sc-summary-panel {
        display: flex;
        flex-direction: column;
    }

    .sc-blender-container {
        order: 0;
    }
}

/* Très petits écrans */
@media (max-width: 380px) {
    .sc-items-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .sc-item {
        min-height: 70px;
        padding: 8px 3px;
    }

    .sc-item-emoji {
        font-size: 1.4rem;
    }

    .sc-item-name {
        font-size: 0.68rem;
    }

    .sc-composer {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* Landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .sc-composer {
        padding-bottom: 20px;
    }

    .sc-order-box {
        position: static;
        max-height: none;
        border-radius: var(--sc-radius);
        box-shadow: var(--sc-shadow);
        border: 1px solid var(--sc-border);
    }

    .sc-main {
        grid-template-columns: 1.2fr 1fr;
    }

    .sc-summary-panel {
        order: 0;
        position: sticky;
        top: 10px;
    }

    .sc-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
}
