/* ============== TEMEL ============== */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
:root {
  --bg-main: #0b1622;
  --bg-sidebar: #112234;
  --bg-card: #162a3d;
  --bg-hover: #1f3b54;
  --text-main: #f8fafc;
  --text-muted: #a3b8cc;
  --primary: #823aaf;
  --primary-hover: #652772;
  --border: #264059;
  --danger: #ea0c64;
  --success: #268792;
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --sidebar-width: 260px;
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; display: block; }
.error { color: var(--danger); margin-top: 12px; min-height: 20px; font-size: 14px; }

/* ============== LAYOUT ============== */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
#app {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
}

body.login-mode #sidebar { transform: translateX(-100%); display: none; }
body.login-mode #app { margin-left: 0; width: 100%; }

/* ============== SIDEBAR ============== */
.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.brand {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}
.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
}
.nav-section {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin: 16px 0 8px 12px;
  letter-spacing: 0.5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}
.nav-item.active {
  background: rgba(130, 58, 175, 0.15);
  color: var(--primary);
}
.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  background: var(--primary);
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}
.user-name { font-size: 14px; font-weight: 500; }

/* ============== TOPBAR ============== */
#topbar {
  background: var(--bg-main);
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0; z-index: 50;
}
.breadcrumbs {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  display: flex; align-items: center; gap: 8px;
}
.breadcrumbs span { color: var(--text-muted); font-weight: 400; font-size: 15px; }

.topbar-right { display: flex; gap: 10px; align-items: center; }

/* ============== BUTTONS ============== */
.btn {
  border: none; cursor: pointer; padding: 10px 16px;
  border-radius: 8px; font-size: 14px; font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(130, 58, 175, 0.2); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(130, 58, 175, 0.4); }
.btn-ghost { background: transparent; color: var(--text-main); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px; border: none; }
.btn-back {
  padding: 8px 18px; font-size: 15px; font-weight: 600;
  background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text-main); border-radius: 8px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-back:hover {
  background: var(--border);
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn-back:active { transform: scale(0.96) translateX(-4px); }

/* ============== VIEWS & CONTAINERS ============== */
.content-area {
  padding: 32px;
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ============== LOGIN ============== */
.login-wrapper {
  display: flex; align-items: center; justify-content: center; min-height: 80vh;
}
.login-mascot-wrapper {
  display: flex; justify-content: center; margin-bottom: 24px;
}
.login-mascot {
  width: 140px;
  height: auto;
  animation: floatMascot 4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.3));
}
@keyframes floatMascot {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
  100% { transform: translateY(0px); }
}
.login-card {
  background: var(--bg-card);
  padding: 40px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 100%; max-width: 420px;
  border: 1px solid var(--border);
}
.login-card h1 { margin-bottom: 24px; font-size: 24px; text-align: center; }
.login-form { display: none; flex-direction: column; gap: 4px; }
.login-form.active { display: flex; }
.login-form label { font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.login-form input {
  padding: 12px; background: var(--bg-main); border: 1px solid var(--border);
  color: var(--text-main); border-radius: 8px; font-size: 15px; margin-bottom: 4px;
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.login-form button { margin-top: 20px; padding: 12px; font-size: 15px; justify-content: center;}

/* ============== TABS ============== */
.tabs { display: flex; gap: 8px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: none; padding: 12px 16px;
  cursor: pointer; font-size: 14px; color: var(--text-muted);
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-tab { display: none; }
.admin-tab.active { display: block; }

/* ============== LISTS (KODLAND STYLE) ============== */
.list-container {
  display: flex; flex-direction: column; gap: 4px; margin-top: 24px;
}
.list-item {
  padding: 16px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.2s, padding-left 0.2s;
  border-radius: 6px;
}
.list-item:hover {
  background: rgba(255, 255, 255, 0.02);
  padding-left: 12px;
}
.list-item-title {
  font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.list-item-title .icon {
  font-size: 20px;
}
.list-item-meta {
  font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px;
  margin-left: 30px;
}

/* ============== MATERYAL (CONTENT) ============== */
.material {
  background: var(--bg-main);
  padding: 40px 0;
  line-height: 1.8;
  font-size: 16px;
  color: #e2e8f0;
}
.material h1, .material h2, .material h3 { margin: 24px 0 16px; color: #fff; }
.material h1 { font-size: 28px; }
.material h2 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 8px;}
.material h3 { font-size: 18px; }
.material p { margin-bottom: 16px; }
.material a { color: var(--primary); text-decoration: none; }
.material a:hover { text-decoration: underline; }
.material ul, .material ol { padding-left: 24px; margin-bottom: 16px; }
.material iframe { max-width: 100%; border: none; border-radius: 12px; margin: 16px 0; aspect-ratio: 16/9; width: 100%; }
.material img { max-width: 100%; border-radius: 12px; margin: 16px 0; display: block; }

/* ============== ADMIN FORMS & ROWS ============== */
.row-form {
  display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
  background: var(--bg-card); padding: 16px; border-radius: 12px; border: 1px solid var(--border);
}
.row-form input {
  padding: 10px 14px; background: var(--bg-main); border: 1px solid var(--border);
  color: var(--text-main); border-radius: 8px; font-size: 14px; flex: 1; min-width: 200px;
}
.row-form input:focus { outline: none; border-color: var(--primary); }
.admin-row {
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.admin-row .info { flex: 1; }
.admin-row .info strong { display: block; font-size: 16px; margin-bottom: 4px; }
.admin-row .info small { color: var(--text-muted); font-size: 13px; }
.admin-row .actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============== QUILL OVERRIDES ============== */
.editor-extra-toolbar {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.ql-toolbar.ql-snow {
  background: var(--bg-sidebar);
  border: 1px solid var(--border) !important;
  border-radius: 12px 12px 0 0;
  padding: 12px;
  position: sticky;
  top: 80px;
  z-index: 10;
}
.ql-container.ql-snow {
  border: 1px solid var(--border) !important;
  border-top: none !important;
  background: var(--bg-main);
  border-radius: 0 0 12px 12px;
  font-family: 'Inter', sans-serif;
  padding-bottom: 40px;
}
.ql-editor {
  background: var(--bg-card);
  color: #e2e8f0;
  max-width: 900px;
  margin: 32px auto 0;
  min-height: 842px;
  padding: 60px 80px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.8;
}
.ql-snow .ql-stroke { stroke: var(--text-muted); }
.ql-snow .ql-fill { fill: var(--text-muted); }
.ql-snow .ql-picker { color: var(--text-muted); }
.ql-editor.ql-blank::before { color: #475569; left: 80px; font-style: italic; }

/* ============== LOADER & TOAST ============== */
.loader {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-card); padding: 12px 20px; border-radius: 30px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  z-index: 1000; font-size: 13px; font-weight: 500;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toast {
  position: fixed; top: 24px; left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--bg-card); color: #fff;
  padding: 14px 24px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px; font-weight: 500;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1100; box-shadow: var(--shadow);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-bottom: 3px solid var(--danger); }
.toast.success { border-bottom: 3px solid var(--success); }

@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #app { margin-left: 0; width: 100%; }
}
