/* FILE BROWSER STYLES */
.files-root {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #0d0d0d;
    color: #e0e0e0;
}

.files-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.files-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.files-main h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 500;
    color: #fff;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

/* GRID LAYOUT */
.file-container.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.file-container.list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* FILE ITEMS */
.file {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    border-radius: 12px;
    background: #141414;
    border: 1px solid #2a2a2a;
    transition: all 0.2s ease;
    gap: 16px;
}

.file:hover {
    background: #1a1a1a;
    border-color: #3a3a3a;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.file.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f6;
}

.file.list {
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 12px;
    border-radius: 6px;
}

.file.list img.thumb-small {
    width: 48px;
    height: 48px;
    border-radius: 4px;
}

.file.list > span:first-child {
    font-size: 28px;
}

.file.list > span:last-child {
    text-align: left;
    -webkit-line-clamp: 1;
}

/* THUMBNAILS */
.thumb-small {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    background: #0a0a0a;
}

/* FILE ICONS */
.file > span:first-child {
    font-size: 80px;
}

/* FILE NAMES */
.file > span:last-child {
    font-size: 15px;
    font-weight: 500;
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #e0e0e0;
}

/* BACK BUTTON */
.back-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    color: #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #2a2a2a;
    border-color: #555;
    color: #fff;
}

/* SIDEBAR */
.files-sidebar {
    width: 280px;
    overflow-y: auto;
    border-right: 1px solid #2a2a2a;
    background: #0a0a0a;
}

.sidebar {
    padding: 16px 8px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-bottom: 4px;
}

.sidebar-item .icon {
    display: flex;
    align-items: center;
    font-size: 20px;
}

.sidebar-item .label {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* TOOLBAR */
.files-toolbar {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #2a2a2a;
    align-items: center;
    background: #0d0d0d;
}

.btn {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #2a2a2a;
    border-color: #555;
    transform: translateY(-1px);
}

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

.btn.icon {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.path-bar {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #141414;
    color: #e0e0e0;
    outline: none;
    font-size: 14px;
    font-family: monospace;
}

.path-bar:focus {
    border-color: #3b82f6;
    background: #1a1a1a;
}

/* MODAL */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: #1e1e1e;
    padding: 24px;
    border-radius: 12px;
    min-width: 320px;
    border: 1px solid #333;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal h3 {
    margin: 0 0 16px 0;
    color: #fff;
}

.modal input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #141414;
    color: #e0e0e0;
    margin-bottom: 16px;
    font-size: 14px;
}

.modal button {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    color: #e0e0e0;
    margin-right: 8px;
    transition: all 0.2s ease;
}

.modal button:hover {
    background: #2a2a2a;
}

.modal ul {
    max-height: 300px;
    overflow-y: auto;
    margin: 16px 0;
    padding-left: 20px;
}

.modal li {
    margin: 8px 0;
    color: #ccc;
    word-break: break-all;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .files-main {
        padding: 16px;
    }

    .file-container.grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }

    .file-container.list {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .thumb-small {
        height: 150px;
    }

    .file > span:first-child {
        font-size: 60px;
    }

    .files-sidebar {
        width: 220px;
    }
}

@media (max-width: 480px) {
    .file-container.grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .file-container.list {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .thumb-small {
        height: 120px;
    }

    .file {
        padding: 12px;
    }

    .file > span:first-child {
        font-size: 48px;
    }

    .files-sidebar {
        width: 180px;
    }
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;

    background: #141414;
    border: 1px solid #2a2a2a;
    color: #e0e0e0;

    padding: 10px 14px;
    border-radius: 10px;

    font-size: 13px;
    font-weight: 500;

    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);

    z-index: 3000;

    animation:
        toast-in 0.18s ease-out,
        toast-out 0.2s ease-in 1.3s forwards;
    max-width: 260px;
    word-break: break-word;
}

/* subtle slide + fade in */
@keyframes toast-in {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* fade out */
@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(6px);
    }
}
