/* ============================================================
   FÁJLKEZELŐ — RESPONSIVE & LAYOUT UPGRADE
   documents-responsive.css
   ============================================================ */

/* --- Nagyobb alap méretek (desktop) --- */
.docs-sidebar {
    width: 380px;
    min-width: 380px;
    padding: 1.5rem 0;
}

.docs-detail {
    width: 320px;
    min-width: 320px;
}

.docs-toolbar {
    padding: 0.75rem 1.25rem;
    min-height: 52px;
    gap: 0.5rem;
}

.toolbar-search {
    max-width: 280px;
    padding: 0 0.75rem;
}

.toolbar-search input {
    font-size: 0.875rem;
    padding: 0.4rem 0.5rem;
}

.toolbar-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    gap: 0.4rem;
}

.docs-content {
    padding: 1rem 1.25rem;
}

.docs-breadcrumb {
    font-size: 0.875rem;
    gap: 0.3rem;
}

.docs-breadcrumb button {
    font-size: 0.875rem;
    padding: 0.2rem 0.4rem;
}

/* Kártyák — jóval nagyobb, kevesebb gap */
.file-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.file-card {
    padding: 1.5rem 1.25rem;
    border-radius: 14px;
}

/* Képes kártya — nincs felső padding, a thumbnail tölti ki */
.file-card.file-card-image {
    padding: 0;
    overflow: hidden;
}

.file-card.file-card-image .file-card-name,
.file-card.file-card-image .file-card-meta {
    padding: 0 0.75rem;
}

.file-card.file-card-image .file-card-name {
    padding-top: 0.5rem;
}

.file-card.file-card-image .file-card-meta {
    padding-bottom: 0.625rem;
}

.file-card-thumb {
    width: 100%;
    height: 130px;
    overflow: hidden;
    border-radius: 14px 14px 0 0;
    background: #f1f5f9;
}

.file-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-card-icon {
    height: 110px;
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-card-icon svg {
    width: 90px;
    height: 90px;
}

.file-card-name {
    font-size: 0.88rem;
    font-weight: 500;
}

.file-card-meta {
    font-size: 0.75rem;
}

/* Lista sorok — nagyobb */
.file-list-row {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    gap: 1rem;
}

.file-list-row .list-icon svg {
    width: 22px;
    height: 22px;
}

/* Sidebar item-ek — tágasabb */
.sidebar-item {
    padding: 0.22rem 0.75rem;
    font-size: 0.72rem;
    gap: 0.4rem;
    border-radius: 5px;
    align-items: center;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
}

/* A régi item-count-ot elrejtjük (label-ben van most) */
.sidebar-item > .item-count {
    display: none;
}

.sidebar-item-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
    word-break: break-word;
    line-height: 1.3;
}

.sidebar-item-label .item-count {
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.02em;
    background: none;
    padding: 0;
    border-radius: 0;
}

/* ── ÚJ: Projekt sor struktúra ── */
.sidebar-project-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    position: relative;
    padding: 0.22rem 1.6rem 0.22rem 0.5rem;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.15s;
    color: #5c7a99;
}
.sidebar-project-item:hover { background: #f1f5f9; color: #3d5a80; }
.sidebar-project-item.active,
.sidebar-project-item.expanded { background: #eef2ff; color: #3b82f6; }

.spi-delete-btn {
    position: absolute;
    right: 0.3rem;
    top: 0.3rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #cbd5e1;
    padding: 0.15rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.sidebar-project-item:hover .spi-delete-btn { opacity: 1; }
.spi-delete-btn:hover { color: #ef4444; background: #fee2e2; }

.spi-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.spi-icon { flex-shrink: 0; }

.spi-name {
    font-size: 0.72rem;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.3;
}

.spi-meta {
    font-size: 0.67rem;
    color: #94a3b8;
    padding-left: 1.6rem;
    margin-top: 0.05rem;
    letter-spacing: 0.01em;
    width: 100%;
}

.sidebar-project-item.active .spi-meta,
.sidebar-project-item.expanded .spi-meta { color: #93c5fd; }

.expand-arrow {
    flex-shrink: 0;
    font-size: 0.55rem;
    color: #94a3b8;
    transition: transform 0.15s;
    width: 8px;
}
.sidebar-project-item.expanded .expand-arrow { transform: rotate(90deg); }

/* Belső mappák */
.sidebar-subtree { padding-left: 1.5rem; margin-top: 0.2rem; }

.sidebar-sub-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.22rem 0.5rem;
    cursor: pointer;
    border-radius: 5px;
    font-size: 0.72rem;
    color: #64748b;
    transition: background 0.15s;
}
.sidebar-sub-item:hover { background: #f8fafc; color: #3d5a80; }
.sidebar-sub-item.active { background: #dbeafe; color: #2563eb; font-weight: 600; }
.sidebar-sub-item svg { flex-shrink: 0; }
.sidebar-sub-item .sub-name { flex: 1; }
.sidebar-sub-item .sub-count {
    font-size: 0.68rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 0.2rem 0.75rem;
}

.sidebar-section-title {
    font-size: 0.67rem;
    padding: 0.3rem 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
}

/* Detail panel */
.detail-header {
    padding: 1rem 1.25rem;
}

.detail-header h3 {
    font-size: 0.9rem;
}

.detail-body {
    padding: 1.25rem;
}

.detail-row {
    font-size: 0.8rem;
    padding: 0.5rem 0;
}

.detail-actions button {
    padding: 0.5rem;
    font-size: 0.8rem;
}

/* Upload zone */
.upload-drop {
    padding: 1.75rem;
}

.upload-drop h4 {
    font-size: 0.85rem;
}

.upload-drop p {
    font-size: 0.75rem;
}

/* ============================================================
   RESPONSIVE — Tablet (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    .docs-sidebar {
        width: 220px;
        min-width: 220px;
    }

    .docs-detail {
        width: 280px;
        min-width: 280px;
    }

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

    .docs-content {
        padding: 1.25rem;
    }

    .toolbar-search {
        max-width: 220px;
    }
}

/* ============================================================
   RESPONSIVE — Kis tablet / nagy mobil (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    /* Sidebar elrejtve alapból, hamburger megjelenítéskor */
    .docs-sidebar {
        position: fixed;
        left: -280px;
        top: 64px;
        height: calc(100vh - 64px);
        z-index: 200;
        width: 260px;
        min-width: 260px;
        transition: left 0.25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }

    .docs-sidebar.sidebar-open {
        left: 0;
    }

    /* Overlay amikor sidebar nyitva */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        top: 64px;
        background: rgba(0,0,0,0.3);
        z-index: 199;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* Detail panel alulra kerül */
    .docs-detail {
        position: fixed;
        bottom: -100%;
        left: 0;
        right: 0;
        width: 100%;
        min-width: unset;
        max-height: 55vh;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        border-radius: 16px 16px 0 0;
        z-index: 200;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        transition: bottom 0.25s ease;
    }

    .docs-detail.open {
        bottom: 0;
    }

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

    .docs-content {
        padding: 1rem;
    }

    .docs-toolbar {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .toolbar-search {
        max-width: 100%;
        flex: 1 1 160px;
        order: 1;
    }

    /* Hamburger gomb megjelenítése */
    .sidebar-toggle-btn {
        display: flex !important;
    }
}

/* ============================================================
   RESPONSIVE — Mobil (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    .file-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .file-card {
        padding: 0.875rem 0.75rem;
    }

    .file-card-icon {
        height: 44px;
    }

    .file-card-icon svg {
        width: 36px;
        height: 36px;
    }

    .file-card-name {
        font-size: 0.72rem;
    }

    .docs-content {
        padding: 0.75rem;
    }

    /* Toolbar: ikonok maradjanak, szövegek eltűnnek */
    .toolbar-btn span.btn-text {
        display: none;
    }

    .toolbar-select {
        max-width: 90px;
        font-size: 0.7rem;
    }

    .docs-breadcrumb button {
        font-size: 0.75rem;
        padding: 0.2rem 0.3rem;
    }
}

/* Hamburger gomb — alapból rejtett desktopom */
.sidebar-toggle-btn {
    display: none;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #5c7a99;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-family: inherit;
    transition: all 0.15s;
}

.sidebar-toggle-btn:hover {
    background: #f8fafc;
    color: #3d5a80;
}
