:root {
  /* Renk Paleti (Gece Yarısı) */
  --bg-darker: #0d1117;
  --bg-card: #161b22;
  --bg-hover: #21262d;
  --primary: #58a6ff;
  --primary-glow: rgba(88, 166, 255, 0.2);
  --success: #3fb950;
  --danger: #f85149;
  --text-main: #e6edf3;
  --text-muted: #8b949e;
  --border: #30363d;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  margin: 0; padding: 0;
}

body {
  font-family: 'Outfit', -apple-system, sans-serif;
  background: var(--bg-darker);
  color: var(--text-main);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

a, button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input, textarea, select { font: inherit; color: inherit; outline: none; border: none; background: none; }

.hidden { display: none !important; }

/* ═══════════════════════════
   AUTH SCREEN
═══════════════════════════ */
#auth-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at center, #1c2128, #0d1117);
  z-index: 1000;
}

.auth-card {
  text-align: center;
  padding: 40px;
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid var(--border);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  max-width: 380px; width: 90%;
  animation: auth-slide-up 0.6s ease-out;
}

.auth-hero h1 { font-size: 32px; letter-spacing: -1px; margin-bottom: 8px; }
.auth-hero p { color: var(--text-muted); margin-bottom: 32px; font-size: 15px; }
.auth-logo-icon { font-size: 48px; color: var(--primary); display: block; margin-bottom: 12px; }

@keyframes auth-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════
   MAIN LAYOUT
═══════════════════════════ */
#app {
  display: flex; height: 100vh;
}

/* Sidebar */
#sidebar {
  width: 300px;
  border-right: 1px solid var(--border);
  background: var(--bg-darker);
  display: flex; flex-direction: column;
  transition: var(--transition);
}

.sidebar-header { padding: 20px; }
.brand { font-size: 22px; font-weight: 700; letter-spacing: -1px; margin-bottom: 20px; }

.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 100px;
  border: 1px solid var(--border);
}
.user-pill #user-photo { width: 24px; height: 24px; border-radius: 50%; }
.user-pill #user-name { font-size: 14px; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

#btn-logout { font-size: 18px; color: var(--text-muted); transition: var(--transition); }
#btn-logout:hover { color: var(--danger); }

.search-box { padding: 0 20px; margin-bottom: 16px; }
.search-box input {
  width: 100%; padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
}

.sidebar-tabs { display: flex; padding: 0 20px 16px; gap: 10px; }
.tab-btn {
  flex: 1; padding: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.scroller { flex: 1; overflow-y: auto; padding: 10px 20px; }
.sidebar-footer { padding: 20px; }

/* List Items */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 4px;
  transition: var(--transition);
  font-size: 15px; color: var(--text-muted);
}
.list-item:hover, .list-item.active { background: var(--bg-hover); color: var(--text-main); }
.list-item b { color: var(--primary); font-size: 18px; }

/* Main Content Area */
#main-content {
  flex: 1;
  background: #0d1117;
  position: relative;
  display: flex; flex-direction: column;
}

.panel {
  flex: 1; display: flex; flex-direction: column;
  animation: panel-fade 0.3s ease;
}
@keyframes panel-fade {
  from { opacity: 0; filter: blur(4px); }
  to { opacity: 1; filter: blur(0); }
}

/* Hero Screen */
.hero {
  margin: auto; text-align: center;
  max-width: 400px;
}
.hero-icon { font-size: 64px; margin-bottom: 16px; color: var(--primary); opacity: 0.5; }
.hero h2 { font-size: 28px; margin-bottom: 12px; }
.hero p { color: var(--text-muted); margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; }

/* Buttons */
.btn-primary { 
  background: var(--primary); color: white; padding: 12px 24px; 
  border-radius: 14px; font-weight: 600; transition: var(--transition); 
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px var(--primary-glow); }
.btn-outline {
  border: 1px solid var(--border); padding: 12px 24px;
  border-radius: 14px; font-weight: 600; transition: var(--transition);
}
.btn-outline:hover { background: var(--bg-hover); }
.btn-secondary { background: var(--bg-card); border: 1px solid var(--border); padding: 12px; border-radius: 12px; }
.full { width: 100%; }

/* Notes Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; align-content: start;
}

.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  transition: var(--transition);
  position: relative;
}
.note-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.note-card-title { font-weight: 700; margin-bottom: 8px; font-size: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.note-card-preview { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; }
.note-card-footer { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-muted); }

/* Editor */
.panel-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.input-title {
  width: 100%; font-size: 32px; font-weight: 800; padding: 24px 32px 10px;
  letter-spacing: -1px;
}
.editor-fields { flex: 1; display: flex; flex-direction: column; }
.editor-meta { padding: 0 32px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#note-body, #quote-text {
  flex: 1; padding: 0 32px 32px; font-family: 'Lora', serif; font-size: 18px;
  resize: none; width: 100%;
}

/* Todo Sidebar */
#todo-sidebar {
  width: 320px;
  background: #161b22;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: var(--transition);
}
.todo-header { padding: 24px; }
.todo-input-wrap { display: flex; padding: 0 24px 20px; gap: 8px; }
.todo-input-wrap input { flex: 1; background: var(--bg-darker); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.todo-input-wrap button { background: var(--success); color: white; border-radius: 8px; width: 36px; height: 36px; font-weight: bold; }

.todo-item { display: flex; align-items: center; gap: 10px; padding: 10px 24px; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.todo-item.done .text { text-decoration: line-through; color: var(--text-muted); }
.check { width: 18px; height: 18px; border: 2px solid var(--border); border-radius: 4px; }
.todo-item.done .check { background: var(--success); border-color: var(--success); }

/* Mobile Support */
.mobile-only { display: none; }

@media (max-width: 900px) {
  #sidebar, #todo-sidebar {
    position: fixed; top: 0; bottom: 0; z-index: 100;
    width: 280px;
  }
  #sidebar { left: -280px; }
  #sidebar.active { left: 0; }
  
  #todo-sidebar { right: -280px; }
  #todo-sidebar.active { right: 0; }

  .mobile-only { display: flex; }
  .mobile-nav {
    height: 60px; padding: 0 20px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border);
    align-items: center; justify-content: space-between;
  }
  .nav-logo { font-weight: bold; font-size: 18px; letter-spacing: -1px; }

  #main-content { min-width: 0; }
  
  .input-title { font-size: 24px; padding: 20px 20px 10px; }
  .editor-meta { padding: 0 20px 20px; }
  #note-body { padding: 0 20px 20px; font-size: 16px; }

  #overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 90;
  }
  #overlay.hidden { display: none; }
}

/* Modals */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 32px; border-radius: 20px; width: 90%; max-width: 400px;
}
.emoji-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 20px 0; max-height: 150px; overflow-y: auto; }
.emoji-item { font-size: 24px; padding: 10px; border-radius: 8px; }
.emoji-item.selected { background: var(--bg-hover); border: 1px solid var(--primary); }

#folder-name-input { width: 100%; background: var(--bg-darker); padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; }
