/* ==========================================================================
   MENU GENERATOR TAB STYLES - NewUI Design
   ========================================================================== */

.menu-generator-container {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}



/* Main Content Grid */
.content-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    flex: 1;
    min-height: 0;
}

@media (min-width: 1540px) {
    .content-grid {
        display: grid;
        grid-template-columns: 1fr 400px;
        gap: 30px;
        align-items: start;
        transition: grid-template-columns 0.3s ease;
    }

    .content-grid.expanded {
        grid-template-columns: 1fr 600px;
    }

    .content-grid.expanded .checkbox-item {
        flex: 0 0 calc(33.333% - 14px);
        max-width: calc(33.333% - 14px);
    }
}

/* Generator Panel */
.generator-panel {
    min-width: 0;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 12px 40px rgba(212, 165, 116, 0.12), 0 4px 16px rgba(0,0,0,0.06);
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Date Section */
.date-section {
    margin-bottom: 25px;
}

.date-section h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-section h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #d4a574, #c49464);
    border-radius: 2px;
}

.date-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.date-input:focus {
    outline: none;
    border-color: #d4a574;
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(212, 165, 116, 0.2);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 5px;
    flex-wrap: wrap;
    overflow-x: visible;
}

.category-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    font-size: 0.95rem;
}

.category-tab {
    flex-shrink: 0;
    min-width: fit-content;
}

.category-tab:hover {
    background: rgba(212, 165, 116, 0.1);
    color: #d4a574;
}

.category-tab:focus-visible {
    outline: 3px solid #80562e;
    outline-offset: -3px;
}

.category-tab.active {
    background: linear-gradient(135deg, #d4a574, #c49464);
    color: white;
    box-shadow: 0 -2px 10px rgba(212, 165, 116, 0.3);
}

.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #d4a574, #c49464);
}

/* Category Content */
.category-content {
    flex: 1;
    overflow-y: visible;
    padding-right: 10px;
}

.category-panel {
    display: none;
}

.category-panel.active {
    display: block;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.quick-btn {
    padding: 8px 16px;
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 25px;
    color: #d4a574;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quick-btn:hover {
    background: rgba(212, 165, 116, 0.2);
    border-color: rgba(212, 165, 116, 0.5);
    transform: translateY(-1px);
}

.search-input {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 25px;
    color: #333;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
    min-width: 200px;
}

.search-input:focus {
    border-color: rgba(212, 165, 116, 0.6);
    box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.1);
}

.search-input::placeholder {
    color: #999;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    /* Removed max-height and overflow to allow natural content flow */
    padding-top: 10px;
    padding-left: 5px;
}

/* Override styles for regular menu generator */
#menu-generator .checkbox-group,
.menu-generator-container .checkbox-group {
    max-height: none !important;
    overflow-y: visible !important;
    height: auto !important;
    flex: none !important;
}

.checkbox-item {
    flex: 0 0 calc(25% - 15px);
    max-width: calc(25% - 15px);
    min-height: 120px;
    position: relative;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(212, 165, 116, 0.06), 0 1px 3px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.checkbox-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.1), transparent);
    transition: left 0.6s;
    /* Този слой е чиста декорация и покрива цялата карта. Без pointer-events:none
       той краде hit-test-а, докато се плъзга - бутонът под курсора губи :hover,
       вдига се обратно, hover-ът се връща и така в кръг. Точно това се вижда
       като трептене, когато посочиш бутон. */
    pointer-events: none;
}

.checkbox-item:hover::before {
    left: 100%;
}

.checkbox-item:hover {
    transform: translateY(-2px) scale(1.005);
    border-color: #d4a574;
    box-shadow: 0 8px 24px rgba(212, 165, 116, 0.15), 0 3px 8px rgba(0,0,0,0.06);
    overflow: visible;
}

.checkbox-item.selected {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.1), rgba(196, 148, 100, 0.1));
    border-color: #d4a574;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(212, 165, 116, 0.22), 0 3px 10px rgba(0,0,0,0.06);
}

.checkbox-item.selected::after {
    content: '✓';
    position: absolute;
    /* Значката също е декорация - да не поема кликове. */
    pointer-events: none;
    top: 10px;
    right: 15px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #d4a574, #c49464);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    animation: checkmark 0.6s ease-out;
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkbox-item-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-item-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 4px;
}

.checkbox-item.selected .checkbox-item-title {
    color: #d4a574;
}

.checkbox-item-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #64748b;
}

.checkbox-item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.checkbox-item-meta span::before {
    content: '';
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.6;
}

/* Currency price styling */
.checkbox-item-meta .price-primary {
    font-weight: 700;
    font-size: 0.95rem;
    color: #d4a574;
}

.checkbox-item-meta .price-secondary {
    font-weight: 500;
    color: #94a3b8;
}

.checkbox-item.selected .checkbox-item-meta .price-primary {
    color: #c49464;
}

/* Remove bullet points from price spans */
.checkbox-item-meta .price-primary::before,
.checkbox-item-meta .price-secondary::before {
    display: none;
}

/* Checkmark animation */
@keyframes checkmark {
    0% {
        transform: scale(0) rotate(45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(45deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(45deg);
        opacity: 1;
    }
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px 0;
}

.pagination-btn {
    padding: 8px 16px;
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 8px;
    color: #d4a574;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    background: rgba(212, 165, 116, 0.2);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pagination-info {
    color: #64748b;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Preview Panel */
.preview-panel {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 12px 40px rgba(212, 165, 116, 0.12), 0 4px 16px rgba(0,0,0,0.06);
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.preview-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.preview-header-top {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
    position: relative;
    transition: all 0.3s ease;
}

/* Compact mode - when toggle is OFF, show date below title */
.preview-header.compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.preview-header.compact .preview-header-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
}

.preview-header.compact .onoffswitch {
    order: 1;
    flex-shrink: 0;
}

.preview-header.compact .preview-header-top h2 {
    order: 2;
    margin: 0;
    flex-grow: 0;
}

.preview-header.compact .preview-date {
    order: 3;
    margin-top: 0;
    text-align: center;
    width: 100%;
}

.preview-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
}

.preview-date {
    color: #64748b;
    font-weight: 500;
    font-size: 0.95rem;
}

/* Toggle Switch Styles */
.onoffswitch {
    position: relative;
    width: 60px;
    user-select: none;
    margin-right: 12px;
}

.onoffswitch-checkbox {
    display: none;
}

.onoffswitch-label {
    display: block;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #999999;
    border-radius: 20px;
}

.onoffswitch-inner {
    width: 200%;
    margin-left: -100%;
    transition: margin 0.3s ease-in 0s;
}

.onoffswitch-inner:before,
.onoffswitch-inner:after {
    float: left;
    width: 50%;
    height: 20px;
    padding: 0;
    line-height: 20px;
    font-size: 10px;
    color: white;
    font-family: Trebuchet, Arial, sans-serif;
    font-weight: bold;
    box-sizing: border-box;
}

.onoffswitch-inner:before {
    content: "ON";
    padding-left: 6px;
    background-color: #212f33;
    color: #ffffff;
}

.onoffswitch-inner:after {
    content: "OFF";
    padding-right: 6px;
    background-color: #eeeeee;
    color: #999999;
    text-align: right;
}

.onoffswitch-switch {
    width: 12px;
    margin: 4px;
    background: #ffffff;
    border: 2px solid #271616;
    border-radius: 20px;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 36px;
    transition: all 0.3s ease-in 0s;
}

.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
    margin-left: 0;
}

.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
    right: 0px;
}

/* Menu Sections */
.menu-section {
    margin-bottom: 25px;
}

.menu-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #d4a574;
    margin-bottom: 15px;
    padding: 12px 16px;
    background: rgba(212, 165, 116, 0.1);
    border-radius: 8px;
    border-left: 4px solid #d4a574;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-section h3 .drag-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: normal;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    padding: 12px 16px;
    background: rgba(212, 165, 116, 0.05);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: move;
    position: relative;
}

.menu-item:hover {
    background: rgba(212, 165, 116, 0.1);
    border-color: rgba(212, 165, 116, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.15);
}

.menu-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.menu-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.4;
}

.menu-item-remove {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
}

.menu-item:hover .menu-item-remove {
    opacity: 1;
}

.menu-item-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Drop Zone */
.drop-zone {
    padding: 20px;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    text-align: center;
    color: #64748b;
    font-style: italic;
    transition: all 0.3s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone.drag-over {
    border-color: #d4a574;
    background: rgba(212, 165, 116, 0.1);
    color: #d4a574;
}

.drop-zone:empty::before {
    content: "Няма избрани артикули";
}

/* Menu Summary */
.menu-summary {
    background: rgba(212, 165, 116, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid #d4a574;
}

.menu-summary h4 {
    color: #d4a574;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.summary-item:last-child {
    margin-bottom: 0;
}

.summary-label {
    color: #64748b;
    font-weight: 500;
}

.summary-value {
    color: #1e293b;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #cbd5e1;
}

.empty-state p {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.empty-state small {
    font-size: 0.9rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 16px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #f1f5f9;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn,
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    min-width: 170px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.action-btn::before,
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before,
.btn:hover::before {
    left: 100%;
}

.action-btn i,
.btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.action-btn:hover i,
.btn:hover i {
    transform: scale(1.1);
}

.action-btn:disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #d4a574, #c49464);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #c49464, #b48454);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(212, 165, 116, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #e2a364, #d4956b);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(226, 163, 100, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #d4956b, #c6875d);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(226, 163, 100, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #a8956b, #9a8760);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(168, 149, 107, 0.2);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #9a8760, #8c7955);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(168, 149, 107, 0.4);
}

.btn-facebook {
    background: linear-gradient(135deg, #4267B2, #365899);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(66, 103, 178, 0.2);
}

.btn-facebook:hover:not(:disabled) {
    background: linear-gradient(135deg, #365899, #2d4373);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(66, 103, 178, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #a7c7e7, #8fb3d9);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(167, 199, 231, 0.2);
}

.btn-info:hover:not(:disabled) {
    background: linear-gradient(135deg, #8fb3d9, #7aa1c8);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(167, 199, 231, 0.4);
}

/* Copied state for copy button */
.btn-copied {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    border-color: #059669 !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3) !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

/* Копира се: реакция веднага при натискане, докато текстът се сглобява
   (до него има заявки към базата и иначе бутонът изглежда мъртъв). */
.btn-copying {
    opacity: 0.85;
    cursor: progress;
}

/* Error state for copy button */
.btn-error {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: white !important;
    border-color: #dc2626 !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.action-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 2px solid rgba(239, 68, 68, 0.3);
}

.action-btn.danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

/* Export Modal */
.export-modal h3 {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-weight: 700;
}

.export-modal p {
    margin: 0 0 20px 0;
    color: #64748b;
}

.export-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    text-align: center;
    border: 2px solid rgba(212, 165, 116, 0.3);
    border-radius: 12px;
    background: rgba(212, 165, 116, 0.05);
    color: #d4a574;
    transition: all 0.3s ease;
    cursor: pointer;
}

.export-option:hover {
    border-color: #d4a574;
    background: rgba(212, 165, 116, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.2);
}

.export-option i {
    font-size: 1.5rem;
}



/* Responsive Design */
@media (max-width: 1539px) {
    .onoffswitch {
        display: none;
    }
}

@media (max-width: 1399px) {
    .content-grid {
        gap: 25px;
    }

    .generator-panel, .preview-panel {
        padding: 25px;
    }
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .preview-panel {
        position: static;
        max-height: none;
    }

    .generator-panel, .preview-panel {
        padding: 20px;
        border-radius: 15px;
    }
}

@media (max-width: 940px) {
    .checkbox-item-meta {
        display: block;
    }

    .checkbox-item-meta span {
        display: block;
        margin-bottom: 2px;
    }

    .checkbox-item-meta span::before {
        display: none;
    }
}

@media (max-width: 768px) {
    .tab-header h2 {
        font-size: 1.5rem;
    }

    .category-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        max-width: 100%;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
        padding-bottom: 8px;
        margin-bottom: 12px;
        gap: 5px;
    }

    .category-tab {
        padding: 6px 9px;
        font-size: 0.9rem;
        min-height: 44px;
    }



    .search-input {
        min-width: auto;
    }

    .checkbox-item {
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px);
        padding: 15px;
        min-height: 29px;
    }

    .checkbox-group {
        gap: 10px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-btn,
    .btn {
        min-width: auto;
    }

    .export-options {
        grid-template-columns: 1fr;
    }

    .preview-header h2 {
        font-size: 1.4rem;
        position: static;
        transform: none;
        text-align: center;
    }

    .preview-header-top {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .preview-date {
        font-size: 0.8rem;
    }
}

@media (max-width: 560px) {
    .checkbox-item {
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .generator-panel,
    .preview-panel {
        padding: 15px;
        border-radius: 12px;
    }

    .tab-header h2 {
        font-size: 1.3rem;
    }

    .category-tab {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .checkbox-item {
        flex: 0 0 calc(50% - 5px);
        max-width: calc(50% - 5px);
        padding: 12px;
        min-height: 110px;
    }

    .action-btn,
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .preview-header h2 {
        font-size: 1.2rem;
        position: static;
        transform: none;
        text-align: center;
    }

    .preview-header-top {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
}



/* Animation for preview panel */
.generator-panel, .preview-panel {
    animation: fadeInUp 0.6s ease-out;
}

.preview-panel {
    animation-delay: 0.2s;
}

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

/* ==========================================================================
   GRID BUILDER STYLES (Advanced Layout Builder)
   ========================================================================== */

/* Grid Canvas */
#gridCanvas {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
}

/* Grid Row */
.grid-row {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    position: relative;
    transition: all 0.3s ease;
}

.grid-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 16px rgba(212, 165, 116, 0.1);
}

/* Row Controls */
.row-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.row-controls button {
    padding: 6px 10px;
    font-size: 11px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    color: white;
    background: #ef4444;
}

.row-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Grid Cell (Category Card) */
.grid-cell {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.1), rgba(196, 148, 100, 0.05));
    border: 2px solid #d4a574;
    border-radius: 10px;
    padding: 16px;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(212, 165, 116, 0.15);
}

.grid-cell:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(212, 165, 116, 0.25);
    border-color: #c49464;
}

.grid-cell:active {
    cursor: grabbing;
}

/* Dragging State */
.grid-cell.dragging {
    opacity: 0.5;
    transform: scale(0.95) rotate(3deg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

/* Cell Header */
.cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(212, 165, 116, 0.3);
}

.cell-title {
    font-weight: 700;
    color: #d4a574;
    font-size: 14px;
}

.cell-span-badge {
    background: #d4a574;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.cell-item-count {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

/* Empty Drop Zone */
.empty-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.empty-drop-zone:hover {
    border-color: #d4a574;
    background: rgba(212, 165, 116, 0.05);
    color: #d4a574;
}

.empty-drop-zone.drop-target {
    border-color: #d4a574;
    background: rgba(212, 165, 116, 0.15);
    color: #d4a574;
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(212, 165, 116, 0.2);
}

/* Preview Item Selection */
.preview-item {
    cursor: pointer !important;
    transition: all 0.2s ease;
}

.preview-item:hover {
    background: rgba(212, 165, 116, 0.08) !important;
}

.preview-item:focus,
.preview-item.selected {
    outline: 2px solid #d4a574 !important;
    outline-offset: -2px;
    background: rgba(212, 165, 116, 0.12) !important;
}

/* Drag Over States */
.grid-cell.drag-over {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    transform: scale(1.05);
}

.drop-target {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Smooth Transitions */
* {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ==========================================================================
   ЛЕНТА С ОБЕКТИ (multi_venue)
   Показва се само когато организацията има конфигурирани обекти - при всички
   останали таб-контейнерът стои с [hidden] и не заема място.
   ========================================================================== */
.venue-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.venue-bar[hidden],
.venue-warning[hidden] {
    display: none !important;
}

.venue-bar-label {
    font-weight: 600;
    color: #64748b;
    font-size: 0.9rem;
    margin-right: 4px;
}

.venue-tab {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.venue-tab:hover {
    background: rgba(212, 165, 116, 0.12);
    border-color: #d4a574;
    color: #b8874f;
}

.venue-tab.active {
    background: linear-gradient(135deg, #d4a574, #c49464);
    border-color: #c49464;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(212, 165, 116, 0.35);
}

/* Предупреждение при разминаване в категорийния подпис на обекта. */
.venue-warning {
    margin-top: 10px;
    padding: 10px 14px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    color: #92400e;
    font-size: 0.88rem;
    line-height: 1.45;
}

/* Кабърче пред артикул, който идва от постоянния набор на обекта.
   `.menu-item-content` е flex със `space-between` - без това кабърчето и
   текстът стават два отделни flex елемента и отиват в двата края на реда. */
.menu-item-content.has-venue-mark {
    justify-content: flex-start;
    gap: 6px;
}

.venue-fixed-mark {
    color: #d4a574;
    font-size: 0.75rem;
    margin-right: 2px;
    opacity: 0.85;
}

/* ==========================================================================
   ПЛАВАЩА ЛЕНТА ЗА ЕКСПОРТ
   Появява се само когато истинските бутони са извън екрана.
   ========================================================================== */
.export-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.1);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    transform: translateY(110%);
    transition: transform 0.22s ease;
}

.export-dock[hidden] { display: none !important; }
.export-dock.visible { transform: translateY(0); }

.export-dock-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    max-width: 1400px;
    margin: 0 auto;
}

.export-dock-venues,
.export-dock-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.export-dock-venues { padding-right: 10px; border-right: 1px solid #e2e8f0; }
.export-dock-venues:empty { display: none; }

.export-dock-venue {
    padding: 6px 13px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
}

.export-dock-venue:hover { border-color: #d4a574; color: #b8874f; }

.export-dock-venue.active {
    background: linear-gradient(135deg, #d4a574, #c49464);
    border-color: #c49464;
    color: #ffffff;
}

/* Компактни бутони - лентата не бива да изяжда половин екран. */
.export-dock .btn.export-dock-btn {
    padding: 9px 15px;
    font-size: 0.86rem;
    margin: 0;
    box-shadow: none;
}

.export-dock .btn.export-dock-btn:disabled { opacity: 0.45; }

/* На телефон и таблет долу вече има навигация (`.bottom-nav`,
   видима до 1023px) - лентата стои НАД нея, а не върху нея. */
@media (max-width: 1023px) {
    .export-dock {
        bottom: 88px;
        padding: 8px 12px;
    }

    .export-dock-inner { gap: 6px; }
    .export-dock-venues { padding-right: 8px; }
    .export-dock .btn.export-dock-btn { padding: 8px 12px; font-size: 0.8rem; }
    .export-dock-venue { padding: 5px 11px; font-size: 0.8rem; }
}

/* На телефон широките бутони изяждаха около една трета от екрана -
   четири бутона на по цял ред. Тук са в решетка по 3 на ред, а чиповете
   на обектите са на един ред, който се плъзга настрани, вместо да се пренася. */
@media (max-width: 767px) {
    .export-dock {
        padding: 6px 10px;
        border-radius: 14px 14px 0 0;
    }

    .export-dock-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }

    .export-dock-venues {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 0 1px;
        border-right: none;
    }

    .export-dock-venues::-webkit-scrollbar { display: none; }

    .export-dock-venue {
        flex: 0 0 auto;
        padding: 4px 10px;
        font-size: 0.74rem;
    }

    .export-dock-buttons {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
        width: 100%;
    }

    .export-dock .btn.export-dock-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 0;
        padding: 8px 4px;
        font-size: 0.7rem;
        line-height: 1.15;
        border-radius: 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .export-dock .btn.export-dock-btn i {
        font-size: 0.72rem;
        flex-shrink: 0;
    }
}

/* Етикетът се свива с многоточие, а не се реже от двата края. */
.export-dock-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Много тесни телефони - по 2 на ред, иначе текстът се реже веднага. */
@media (max-width: 359px) {
    .export-dock-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
