/* Reset & basics */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  height: 100vh;
  background: #f5f5f5;
  color: #1a1a1a;
  overflow: hidden;
}

/* App layout */
.app {
  display: flex;
  height: 100%;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: #ffffff;
  border-right: 1px solid #e0e0e0;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar button {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 1rem;
  border: none;
  border-radius: 12px;
  background: #6200ee;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar button:hover {
  background: #3700b3;
}

.sidebar ul {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

.sidebar li {
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.2s;
  margin-bottom: 4px;
}

.sidebar li:hover {
  background: #e8e8e8;
}

/* Collapse icon */
.collapse-btn {
  margin-top: auto;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 50%;
  border: 1px solid #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s;
}

.collapse-btn:hover {
  background: #f0f0f0;
}

/* Editor */
.editor {
  flex: 1;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  background: #fdfdfd;
  overflow-y: auto;
}

#noteTitle {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  border: 1px solid #ccc;
}

#noteContent {
  flex: 1;
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px solid #ccc;
  resize: none;
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* Toolbar buttons */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 0.8rem;
}

.toolbar button {
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  border: none;
  background: #6200ee;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.toolbar button:hover {
  background: #3700b3;
}

/* Attachments */
.attachments {
  margin-bottom: 1rem;
}

.file-item {
  margin-top: 6px;
  padding: 0.4rem;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fafafa;
}

.file-item img {
  max-width: 180px;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 4px;
}

.file-item iframe {
  width: 100%;
  height: 300px;
  border-radius: 12px;
  border: none;
  background: #eee;
}

#linkPreview {
  padding: 0.5rem;
  border-radius: 12px;
  background: #f1f1f1;
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0.5rem;
}

/* Fullscreen image modal */
#imageModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#imageModal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

/* Scrollbar styling */
.sidebar ul::-webkit-scrollbar,
.editor::-webkit-scrollbar {
  width: 6px;
}

.sidebar ul::-webkit-scrollbar-thumb,
.editor::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* Responsive adjustments */
@media(max-width: 768px){
  .sidebar {
    position: absolute;
    z-index: 10;
    left: -250px;
    top: 0;
    height: 100%;
    transition: left 0.3s ease;
  }

  .sidebar.active {
    left: 0;
  }

  .editor {
    padding: 1rem 0.8rem;
  }
}
