:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --border: #e1e5ea;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px;
}

.btn:hover { background: #f0f2f5; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-danger { color: var(--danger); border-color: var(--danger); background: #fff; }
.btn-danger:hover { background: #fef2f2; }

input, select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
}

/* ---- Login ---- */
.login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 320px;
}

.login-box h1 { font-size: 20px; margin-bottom: 20px; }
.login-box .field { margin-bottom: 14px; }
.login-box label { display: block; font-size: 13px; margin-bottom: 4px; color: var(--muted); }
.login-box .btn-primary { width: 100%; margin-top: 6px; }
.login-box .welcome { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.login-box .switch-link { text-align: center; margin-top: 12px; font-size: 13px; }
.login-box .switch-link a { color: var(--primary); cursor: pointer; }
.login-box img.login-logo { max-height: 48px; margin-bottom: 12px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ---- Shell ---- */
.shell { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
  gap: 16px;
}

.topbar .left { display: flex; align-items: center; gap: 14px; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.topbar .brand img { height: 24px; }
.topbar .new-menu { position: relative; }
.topbar .search-box { display: flex; align-items: center; gap: 6px; background: #f0f2f5; border-radius: 999px; padding: 6px 12px; width: 260px; }
.topbar .search-box input { border: none; background: none; padding: 0; width: 100%; }
.topbar .right { display: flex; align-items: center; gap: 4px; }
.topbar .icon-btn { font-size: 18px; padding: 6px 10px; }
.topbar .icon-btn.active { background: #eef2ff; color: var(--primary); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}

.body-row { flex: 1; display: flex; overflow: hidden; }

.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  flex-shrink: 0;
  overflow-y: auto;
}

.tree-node { font-size: 14px; }
.tree-row { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 6px; margin: 0 8px; cursor: pointer; }
.tree-row:hover { background: #f5f6f8; }
.tree-row.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.tree-row .toggle { width: 16px; text-align: center; color: var(--muted); font-size: 11px; flex-shrink: 0; }
.tree-row .toggle:empty::before { content: ""; }
.tree-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { margin-left: 16px; }

.sidebar .static-nav { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.sidebar .static-nav .tree-row { margin-left: 0; }

.sidebar .quota { padding: 12px 16px; font-size: 12px; color: var(--muted); }
.sidebar .quota-bar { height: 6px; background: #eee; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.sidebar .quota-bar > div { height: 100%; background: var(--primary); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.content-row { flex: 1; display: flex; overflow: hidden; }

.subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
}

.breadcrumb { font-size: 14px; color: var(--muted); }
.breadcrumb a { color: var(--primary); text-decoration: none; cursor: pointer; }
.breadcrumb span.sep { margin: 0 6px; }

.toolbar { display: flex; gap: 8px; }

.info-panel {
  width: 260px;
  border-left: 1px solid var(--border);
  background: var(--panel);
  padding: 20px;
  flex-shrink: 0;
  overflow-y: auto;
}
.info-panel .info-icon { font-size: 40px; text-align: center; margin-bottom: 8px; }
.info-panel h3 { font-size: 15px; text-align: center; word-break: break-word; margin: 0 0 20px; }
.info-panel .info-row { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.info-panel .info-row a { color: var(--primary); cursor: pointer; }

.dropzone {
  flex: 1;
  overflow: auto;
  padding: 16px 24px;
  position: relative;
}

.dropzone.dragover::after {
  content: "Yüklemek için dosyayı buraya bırakın";
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  background: rgba(37, 99, 235, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--primary);
  pointer-events: none;
}

table.file-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.file-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.file-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
table.file-table tr.node-row:hover { background: #f8f9fb; }
table.file-table tr.node-row.selected { background: #eef2ff; }
.node-name { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.node-name .icon { font-size: 18px; }
.node-actions { text-align: right; white-space: nowrap; }
.icon-btn { border: none; background: none; font-size: 16px; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: #eee; }
.icon-btn.star-btn.starred { color: #f59e0b; }
.icon-btn.star-btn { color: #d1d5db; }
.tag-input { border: none; background: none; padding: 2px 4px; font-size: 13px; width: 100%; color: var(--muted); }
.tag-input:hover, .tag-input:focus { background: #f5f6f8; border-radius: 4px; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); }

/* ---- Kontrol Paneli ---- */
.admin-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 4000;
}
.admin-panel {
  background: var(--panel);
  border-radius: var(--radius);
  width: 960px; height: 80vh; max-width: 95vw; max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.admin-panel .admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.admin-panel .admin-header h1 { font-size: 20px; margin: 0; }
.admin-panel .admin-header button { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.admin-body { flex: 1; display: flex; overflow: hidden; }
.admin-nav { width: 220px; border-right: 1px solid var(--border); overflow-y: auto; padding: 12px 0; flex-shrink: 0; }
.admin-nav .section-title { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 20px 6px; }
.admin-nav .nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 20px; cursor: pointer; font-size: 14px; }
.admin-nav .nav-item:hover { background: #f5f6f8; }
.admin-nav .nav-item.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.admin-content { flex: 1; overflow-y: auto; padding: 24px; }
.admin-content h2 { margin-top: 0; font-size: 17px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.admin-toolbar input[type=search], .admin-toolbar input[type=text] { width: 220px; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.admin-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
table.admin-table tr:hover { background: #f8f9fb; cursor: pointer; }
.settings-section { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.settings-section h3 { margin: 0 0 12px; font-size: 14px; }
.settings-section .field { margin-bottom: 12px; }
.settings-section .checkbox-field { display: flex; align-items: center; gap: 8px; }
.settings-section .checkbox-field input { width: auto; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #f0f2f5; }
.pill.on { background: #dcfce7; color: #15803d; }
.pill.off { background: #fee2e2; color: #b91c1c; }
.tab-strip { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-strip button { border: none; background: none; padding: 10px 4px; margin-right: 16px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-strip button.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.perm-group { margin-bottom: 16px; }
.perm-group h4 { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.perm-checkbox { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.perm-checkbox input { width: auto; }

/* ---- Context menu ---- */
.context-menu {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 160px;
  z-index: 1000;
  padding: 4px;
}
.context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 8px 10px;
  font-size: 14px;
  border-radius: 6px;
}
.context-menu button:hover { background: #f0f2f5; }
.context-menu button.danger { color: var(--danger); }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.modal {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px;
  width: 380px;
  max-width: 90vw;
}
.modal h2 { margin: 0 0 16px; font-size: 17px; }
.modal .field { margin-bottom: 14px; }
.modal label { display: block; font-size: 13px; margin-bottom: 4px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.share-link-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.share-link-row input { flex: 1; }
.link-list-item, .share-list-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }

/* ---- Preview modal ---- */
.preview-modal { width: 90vw; height: 88vh; max-width: 1200px; display: flex; flex-direction: column; padding: 16px; }
.preview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-shrink: 0; }
.preview-header h2 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-actions { display: flex; gap: 8px; flex-shrink: 0; }
.preview-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; background: #f4f6f8; border-radius: var(--radius); }
.preview-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-media { max-width: 100%; max-height: 100%; }
.preview-audio { width: 80%; }
.preview-iframe, .office-editor { width: 100%; height: 100%; border: none; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1f2430;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 3000;
}
.toast.error { background: var(--danger); }

/* ---- Share page ---- */
.share-page { max-width: 640px; margin: 60px auto; padding: 0 16px; }
.share-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.share-card h1 { font-size: 18px; margin-top: 0; }
