/* Chat Images Horizontal Panel Styles */

.chat-images-section-horizontal {
    width: 100%;
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    margin-top: 8px;
    padding: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column; /* Stack elements vertically */
}

.chat-images-horizontal-container {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 0; /* Allow flexbox to shrink */
}

.chat-images-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow flexbox to shrink */
}

.chat-images-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 40px; /* Minimum width for controls */
}

.chat-images-count-vertical {
    font-size: 10px;
    color: #666;
    background: #e1e4e8;
    padding: 2px 6px;
    border-radius: 8px;
    text-align: center;
    margin-top: 6px;
    display: block;
    white-space: nowrap;
}

/* Thin horizontal strip for active filters */
.active-filters-thin-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 11px;
    min-height: 24px;
}

.active-filters-thin-strip.hidden {
    display: none;
}

.active-filters-label {
    font-weight: 600;
    color: #856404;
}

.active-filter-chips-horizontal {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #007bff;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    white-space: nowrap;
}

.remove-chip {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    line-height: 1;
}

.remove-chip:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.filter-logic-display-horizontal {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #856404;
}

.current-logic {
    font-weight: 600;
    padding: 1px 4px;
    background: rgba(133, 100, 4, 0.1);
    border-radius: 3px;
}

.clear-all-filters-horizontal {
    background: #dc3545;
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
}

.clear-all-filters-horizontal:hover {
    background: #c82333;
}

.chat-images-horizontal-scroll {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden; /* Prevent vertical overflow */
    gap: 6px;
    padding: 2px 0;
    min-height: 80px;
    max-height: 120px; /* Limit maximum height */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.chat-images-horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.chat-images-horizontal-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-images-horizontal-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-images-horizontal-scroll::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.empty-chat-images-horizontal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 80px;
    color: #666;
    font-style: italic;
}

.chat-image-thumbnail-horizontal {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-image-thumbnail-horizontal:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.chat-image-thumbnail-horizontal.active {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

.chat-image-thumbnail-horizontal img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-image-overlay-horizontal {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.chat-image-index-horizontal {
    line-height: 1;
}

.chat-images-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.filter-button-horizontal,
.download-all-button-horizontal {
    width: 40px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.filter-button-horizontal:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

.download-all-button-horizontal:hover {
    background: #f8f9fa;
    border-color: #28a745;
    color: #28a745;
}

.download-all-button-horizontal:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.download-all-button-horizontal:disabled:hover {
    background: white;
    border-color: #ddd;
    color: inherit;
}

.filter-icon,
.download-icon {
    font-size: 16px;
    line-height: 1;
}

/* Filter Popup for Horizontal Layout */
.tag-filter-popup-horizontal {
    position: absolute;
    top: 0;
    right: 48px;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
}

.tag-filter-popup-horizontal.hidden {
    display: none;
}

.popup-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.popup-header h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
}

.popup-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logic-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logic-label {
    font-size: 12px;
    color: #666;
}

.popup-logic-toggle {
    background: #007bff;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
}

.popup-logic-toggle:hover {
    background: #0056b3;
}

.popup-clear-all {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.popup-clear-all:hover {
    background: #c82333;
}

.tag-filter-categories {
    padding: 16px;
    max-height: 250px;
    overflow-y: auto;
}

.tag-category {
    margin-bottom: 16px;
}

.tag-category:last-child {
    margin-bottom: 0;
}

.category-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-tags {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tag-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.tag-checkbox-label:hover {
    background: #f8f9fa;
}

.tag-checkbox-label input[type="checkbox"] {
    margin: 0;
}

.tag-name {
    font-size: 12px;
    flex: 1;
}

.tag-name.system-tag {
    color: #007bff;
}

.tag-name.user-tag {
    color: #28a745;
}

.no-tags-message {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.popup-actions {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.apply-filter-button {
    width: 100%;
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.apply-filter-button:hover {
    background: #0056b3;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tag-filter-popup-horizontal {
        width: 280px;
        right: -40px;
    }
} 

/* Mobile optimizations for sleeker look */
@media (max-width: 768px) {
    .chat-images-section-horizontal {
        margin-top: 4px; /* Reduced margin */
        padding: 4px; /* Reduced padding */
        max-height: 20vh; /* Even smaller on mobile */
    }
    
    .chat-images-horizontal-container {
        gap: 4px; /* Reduced gap on mobile */
    }
    
    .chat-images-right {
        min-width: 35px; /* Smaller width on mobile */
        gap: 3px; /* Smaller gap between controls */
    }
    
    .chat-images-controls {
        flex-direction: row !important; /* Keep controls horizontal on mobile */
        justify-content: flex-end !important;
        gap: 3px; /* Reduced gap */
        margin-top: 2px;
    }
    
    .chat-images-count-vertical {
        font-size: 9px;
        padding: 1px 4px;
        margin-top: 0; /* Remove margin when in right sidebar */
        writing-mode: horizontal-tb; /* Keep horizontal text */
        min-width: 30px;
        text-align: center;
    }
    
    .filter-button-horizontal,
    .download-all-button-horizontal {
        padding: 2px; /* Further reduced padding */
        font-size: 10px; /* Smaller font */
        min-width: 24px;
        min-height: 24px;
        border-radius: 4px;
    }
    
    .chat-images-horizontal-scroll {
        min-height: 50px; /* Reduced minimum height */
        max-height: 60px; /* Reduced maximum height */
        gap: 3px; /* Further reduced gap between thumbnails */
    }
    
    .chat-image-thumbnail-horizontal {
        width: 50px; /* Further reduced thumbnails */
        height: 50px;
        border-radius: 4px; /* Smaller border radius */
    }
    
    .chat-image-overlay-horizontal {
        top: 2px;
        left: 2px;
        padding: 1px 4px;
        border-radius: 6px;
        font-size: 9px; /* Smaller font */
    }
    
    .active-filters-thin-strip {
        padding: 2px 4px;
        margin-bottom: 3px;
        font-size: 10px;
        min-height: 20px;
    }
    
    .filter-chip {
        padding: 1px 4px;
        font-size: 10px;
    }
} 