/**
 * CategoryBrowser Component Styles
 * 
 * Styles for the public category navigation component with grid display,
 * filtering, sorting, and responsive design.
 */

/* Main Container */
.category-browser {
    width: 100%;
    font-family: inherit;
    color: white;
}

/* Header */
.category-browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.browser-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.browser-title h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.category-count {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.95);  /* Increased contrast from 0.8 to 0.95 */
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Browser Controls */
.browser-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Search Control */
.search-control {
    position: relative;
    min-width: 200px;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #4ecdc4;
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

/* Filter Control */
.filter-control {
    min-width: 150px;
}

.filter-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    border-color: #4ecdc4;
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.2);
}

.filter-select option {
    background: #1a1a2e;
    color: white;
}

/* Sort Control */
.sort-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.sort-select:focus {
    border-color: #4ecdc4;
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.2);
}

.sort-select option {
    background: #1a1a2e;
    color: white;
}

.sort-order-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.sort-order-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #4ecdc4;
}

.sort-icon {
    font-size: 1.2rem;
    line-height: 1;
}

/* Layout Control */
.layout-control {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

.layout-btn {
    background: none;
    border: none;
    padding: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.layout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.layout-btn.active {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
}

.layout-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* Content Area */
.category-browser-content {
    position: relative;
    min-height: 400px;
}

/* Category Grid */
.category-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.category-grid.grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.category-grid.list {
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Category Item */
.category-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    animation: categorySlideIn 0.5s ease-out;
}

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

.category-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(78, 205, 196, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

.category-item.empty {
    opacity: 0.7;
}

.category-item.empty:hover {
    opacity: 0.9;
}

/* Grid Layout Category Item */
.category-grid.grid .category-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* List Layout Category Item */
.category-grid.list .category-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 1rem;
}

/* Category Thumbnail */
.category-thumbnail {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.category-grid.grid .category-thumbnail {
    aspect-ratio: 16/9;
    width: 100%;
}

.category-grid.list .category-thumbnail {
    width: 120px;
    height: 80px;
    border-radius: 8px;
    flex-shrink: 0;
    margin-right: 1rem;
}

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

.category-image.lazy {
    background: linear-gradient(45deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.1));
    background-size: 400% 400%;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.category-item:hover .category-image {
    transform: scale(1.05);
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-item:hover .thumbnail-overlay {
    opacity: 1;
}

.view-category {
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(78, 205, 196, 0.8);
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

/* Category Info */
.category-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category-grid.list .category-info {
    padding: 0;
    flex: 1;
}

.category-name {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;  /* Explicit white for maximum contrast */
    line-height: 1.3;
}

.category-grid.list .category-name {
    font-size: 1.1rem;
}

.category-description {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);  /* Increased contrast from 0.8 to 0.9 */
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-grid.list .category-description {
    -webkit-line-clamp: 1;
    font-size: 0.85rem;
}

.category-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
}

.category-grid.list .category-meta {
    margin-top: 0.5rem;
}

.photo-count,
.view-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);  /* Increased contrast from 0.7 to 0.85 */
}

.photo-count.empty {
    color: rgba(255, 107, 107, 0.8);
}

.count-icon,
.view-icon {
    font-size: 1rem;
}

/* Category Actions */
.category-actions {
    padding: 0 1.5rem 1.5rem;
}

.category-grid.list .category-actions {
    padding: 0;
    margin-left: 1rem;
}

.browse-btn {
    width: 100%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-grid.list .browse-btn {
    width: auto;
    white-space: nowrap;
}

.browse-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.browse-btn:active {
    transform: translateY(0);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.7);
    gap: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.1rem;
}

/* Error Message */
.error-message {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    color: #ff6b6b;
    text-align: center;
    margin: 2rem 0;
    animation: errorSlideIn 0.3s ease-out;
}

@keyframes errorSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.6);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results-text {
    font-size: 1.2rem;
    font-weight: 500;
}

/* Pagination */
.category-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: #4ecdc4;
    transform: translateY(-1px);
}

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

.pagination-info {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.btn-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .category-grid.grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .category-browser-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }

    .browser-title {
        justify-content: center;
        text-align: center;
    }

    .browser-title h2 {
        font-size: 1.5rem;
    }

    .browser-controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .search-control {
        min-width: 100%;
        order: -1;
    }

    .category-grid.grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .category-grid.list .category-item {
        flex-direction: column;
        text-align: center;
    }

    .category-grid.list .category-thumbnail {
        width: 100%;
        height: 150px;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .category-grid.list .category-info {
        padding: 0 1rem;
    }

    .category-grid.list .category-actions {
        padding: 1rem;
        margin-left: 0;
    }

    .category-grid.list .browse-btn {
        width: 100%;
    }

    .category-pagination {
        flex-direction: column;
        gap: 1rem;
    }

    .pagination-info {
        order: -1;
    }
}

@media (max-width: 480px) {
    .browser-controls {
        gap: 0.5rem;
    }

    .filter-control,
    .sort-control {
        min-width: auto;
        flex: 1;
    }

    .sort-control {
        flex-direction: column;
        gap: 0.5rem;
    }

    .category-grid.grid {
        grid-template-columns: 1fr;
    }

    .category-info {
        padding: 1rem;
    }

    .category-name {
        font-size: 1.1rem;
    }

    .category-description {
        font-size: 0.85rem;
    }

    .category-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .pagination-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .btn-text {
        display: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .category-item {
        border-color: white;
        background: rgba(0, 0, 0, 0.8);
    }

    .category-item:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: #4ecdc4;
    }

    .search-input,
    .filter-select,
    .sort-select,
    .sort-order-btn,
    .pagination-btn {
        border-color: white;
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .category-item,
    .category-image,
    .browse-btn,
    .pagination-btn,
    .search-input,
    .filter-select,
    .sort-select,
    .sort-order-btn,
    .layout-btn {
        transition: none;
    }

    .category-item,
    .error-message {
        animation: none;
    }

    .loading-spinner {
        animation: none;
        border-top-color: #4ecdc4;
    }

    .category-image.lazy {
        animation: none;
        background: rgba(255, 255, 255, 0.1);
    }

    .category-item:hover {
        transform: none;
    }

    .browse-btn:hover,
    .pagination-btn:hover {
        transform: none;
    }
}