/**
 * Asset Gallery Styles
 * Beautiful thumbnails, grid/list views, lightbox
 */

/* Main Gallery Container */
.asset-gallery {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--dark-bg);
    position: relative;
}

/* Toolbar */
.asset-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toolbar-btn:hover:not(:disabled) {
    background: rgba(124, 58, 237, 0.2);
    border-color: var(--primary-purple);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-btn .icon {
    font-size: 1.1rem;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

.toolbar-select {
    padding: 0.5rem 0.75rem;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.view-mode-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.view-btn {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--primary-purple);
    color: white;
}

.view-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

/* Upload Progress */
.upload-progress {
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 4px;
    background: var(--hover-bg);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-cyan));
    transition: width 0.3s ease;
}

/* Asset Content Area */
.asset-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Grid View */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.asset-item {
    position: relative;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.asset-item:hover {
    border-color: var(--primary-purple);
    transform: translateY(-2px);
}

.asset-item.selected {
    border-color: var(--primary-cyan);
    background: rgba(6, 182, 212, 0.1);
}

.asset-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
}

.asset-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-cyan);
}

.asset-thumbnail {
    width: 100%;
    height: 150px;
    background: var(--dark-bg);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    position: relative;
}

.asset-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.asset-item:hover .asset-thumbnail img {
    transform: scale(1.05);
}

.file-icon {
    font-size: 3rem;
}

.asset-details {
    margin-bottom: 0.5rem;
}

.asset-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.asset-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.asset-item:hover .asset-actions {
    opacity: 1;
}

.action-btn {
    padding: 0.25rem 0.5rem;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
    transform: scale(1.1);
}

/* List View */
.asset-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.asset-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.asset-list-item:hover {
    border-color: var(--primary-purple);
}

.asset-list-item.selected {
    border-color: var(--primary-cyan);
    background: rgba(6, 182, 212, 0.1);
}

.asset-thumbnail-small {
    width: 50px;
    height: 50px;
    background: var(--dark-bg);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asset-thumbnail-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-icon-small {
    font-size: 1.5rem;
}

.asset-info-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.asset-name-col {
    flex: 2;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-type-col {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.asset-size-col {
    flex: 0.5;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: right;
}

.asset-date-col {
    flex: 0.7;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: right;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 3rem;
}

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

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.empty-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-cyan));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.empty-cta:hover {
    transform: translateY(-2px);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Asset Info Panel */
.asset-info-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 350px;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.info-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.info-preview {
    width: 100%;
    height: 200px;
    background: var(--dark-bg);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.info-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-icon-large {
    font-size: 4rem;
}

.info-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.info-value {
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: right;
    word-break: break-all;
}

.info-value.copyable {
    cursor: pointer;
    text-decoration: underline;
}

.info-value.copyable:hover {
    color: var(--primary-cyan);
}

.info-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.info-btn:hover {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
}

.info-btn.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* Lightbox Modal */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image-container {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.lightbox-close {
    top: 2rem;
    right: 2rem;
}

.lightbox-prev {
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-info {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 2rem;
    color: white;
    font-size: 0.875rem;
}

/* Drag and Drop */
.asset-gallery.drag-over {
    border: 2px dashed var(--primary-cyan);
    background: rgba(6, 182, 212, 0.05);
}

.asset-gallery.drag-over::before {
    content: '📤 Drop files here to upload';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: var(--primary-cyan);
    z-index: 999;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .asset-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
    
    .asset-thumbnail {
        height: 120px;
    }
    
    .toolbar-btn .label {
        display: none;
    }
    
    .asset-info-panel {
        width: 100%;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .lightbox-prev {
        left: 1rem;
    }
    
    .lightbox-next {
        right: 1rem;
    }
}
