/* Main Furniture Panel Layout */
/* #panel-furniture style removed to prevent ID override of hidden state. 
   Relies on .main-tab-content.active instead. */

/* Ensure parent containers allow full height */
.main-tab-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0 !important;
    /* Remove default padding to allow edge-to-edge */
}

/* --- New Furniture UI Styles --- */

/* Level 1: Horizontal Bar */
.level1-bar {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 25px;
    padding: 8px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    scrollbar-width: thin;
    flex-shrink: 0;
}

/* ... (Keep scrollbar styles) ... */
.level1-bar::-webkit-scrollbar {
    height: 4px;
}

.level1-bar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* Button Styles */
/* Button Styles */
.level1-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    width: 60px;
    /* Width to contain text */
}

.level1-btn {
    padding: 8px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 50%;
    width: 32px;
    /* Set to match Level 2 (32px) */
    height: 32px;
    font-size: 8px;
    color: #555;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.level1-item:hover .level1-btn {
    background: #eee;
    border-color: #bbb;
}

.level1-item.active .level1-btn {
    background: #f0f0f0;
    color: #000;
    border-color: #777;
    box-shadow: 0 0 0 2px #777 inset;
}

.level1-label {
    font-size: 12px;
    font-weight: bold;
    color: #555;
    text-align: center;
    line-height: 1.1;
    max-width: 100%;
    word-wrap: break-word;
}

.level1-item.active .level1-label {
    color: #000;
}

.level1-btn .level-icon-img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.level1-btn .material-icons {
    font-size: 16px;
}

/* Level 2: Horizontal Slider with Nav Buttons */
.level2-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 2px 0;
    flex-shrink: 0;
}

/* ... (Keep L2 styles) ... */
.level2-nav-btn {
    flex: 0 0 20px;
    height: 100%;
    min-height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.2s;
    z-index: 1;
}

.level2-nav-btn:hover {
    background: #f5f5f5;
    color: #000;
}

.level2-slider {
    flex: 1;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 12px;
    padding: 6px 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.level2-slider::-webkit-scrollbar {
    display: none;
}

.level2-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.level2-item:hover {
    opacity: 1;
}

.level2-item.active {
    opacity: 1;
}

.level2-item.active .level2-icon {
    background: #e0e0e0;
    border-color: #777;
    color: #777;
}

.level2-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f9f9f9;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    color: #555;
}

.level2-icon .level-icon-img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.level2-label {
    font-size: 12px;
    text-align: center;
    line-height: 1.1;
    color: #333;
    white-space: normal;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* Level 3: Dropdown Container */
.level3-container {
    padding: 6px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.level3-select {
    width: 100%;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    color: #333;
}

/* Level 4: Dropdown Container */
.level4-container {
    padding: 6px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.level4-select {
    width: 100%;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    color: #333;
}

/* Level 5: Enhanced Preview Panel - MAXIMIZED */
.level5-preview {
    padding: 0;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex: 1;
    /* Grow to fill remaining space */
    min-height: 150px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.level5-preview-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* Remove padding to maximize space */
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.level5-preview img {
    width: 100%;
    /* Force full width */
    height: 100%;
    /* Force full height */
    object-fit: contain;
    /* Maintain aspect ratio within full area */
    transition: transform 0.3s ease;
}

/* Preview Controls (Overlay or Bar) */
.level5-preview-controls {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 20;
    /* Ensure above image */
}

.level5-ctrl-btn {
    pointer-events: auto;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ccc;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.level5-btn-prev {
    left: 10px;
}

.level5-btn-next {
    right: 10px;
}

.level5-ctrl-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    color: #000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.level5-add-btn {
    pointer-events: auto;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #4CAF50;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.level5-add-btn:hover {
    background: #45a049;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.level5-add-btn .material-icons {
    font-size: 18px;
}

.level5-preview-placeholder {
    color: #999;
    font-style: italic;
    font-size: 14px;
    margin: auto;
}

/* Level 5: Horizontal Slider (Bottom) */
.level5-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 6px 0;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.level5-nav-btn {
    flex: 0 0 24px;
    height: 100%;
    min-height: 50px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.2s;
    z-index: 1;
}

.level5-nav-btn:hover {
    background: #f5f5f5;
    color: #000;
}

.level5-slider {
    flex: 1;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 15px;
    padding: 6px 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.level5-slider::-webkit-scrollbar {
    display: none;
}

.level5-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.6;
    width: 60px;
    flex-shrink: 0;
}

.level5-item:hover {
    opacity: 1;
    background: #f9f9f9;
}

.level5-item.active {
    opacity: 1;
    background: #f0f0f0;
    border-color: #777;
    font-weight: bold;
}

.level5-item-icon {
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.level5-item-icon .level-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.level5-item-label {
    font-size: 10px;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.1;
}


/* Bottom Panel Header */
.bottom-panel-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Center content */
    padding: 8px;
    background: #eee;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    cursor: default;
    flex-shrink: 0;
    position: relative;
}

.bottom-panel-header .toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* Toast Notification */
.toast-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(50, 50, 50, 0.9);
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 9999;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

.toast-message.fade-out {
    opacity: 0;


}

/* --- New Furniture Manager UI Styles --- */
.furniture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 10px;
}

.furniture-cat-btn {
    cursor: pointer;
    text-align: center;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 5px;
    background: #f9f9f9;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.furniture-cat-btn:hover {
    background: #eef;
    border-color: #aaf;
}

.furniture-item-btn {
    cursor: pointer;
    text-align: center;
    border: 1px solid #eee;
    padding: 5px;
    border-radius: 4px;
    background: #fff;
    transition: transform 0.1s, box-shadow 0.1s;
}

.furniture-item-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}