/* === GRID === */
.wcrm-products-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@media screen and (min-width: 600px) and (max-width: 1024px) {
    .wcrm-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media screen and (min-width: 1025px) {
    .wcrm-products-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 20px;
    }
}

/* === ПРОДУКТИ === */
.wcrm-product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

.wcrm-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.wcrm-out-of-stock { opacity: 0.7; }
.wcrm-out-of-stock .wcrm-product-title,
.wcrm-out-of-stock .wcrm-product-description { text-decoration: line-through; }

.wcrm-out-of-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 5;
}

.wcrm-out-of-stock-btn {
    background: #bdc3c7 !important;
    cursor: not-allowed !important;
    opacity: 0.8;
}

.wcrm-product-image {
    width: 100%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.wcrm-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wcrm-product-card:hover .wcrm-product-image img {
    transform: scale(1.05);
}

.wcrm-product-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.wcrm-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
    word-wrap: break-word;
}

.wcrm-product-price {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px 0;
}

.wcrm-product-description {
    font-size: 13px;
    line-height: 1.4;
    margin: 0 0 15px 0;
    flex-grow: 1;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wcrm-product-actions { text-align: center; margin-top: auto; }
.wcrm-product-actions .button {
    display: inline-block;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 22px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

.wcrm-product-actions .button.loading { opacity: 0.7; pointer-events: none; }
.wcrm-product-actions .button.added { background: #2ecc71 !important; }

/* Описание с бутон "още" */
.wcrm-product-description {
    font-size: 13px;
    line-height: 1.4;
    margin: 5px 0 10px 0;
    color: #666;
    word-wrap: break-word;
}

.wcrm-desc-short,
.wcrm-desc-full {
    display: inline;
}

.wcrm-desc-full {
    display: block;
    margin-top: 5px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wcrm-read-more {
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 3px;
    font-size: 12px;
    user-select: none;
}

.wcrm-read-more:hover {
    opacity: 0.8;
}

.wcrm-read-more.less {
    display: block;
    margin-top: 8px;
    margin-left: 0;
    text-align: right;
}

/* === КАТЕГОРИИ - Основни стилове (ще се презаписват от динамичния CSS) === */
.wcrm-category-filter {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    cursor: grab;
}

/* Placeholder-ът е оставен за backward-compat / sticky експерименти,
   но не трябва да влияе на подравняването на бутоните. */
.wcrm-category-filter-placeholder {
    display: none;
}

.wcrm-category-filter::-webkit-scrollbar { display: none; }
.wcrm-category-filter:active { cursor: grabbing; }

.wcrm-category-btn {
    flex: 0 0 auto;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    min-width: fit-content;
    user-select: none;
    font-family: inherit;
}

/* === КОНТЕЙНЕР === */
.wcrm-restaurant-menu-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    border-radius: 10px;
}

/* === МОБИЛНИ === */
@media screen and (max-width: 375px) {
    .wcrm-products-grid { gap: 12px; }
    .wcrm-product-image { height: 140px; }
    .wcrm-product-content { padding: 12px; }
    .wcrm-product-title { font-size: 14px; }
    .wcrm-product-price { font-size: 16px; }
    .wcrm-product-description { font-size: 12px; -webkit-line-clamp: 2; }
    .wcrm-restaurant-menu-wrapper { padding: 12px; }
}

@media screen and (min-width: 376px) and (max-width: 768px) {
    .wcrm-product-image {  }
    .wcrm-restaurant-menu-wrapper { padding: 15px; }
}

/* === ДЕСКТОП === */
@media screen and (min-width: 769px) {
    .wcrm-category-filter {
        scroll-behavior: smooth;
    }
}
@media screen and (max-width: 375px) {
    .wcrm-product-description {
        font-size: 11px;
        margin: 3px 0 8px 0 !important;
        -webkit-line-clamp: 2;
    }
}
/* Sticky menu fallback */
.wcrm-category-filter {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* За мобилни - по-малък z-index ако има проблеми */
@media screen and (max-width: 768px) {
    .wcrm-category-filter {
        z-index: 999;
    }
}
/* === ДЕЙСТВИЯ (Добави + Коментар) === */
.wcrm-product-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    position: relative;
}

.wcrm-product-actions-row {
    display: flex;
    gap: 8px;
}

.wcrm-product-actions-row .button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
}

/* Вторичен бутон "Коментар" (по подразбиране) */
.wcrm-comment-btn {
    background: transparent !important;
    border: 2px solid rgba(0, 0, 0, 0.18) !important;
}

.wcrm-comment-btn:hover {
    background: rgba(0, 0, 0, 0.06) !important;
}

/* Индикатор, че има въведен коментар */
.wcrm-comment-btn.has-comment {
    position: relative;
}

.wcrm-comment-btn.has-comment::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.9;
}

/* Балон с текстово поле */
.wcrm-comment-popover {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.wcrm-comment-textarea {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.16);
    font-size: 13px;
    line-height: 1.35;
    box-sizing: border-box;
}

.wcrm-comment-popover-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.wcrm-comment-save,
.wcrm-comment-close {
    flex: 1 1 0;
    padding: 8px 10px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.wcrm-comment-close {
    background: rgba(0, 0, 0, 0.06);
}

.wcrm-comment-close:hover {
    background: rgba(0, 0, 0, 0.10);
}

/* Бейдж за бройките в бутона "Добави" */
.wcrm-qty-badge {
    display: none;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(0, 0, 0, 0.18);
}


/* Съобщения при липса на активни категории (по график) */
.wcrm-no-active-category,
.wcrm-no-active-categories {
    text-align: center;
    padding: 18px 12px;
    font-weight: 600;
    opacity: 0.9;
}
