:root {
    --bg-color: #f4f6f9;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --th-bg: #f8f9fa;
    --link-color: #0056b3;
    --btn-gray: #6c757d;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --border-color: #333;
    --th-bg: #222;
    --link-color: #66b2ff;
    --btn-gray: #444;
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: var(--bg-color); color: var(--text-color); margin: 0; padding: 20px; transition: background 0.3s, color 0.3s; }
a { color: var(--link-color); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

.top-bar { display: flex; justify-content: space-between; align-items: center; max-width: 1100px; margin: 0 auto 20px auto; }
.logo { font-size: 24px; font-weight: bold; text-decoration: none; color: var(--text-color); }
.content-box { max-width: 1100px; margin: auto; background: var(--card-bg); padding: 25px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid var(--border-color); }

.search-container { max-width: 1100px; margin: 0 auto 20px auto; }
#searchInput { width: 100%; padding: 15px; font-size: 16px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--card-bg); color: var(--text-color); }
#searchInput:focus { outline: none; border-color: #007bff; }
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--border-color); border-top: none; border-radius: 0 0 8px 8px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); z-index: 1000; max-height: 400px; overflow-y: auto; }
.s-item { display: flex; align-items: center; padding: 12px 15px; border-bottom: 1px solid var(--border-color); color: var(--text-color); }
.s-item:hover { background: rgba(128,128,128,0.1); text-decoration: none; }

.path-header { display: flex; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border-radius: 6px; text-decoration: none !important; font-size: 13px; color: #fff !important; border: none; cursor: pointer; transition: opacity 0.2s; white-space: nowrap; margin-right: 4px; margin-bottom: 4px; }
.btn:hover { opacity: 0.8; }
.btn-blue { background: #007bff; }
.btn-green { background: #28a745; }
.btn-orange { background: #fd7e14; }
.btn-gray { background: var(--btn-gray); }
.btn-dark { background: #343a40; }

.file-list { width: 100%; border-collapse: collapse; }
.file-list th, .file-list td { padding: 15px; border-bottom: 1px solid var(--border-color); text-align: left; }
.file-list th { background: var(--th-bg); font-weight: 600; }
.file-row:hover { background: rgba(128,128,128,0.05); }
.actions-cell { text-align: right; }
.badge { background: #17a2b8; color: #fff; padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: bold; }

/* * UNIWERSALNE STYLE LINKÓW I IKON 
 * Naprawiają problem brzydkiego ucinania .jpg 
 */
.item-link { display: inline-flex; align-items: center; text-decoration: none; color: inherit; max-width: 100%; overflow-wrap: break-word; }
.item-name { overflow-wrap: break-word; word-break: break-word; line-height: 1.3; }
.item-icon { font-size: 24px; margin-right: 12px; min-width: 30px; text-align: center; }
.item-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; margin-right: 12px; flex-shrink: 0; border: 1px solid var(--border-color); }

/* * WIDOK KAFELKÓW
 */
body.grid-mode .file-list, 
body.grid-mode .file-list tbody { display: flex; flex-wrap: wrap; gap: 20px; justify-content: flex-start; }
body.grid-mode .file-list thead { display: none; }
body.grid-mode .file-row { display: flex; flex-direction: column; width: 230px; background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 10px; padding: 15px; text-align: center; justify-content: space-between; }
body.grid-mode .file-row td { display: block; width: 100%; border: none; padding: 5px 0; text-align: center; }
body.grid-mode .meta-data { color: #888; font-size: 12px; }

/* Transformacja ikon i miniatur w Kafelkach */
body.grid-mode .item-link { flex-direction: column; width: 100%; align-items: center; }
body.grid-mode .item-icon { font-size: 55px; margin-bottom: 12px; margin-right: 0; }
body.grid-mode .item-thumb { width: 100%; height: 160px; margin-bottom: 12px; margin-right: 0; border-radius: 6px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); border: none; }

/* Naprawa rozjechanych przycisków w Kafelkach */
body.grid-mode .actions-cell { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 15px; gap: 6px; }
body.grid-mode .actions-cell .btn { margin: 0; padding: 8px 6px; font-size: 12px; flex: 1 1 45%; }

/* Strona PIN */
.pin-body { display: flex; align-items: center; justify-content: center; height: 100vh; background: #121212; margin: 0; }
.pin-box { background: #1e1e1e; padding: 40px; border-radius: 12px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid #333; }
.pin-box h2 { color: #fff; margin-top: 0; }
.pin-box input { padding: 15px; font-size: 30px; width: 180px; text-align: center; letter-spacing: 15px; margin-bottom: 25px; border-radius: 8px; border: 1px solid #444; background: #2a2a2a; color: #fff; font-family: monospace; outline: none; }
.pin-box input:focus { border-color: #007bff; }
.pin-box button { width: 100%; font-size: 18px; padding: 12px; }

.main-folders { display: flex; flex-wrap: wrap; gap: 20px; }
.folder-card { background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 10px; padding: 20px; width: 200px; text-align: center; text-decoration: none; color: var(--text-color); transition: transform 0.2s; }
.folder-card:hover { transform: translateY(-5px); background: rgba(128,128,128,0.1); }
.folder-icon { font-size: 60px; margin-bottom: 15px; }
.folder-name { font-weight: bold; font-size: 18px; }
.sort-select { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-color); font-size: 13px; outline: none; cursor: pointer; transition: 0.2s; }
.modal-overlay { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.7); z-index:10000; display:flex; justify-content:center; align-items:center; }
.modal-box { background:var(--card-bg); padding:25px; border-radius:10px; width:90%; max-width:400px; color:var(--text-color); border:1px solid var(--border-color); box-shadow:0 10px 30px rgba(0,0,0,0.5); }
