/* ==========================================================================
   Chef Companion v1.2 - Widget Contextual + Proactive Elements
   ========================================================================== */

/* Container principal */
.chef-companion {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Buton toggle (bubble) */
.chef-companion__toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #2d6a30;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.chef-companion__toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.chef-companion__icon {
    font-size: 26px;
    line-height: 1;
}

/* Badge notificare */
.chef-companion__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e63946;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Panel principal */
.chef-companion__panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    max-height: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: chefSlideUp 0.25s ease-out;
}

@keyframes chefSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header panel */
.chef-companion__header {
    background: #2d6a30;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chef-companion__title {
    font-weight: 600;
    font-size: 15px;
}

.chef-companion__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.chef-companion__close:hover {
    opacity: 1;
}

/* Body panel */
.chef-companion__body {
    padding: 16px;
    overflow-y: auto;
    max-height: 340px;
}

/* Mesaj principal */
.chef-companion__message {
    margin-bottom: 12px;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

.chef-companion__message strong {
    color: #2d6a30;
}

/* Sugestie produs */
.chef-companion__suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9f8;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: background 0.15s;
    cursor: pointer;
}

.chef-companion__suggestion:hover {
    background: #eef5ee;
}

.chef-companion__suggestion-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.chef-companion__suggestion-price {
    font-size: 13px;
    font-weight: 700;
    color: #2d6a30;
    white-space: nowrap;
}

/* Buton actiune */
.chef-companion__action {
    display: block;
    width: 100%;
    padding: 10px 16px;
    margin-top: 8px;
    background: #2d6a30;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
    box-sizing: border-box;
}

.chef-companion__action:hover {
    background: #245524;
    color: #fff;
}

.chef-companion__action--secondary {
    background: #f0f0f0;
    color: #333;
}

.chef-companion__action--secondary:hover {
    background: #e0e0e0;
    color: #333;
}

/* Bara progres livrare gratuita (in panel) */
.chef-companion__progress {
    margin-bottom: 12px;
}

.chef-companion__progress-bar {
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.chef-companion__progress-fill {
    height: 100%;
    background: #2d6a30;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.chef-companion__progress-text {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Separator */
.chef-companion__divider {
    height: 1px;
    background: #eee;
    margin: 12px 0;
}

/* ==========================================================================
   TOOLTIP (mesaj pe bubble, fara click)
   ========================================================================== */

.chef-companion__tooltip {
    position: absolute;
    bottom: 66px;
    right: 0;
    background: #fff;
    color: #333;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
    font-size: 13px;
    max-width: 260px;
    line-height: 1.4;
    animation: chefFadeIn 0.3s ease-out 0.5s both;
    cursor: pointer;
}

.chef-companion__tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 22px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

.chef-companion__tooltip-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    font-size: 14px;
    color: #999;
    cursor: pointer;
    padding: 0;
}

.chef-companion__tooltip-text {
    font-size: 13px;
    line-height: 1.4;
    color: #333;
}

.chef-companion__tooltip-text strong {
    color: #2d6a30;
}

@keyframes chefFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Rich tooltip: cu miniatura produs */
.chef-companion__tooltip--rich {
    max-width: 280px;
    padding: 12px;
}

.chef-companion__mini-product {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    background: #f8f9f8;
    border-radius: 8px;
}

.chef-companion__mini-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.chef-companion__mini-info {
    flex: 1;
    min-width: 0;
}

.chef-companion__mini-name {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chef-companion__mini-price {
    font-size: 12px;
    font-weight: 700;
    color: #2d6a30;
}

.chef-companion__mini-add {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #2d6a30;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    line-height: 1;
}

.chef-companion__mini-add:hover {
    background: #245524;
}

/* ==========================================================================
   STICKY PROGRESS BAR (persistent, bottom of page)
   ========================================================================== */

.chef-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chef-sticky-bar--visible {
    transform: translateY(0);
}

.chef-sticky-bar--complete {
    background: #f0faf0;
    border-top-color: #2d6a30;
}

.chef-sticky-bar__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.chef-sticky-bar__icon {
    font-size: 16px;
    flex-shrink: 0;
}

.chef-sticky-bar__text {
    font-size: 13px;
    color: #333;
    flex-shrink: 0;
}

.chef-sticky-bar__text strong {
    color: #2d6a30;
}

.chef-sticky-bar__track {
    flex: 1;
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}

.chef-sticky-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, #2d6a30, #4a9e4e);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.chef-sticky-bar__close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.chef-sticky-bar__close:hover {
    color: #333;
}

/* ==========================================================================
   AMBIENT NARRATIVE BAR (sub header, contextual)
   ========================================================================== */

.chef-ambient {
    width: 100%;
    background: linear-gradient(135deg, #f0faf0 0%, #e8f5e8 100%) !important;
    border-bottom: 1px solid #d4e8d4;
    overflow: hidden !important;
    max-height: 0 !important;
    opacity: 0 !important;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 999;
    position: relative;
}

.chef-ambient.chef-ambient--visible {
    max-height: 80px !important;
    opacity: 1 !important;
}

.chef-ambient__inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.chef-ambient__text {
    flex: 1;
    font-size: 13px;
    color: #2d5a2d;
}

.chef-ambient__cta {
    font-size: 13px;
    font-weight: 600;
    color: #2d6a30;
    text-decoration: none;
    white-space: nowrap;
    padding: 4px 12px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #2d6a30;
    transition: background 0.15s;
}

.chef-ambient__cta:hover {
    background: #2d6a30;
    color: #fff;
}

.chef-ambient__close {
    background: none;
    border: none;
    font-size: 16px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.chef-ambient__close:hover {
    color: #333;
}

/* ==========================================================================
   SCROLL-TRIGGERED NUDGE (lateral, discret)
   ========================================================================== */

.chef-scroll-nudge {
    position: fixed;
    bottom: 90px;
    left: 20px;
    z-index: 99997;
    transform: translateX(-120%);
    transition: transform 0.35s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chef-scroll-nudge--visible {
    transform: translateX(0);
}

.chef-scroll-nudge__inner {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 300px;
    border-left: 3px solid #2d6a30;
}

.chef-scroll-nudge__text {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.chef-scroll-nudge__link {
    font-size: 13px;
    font-weight: 600;
    color: #2d6a30;
    text-decoration: none;
    white-space: nowrap;
}

.chef-scroll-nudge__link:hover {
    text-decoration: underline;
}

.chef-scroll-nudge__close {
    background: none;
    border: none;
    font-size: 16px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.chef-scroll-nudge__close:hover {
    color: #333;
}

/* ==========================================================================
   MINIMIZED STATE
   ========================================================================== */

.chef-companion--minimized .chef-companion__panel,
.chef-companion--minimized .chef-companion__tooltip {
    display: none !important;
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    /* Widget bubble */
    .chef-companion {
        bottom: 80px;
        right: 12px;
    }

    .chef-companion__toggle {
        width: 48px;
        height: 48px;
    }

    .chef-companion__icon {
        font-size: 22px;
    }

    .chef-companion__panel {
        position: fixed;
        width: calc(100vw - 24px);
        right: 12px;
        left: 12px;
        bottom: 140px;
        max-height: 60vh;
        border-radius: 14px;
    }

    .chef-companion__body {
        max-height: 50vh;
        padding: 14px;
    }

    .chef-companion__tooltip {
        max-width: calc(100vw - 80px);
        right: 0;
        font-size: 13px;
    }

    .chef-companion__tooltip--rich {
        max-width: calc(100vw - 80px);
    }

    /* Sticky bar mobile */
    .chef-sticky-bar__inner {
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 6px;
    }

    .chef-sticky-bar__text {
        font-size: 12px;
    }

    .chef-sticky-bar__track {
        width: 100%;
        order: 3;
    }

    /* Ambient bar mobile */
    .chef-ambient.chef-ambient--visible {
        max-height: 100px !important;
    }

    .chef-ambient__inner {
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 6px;
    }

    .chef-ambient__text {
        font-size: 12px;
        flex-basis: calc(100% - 30px);
    }

    .chef-ambient__cta {
        font-size: 12px;
    }

    /* Scroll nudge mobile: vine de jos, nu de stanga */
    .chef-scroll-nudge {
        left: 12px;
        right: 12px;
        bottom: 80px;
        transform: translateY(120%);
    }

    .chef-scroll-nudge--visible {
        transform: translateY(0);
    }

    .chef-scroll-nudge__inner {
        max-width: 100%;
    }
}

/* Extra small (iPhone SE) */
@media (max-width: 375px) {
    .chef-companion {
        bottom: 74px;
        right: 8px;
    }

    .chef-companion__panel {
        right: 8px;
        left: 8px;
        bottom: 130px;
    }

    .chef-scroll-nudge {
        left: 8px;
        right: 8px;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .chef-companion__panel {
        width: 300px;
    }
}
