/**
 * Files Gallery - Layout Styles
 * Styly pro různé režimy zobrazení souborů
 */

/* Základní kontejner */
.fg-files-container {
    padding: 20px;
    min-height: calc(100vh - 200px);
    transition: all 0.3s ease;
}

/* ===== 1. SEZNAM (LIST) ===== */
.fg-files-container.layout-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.layout-list .file-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.layout-list .file-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

/* Zobrazit pouze tyto elementy pro list layout */
.layout-list .file-preview,
.layout-list .file-details {
    display: none;
}

.layout-list .file-icon {
    width: 48px;
    height: 48px;
    margin-right: 15px;
    font-size: 40px;
    color: #64b5f6;
    flex-shrink: 0;
}

.layout-list .file-name {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 15px;
}

.layout-list .file-info {
    display: flex;
    gap: 30px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.layout-list .file-size {
    min-width: 80px;
    text-align: right;
}

.layout-list .file-date {
    min-width: 150px;
}

/* ===== 2. SEZNAM OBRÁZKŮ (IMAGELIST) ===== */
.fg-files-container.layout-imagelist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layout-imagelist .file-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    height: 80px;
}

.layout-imagelist .file-item:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Skrýt nepotřebné elementy pro imagelist */
.layout-imagelist .file-icon,
.layout-imagelist .file-name,
.layout-imagelist .file-info {
    display: none;
}

.layout-imagelist .file-preview {
    width: 64px;
    height: 64px;
    margin-right: 15px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.layout-imagelist .file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layout-imagelist .file-preview .file-icon {
    font-size: 64px;
    color: #64b5f6;
}

.layout-imagelist .file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.layout-imagelist .file-details .file-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    display: block;
}

.layout-imagelist .file-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* ===== 3. BLOKY (BLOCKS) ===== */
.fg-files-container.layout-blocks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--files-grid-size), 1fr));
    gap: var(--files-grid-gap);
}

.layout-blocks .file-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.layout-blocks .file-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Skrýt nepotřebné elementy pro blocks */
.layout-blocks .file-preview,
.layout-blocks .file-details,
.layout-blocks .file-info {
    display: none;
}

.layout-blocks .file-icon {
    font-size: 96px;
    color: #64b5f6;
    margin-bottom: 15px;
}

.layout-blocks .file-name {
    font-size: 13px;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== 4. MŘÍŽKA (GRID) ===== */
.fg-files-container.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(calc(var(--files-grid-size) * 0.6), 1fr));
    gap: calc(var(--files-grid-gap) * 0.66);
}

.layout-grid .file-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.layout-grid .file-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* Skrýt nepotřebné elementy pro grid */
.layout-grid .file-preview,
.layout-grid .file-details,
.layout-grid .file-info {
    display: none;
}

.layout-grid .file-icon {
    font-size: 72px;
    color: #64b5f6;
    margin-bottom: 8px;
}

.layout-grid .file-name {
    font-size: 12px;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

/* ===== 5. ŘADY (ROWS) ===== */
.fg-files-container.layout-rows {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.fg-files-container.layout-rows::-webkit-scrollbar {
    height: 6px;
}

.fg-files-container.layout-rows::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.fg-files-container.layout-rows::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.layout-rows .file-item {
    flex: 0 0 150px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.layout-rows .file-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* Skrýt nepotřebné elementy pro rows */
.layout-rows .file-preview,
.layout-rows .file-details,
.layout-rows .file-info {
    display: none;
}

.layout-rows .file-icon {
    font-size: 64px;
    color: #64b5f6;
    margin-bottom: 10px;
}

.layout-rows .file-name {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* ===== 6. SLOUPCE (COLUMNS) - Výchozí ===== */
.fg-files-container.layout-columns {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(calc(var(--files-grid-size) * 0.9), 1fr));
    gap: var(--files-grid-gap);
}

.layout-columns .file-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.layout-columns .file-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Skrýt nepotřebné elementy pro columns */
.layout-columns .file-preview,
.layout-columns .file-details,
.layout-columns .file-info {
    display: none;
}

.layout-columns .file-icon {
    font-size: 56px;
    color: #64b5f6;
    margin-bottom: 8px;
}

.layout-columns .file-name {
    font-size: 12px;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== RESPONZIVNÍ DESIGN ===== */
@media (max-width: 768px) {
    .fg-files-container.layout-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .fg-files-container.layout-blocks {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .layout-columns {
        flex-direction: column;
    }
    
    .layout-columns .file-column {
        flex: 1 1 auto;
        width: 100%;
    }
    
    /* Kontextové tlačítko - větší pro dotykové ovládání */
    .files-context {
        width: 36px;
        height: 36px;
        top: 5px;
        right: 5px;
    }
    
    .files-context .svg-icon {
        width: 20px;
        height: 20px;
    }
}

/* ===== ANIMACE PŘECHODU ===== */
.fg-files-container.transitioning .file-item {
    animation: fadeInUp 0.3s ease forwards;
}

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

/* ===== HOVER EFEKTY S GLASS MORPHISM ===== */
.file-item:hover {
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1), 
        rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== POČÍTADLO SOUBORŮ ===== */
.file-name {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-name .fg-folder-stats {
    margin-left: auto;
    margin-right: 5px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.file-name .fg-file-count {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 8px;
}

/* Tlačítko pro rozbalení/sbalení podsložek */
.fg-expand-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
}

.fg-expand-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.fg-expand-toggle i {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

/* ===== VÝBĚR SOUBORŮ ===== */
.file-item.selected {
    background: rgba(100, 181, 246, 0.2);
    border-color: #64b5f6;
}

.file-item .file-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    display: none;
}

.selection-mode .file-item .file-checkbox {
    display: block;
}

/* ===== SLOŽKY VS SOUBORY ===== */
.file-item.folder {
    cursor: pointer;
}

.file-item.folder .file-icon {
    color: #ffa726;
}

.file-item.file .file-icon {
    color: #64b5f6;
}

/* ===== LOADING STATE ===== */
.fg-files-container.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.5;
}

.fg-files-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #64b5f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== DETAILS MODE - Zobrazení podrobností ===== */
/* Zobrazí dodatečné informace ve všech layoutech při aktivním .show-details */

.fg-files-container.show-details .file-item {
    position: relative;
}

/* Tooltip s podrobnostmi */
.fg-files-container.show-details .file-item::after {
    content: attr(data-name) " • " attr(data-size) " • " attr(data-modified);
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.fg-files-container.show-details .file-item:hover::after {
    opacity: 1;
}

/* Pro layout-list - zobrazit dodatečné sloupce */
.fg-files-container.show-details.layout-list .file-info {
    display: flex !important;
}

.fg-files-container.show-details.layout-list .file-item {
    padding: 15px;
}

/* Pro layout-imagelist - zobrazit metadata */
.fg-files-container.show-details.layout-imagelist .file-meta {
    display: block !important;
    font-size: 11px;
    margin-top: 4px;
}

/* Pro grid layouty - zobrazit overlay s informacemi */
.fg-files-container.show-details.layout-grid .file-item,
.fg-files-container.show-details.layout-blocks .file-item,
.fg-files-container.show-details.layout-columns .file-item {
    position: relative;
    overflow: visible;
}

.fg-files-container.show-details.layout-grid .file-item:hover,
.fg-files-container.show-details.layout-blocks .file-item:hover,
.fg-files-container.show-details.layout-columns .file-item:hover {
    z-index: 10;
}

/* ===== CONTEXT MENU BUTTON ===== */
.files-context {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.file-item:hover .files-context {
    opacity: 1;
}

.files-context:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.1);
}

.files-context .svg-icon {
    width: 16px;
    height: 16px;
    fill: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.files-context .svg-path-close_thin {
    display: none;
}

.files-context.active .svg-path-dots {
    display: none;
}

.files-context.active .svg-path-close_thin {
    display: block;
}

/* Selection checkbox styling */
.svg-check-select {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    opacity: 0;
    transition: opacity 0.3s ease;
    fill: #4facfe;
}

.file-item.selected .svg-check-select {
    opacity: 1;
}

.selection-mode .file-item:hover .svg-check-select {
    opacity: 0.7;
}

.selection-mode .file-item.selected .svg-check-select {
    opacity: 1;
}

/* Input checkbox styling */
.file-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.selection-mode .file-checkbox {
    opacity: 1;
}

.file-checkbox:checked + * + * + * + * + * + * + .svg-check-select {
    opacity: 1;
}

/* Selection mode UI */
.selection-mode .file-item {
    cursor: pointer;
}

.selection-mode .file-item.selected {
    background: rgba(79, 172, 254, 0.2);
    border-color: #4facfe;
}

/* Selection Info Panel */
.fg-selection-info {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1000;
    box-shadow: var(--shadow-soft);
}

.fg-selection-count {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.fg-selection-actions {
    display: flex;
    gap: 10px;
}

.fg-selection-actions .bulk-action {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fg-selection-actions .bulk-action:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}