/* furniture.css - Стили для страницы выбора мебели */

/* Предотвращение отображения точек и других псевдоэлементов у кнопок */
button::after,
button::before,
.furniture-item::after,
.furniture-item::before,
.select-btn::after,
.select-btn::before {
    content: none !important;
    display: none !important;
}

/* Стили для кнопки очистки выбора */
#clearSelectionBtn {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 400;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

#clearSelectionBtn:hover {
    text-decoration: underline;
    opacity: 0.9;
}

html.dark-theme #clearSelectionBtn {
    color: #a1a1aa;
}

html.dark-theme #clearSelectionBtn:hover {
    color: #ef4444;
}

html:not(.dark-theme) #clearSelectionBtn {
    color: #71717a;
}

html:not(.dark-theme) #clearSelectionBtn:hover {
    color: #ef4444;
}

/* Улучшение контрастности для темной темы */
html.dark-theme .furniture-item {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

html.dark-theme #selectFileBtn {
    color: #ffffff !important;
    font-weight: 500;
}

html.dark-theme .select-btn {
    color: #ffffff !important;
    font-weight: 600;
}

html.dark-theme .item-label,
html.dark-theme .item-price {
    color: #f3f4f6 !important;
}

/* Стили для вкладок фурнитуры в светлой теме */
html:not(.dark-theme) .furniture-item {
    border: 2px solid #d1d5db;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

html:not(.dark-theme) .furniture-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

html:not(.dark-theme) .furniture-item.selected {
    border-color: #3b82f6;
    background-color: #f0f9ff;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.25);
}

/* Стили для выбранных товаров на светлой теме */
html:not(.dark-theme) .selected-item {
    background: #f0f9ff;
    border: 1px solid #bfdbfe;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

html:not(.dark-theme) .selected-item .item-label,
html:not(.dark-theme) .selected-item .price,
html:not(.dark-theme) .selected-item .item-price {
    color: #1e3a8a;
}

/* Стили для блоков выбранных товаров */
.selected-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: rgba(45, 55, 72, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.2rem 1.5rem 1.5rem;
    margin: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    width: 200px;
    height: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.selected-item img {
    width: 160px;
    height: 160px;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    background: transparent;
    box-shadow: none;
    border: none;
}

.selected-item .item-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-text, #fff);
    margin-bottom: 0.7rem;
    text-align: center;
    line-height: 1.2;
    width: 100%;
    word-break: break-word;
    max-height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.selected-item .price {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-text, #fff);
    margin-bottom: 1rem;
    text-align: center;
}

.selected-item .select-btn {
    width: 100%;
    padding: 0.6rem 0;
    border-radius: 10px;
    font-size: 1rem;
    background: var(--accent-color, #3b82f6);
    color: #fff;
    border: none;
    text-align: center;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.selected-item .select-btn:hover {
    background: var(--primary-hover, #2563eb);
}

#selectedFurnitureSquare {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    justify-content: center;
    margin-top: 1.5rem;
    width: 100%;
    max-width: 100%;
    padding-top: 1rem;
    border-top: 1px solid rgba(209, 213, 219, 0.5);
    position: relative;
    z-index: 10;
}

/* Стили для карточек фурнитуры в гриде */
.furniture-grid-cards {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.8rem 1.5rem 1.2rem;
    align-items: flex-start;
    justify-content: center;
}

.furniture-carousel-card {
    flex: 0 0 auto;
    width: 180px;
    background: var(--card-bg, #2d3748);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    transition: transform 0.2s;
}

.furniture-carousel-card:hover {
    transform: translateY(-2px);
}

.furniture-carousel-card img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    margin-bottom: 0.8rem;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.furniture-carousel-card .item-label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    text-align: center;
    word-break: break-word;
    max-height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.furniture-carousel-card .item-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-text, #fff);
    margin-bottom: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Стили для выбора комнаты */
.furniture-room-section {
    margin-top: 1.5rem;
    width: 100%;
}

/* Стили для квадратов с мебелью */
.furniture-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg, #2d3748);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 160px;
    height: 160px;
    min-width: 160px;
    min-height: 160px;
    text-align: center;
    border: 2px solid transparent;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.3;
    word-wrap: break-word;
    position: relative;
    word-break: break-word;
}

.furniture-item:hover {
    border-color: var(--accent-color, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
}

.furniture-item.selected {
    border-color: var(--accent-color, #3b82f6);
    background: rgba(59, 130, 246, 0.15);
}

.furniture-item.expanded {
    width: 100%;
    max-width: 700px;
    height: auto;
    min-height: 100px;
    cursor: default;
    z-index: 5;
    overflow: visible;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.25);
    background-color: var(--card-bg, #2d3748);
    border-color: var(--accent-color, #3b82f6);
    position: relative;
    transform: none;
    left: auto;
    margin: 1rem auto 2rem auto;
}

/* Стили для наложения при расширении карточки */
#furnitureExpandOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

#furnitureExpandOverlay.active {
    display: flex;
}

.close-expand {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-expand:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Стилизация горизонтального скролла */
.furniture-grid-cards::-webkit-scrollbar {
    height: 8px;
}

.furniture-grid-cards::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.furniture-grid-cards::-webkit-scrollbar-thumb {
    background-color: var(--accent-color, #3b82f6);
    border-radius: 4px;
}

/* Контейнер для отображения списка мебели */
#furnitureListContainer {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}

.furniture-room-section .flex {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

/* Стиль для сообщения о пустом выборе */
.empty-selection-message {
    width: 100%;
    text-align: center;
    color: var(--secondary-text, #9ca3af);
    font-style: italic;
    padding: 1.5rem;
    background: rgba(45, 55, 72, 0.3);
    border-radius: 12px;
    margin: 0.5rem;
}

/* Стили для расширенного контента */
.expanded-content {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 5;
}

/* Улучшенные стили для кнопок фурнитуры */
.furniture-item {
    transition: all 0.2s ease;
}

.furniture-item.active {
    border-color: var(--accent-color, #3b82f6);
    background-color: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
    position: relative;
}

html.dark-theme .furniture-item.active {
    border-color: var(--accent-color, #3b82f6);
    background-color: rgba(59, 130, 246, 0.25);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Индикатор активной категории */
.furniture-item.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--accent-color, #3b82f6);
    display: block;
}

/* Стили для секции результатов поиска */
#furnitureSearchResults {
    overflow: hidden;
    transition: all 0.3s ease;
    max-height: 700px;
    opacity: 1;
}

#furnitureSearchResults.hidden {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}

/* Стиль для заголовка результатов в темной теме */
html.dark-theme #furnitureResultsTitle {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#furnitureSearchResults .furniture-grid-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.5rem 0;
    justify-content: center;
    max-height: 600px;
    overflow-y: auto;
}

/* Стили для карточек результатов фурнитуры */
.furniture-result-card {
    flex: 0 0 auto;
    width: 180px;
    background: var(--card-bg, #fff);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

html.dark-theme .furniture-result-card {
    background: var(--card-bg, #2d3748);
    border-color: rgba(255, 255, 255, 0.1);
}

.furniture-result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.furniture-result-card img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    margin-bottom: 0.8rem;
}

/* Добавляем стили для названия и цены в карточках результатов */
.furniture-result-card .item-label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-align: center;
    word-break: break-word;
    max-height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    width: 100%;
}

.furniture-result-card .item-price {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}