/* main.css */

:root { font-family: 'Poppins', system_ui, sans-serif; }

.file-card {
    transition: transform .1s ease, box-shadow .1s ease;
}
.file-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.file-card:hover .file-ext-badge {
    border-color: #52525b;
    color: #e4e4e7;
}

.dropzone {
    transition: all 0.2s ease;
}
.dropzone.dragover {
    background-color: #27272a;
    border-color: #6366f1;
    transform: scale(1.01);
}

a.nav-active {
    background-color: #27272a;
    color: #f4f4f5;
    font-weight: 500;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px #3f3f46;
}

.sidebar-tree-file {
    margin-left: 0.125rem;
}

.sidebar-tree-files + .folder-tree-node,
.folder-tree-node + .sidebar-tree-files {
    margin-top: 0.125rem;
}

/* Podgląd kodu z Highlight.js (file.php) */
.code-preview-block {
    background: #09090b;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    overflow: auto;
    max-height: 65vh;
}

.code-preview-block pre {
    margin: 0;
    white-space: pre;
    tab-size: 4;
}

.code-preview-block code.hljs {
    display: block;
    padding: 0;
    background: transparent;
    color: #abb2bf;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
}

/* Fallback kolory (gdy CDN CSS zablokowany) — motyw atom-one-dark */
.code-preview-block .hljs-comment,
.code-preview-block .hljs-quote { color: #5c6370; font-style: italic; }
.code-preview-block .hljs-keyword,
.code-preview-block .hljs-selector-tag,
.code-preview-block .hljs-built_in { color: #c678dd; }
.code-preview-block .hljs-string,
.code-preview-block .hljs-regexp { color: #98c379; }
.code-preview-block .hljs-number,
.code-preview-block .hljs-literal { color: #d19a66; }
.code-preview-block .hljs-title,
.code-preview-block .hljs-section,
.code-preview-block .hljs-name { color: #61afef; }
.code-preview-block .hljs-variable,
.code-preview-block .hljs-template-variable,
.code-preview-block .hljs-attribute { color: #e06c75; }
.code-preview-block .hljs-meta,
.code-preview-block .hljs-symbol { color: #56b6c2; }

.code-preview-plain {
    white-space: pre-wrap;
    word-break: break-word;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 180px);
    gap: 12px;
}

.file-grid .file-card {
    display: flex;
    flex-direction: column;
    width: 180px;
    height: 100%;
}

.file-grid .grid-thumb {
    height: 5rem;
    flex-shrink: 0;
}

/* Desktop: szybkie akcje + menu „Więcej” */
.item-actions {
    display: none;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 1px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #27272a;
    min-width: 0;
}
@media (min-width: 768px) {
    .item-actions { display: flex; }
}

.file-grid .item-actions {
    margin-top: auto;
}

/* Mobile: tylko przycisk ⋮ → dolne menu */
.mobile-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #27272a;
}
@media (min-width: 768px) {
    .mobile-item-actions { display: none; }
}

.file-grid .mobile-item-actions {
    margin-top: auto;
}

.list-row .mobile-item-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
}

/* Drag and drop — przenoszenie wewnętrzne (desktop) */
.is-dragging {
    opacity: 0.45;
}

.drop-target--valid {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    background-color: rgba(99, 102, 241, 0.08);
}

.drop-target-sidebar.drop-target--valid {
    background-color: #27272a;
    border-radius: 1rem;
}

.drop-target-crumb.drop-target--valid {
    background-color: rgba(99, 102, 241, 0.15);
    border-radius: 0.5rem;
    padding: 0 4px;
    margin: 0 -4px;
}

.folder-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
}

/* Sidebar — zmiana szerokości myszką */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 20;
    touch-action: none;
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2px;
    width: 2px;
    border-radius: 1px;
    background: transparent;
    transition: background 0.15s ease;
}

.sidebar-resize-handle:hover::after,
.sidebar-panel--resizing .sidebar-resize-handle::after,
body.sidebar-resizing .sidebar-resize-handle::after {
    background: #6366f1;
}

body.sidebar-resizing {
    cursor: col-resize !important;
}

body.sidebar-resizing * {
    cursor: col-resize !important;
}

.list-row .item-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
}

.item-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: #a1a1aa;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.item-act:hover { background: #3f3f46; color: #f4f4f5; }
.item-act svg { width: 15px; height: 15px; pointer-events: none; }
.item-act--fav { color: #facc15; }
.item-act--fav:hover { color: #fde047; background: rgba(250,204,21,0.12); }
.item-act--danger:hover { color: #f87171; background: rgba(248,113,113,0.1); }

.item-more-wrap { position: relative; flex-shrink: 0; }

.item-more-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 4px);
    z-index: 50;
    min-width: 190px;
    padding: 4px;
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.list-row .item-more-menu {
    bottom: auto;
    top: calc(100% + 4px);
}

.item-more-menu button,
.item-more-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    color: #d4d4d8;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
}
.item-more-menu button:hover,
.item-more-menu a:hover { background: #27272a; color: #fff; }
.item-more-menu button.danger:hover { color: #f87171; background: rgba(248,113,113,0.1); }
.item-more-menu svg { width: 14px; height: 14px; flex-shrink: 0; }

.list-row {
    transition: background-color .1s ease, border-color .1s ease;
}
.list-row:hover { background-color: #18181b; }

[x-cloak] { display: none !important; }

.file-card input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    background-color: #27272a;
    border: 1.5px solid #3f3f46;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
.file-card input[type="checkbox"]:checked {
    background-color: #6366f1;
    border-color: #6366f1;
}
.file-card input[type="checkbox"]:checked:after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.file-card input[type="checkbox"]:hover { border-color: #6366f1; }