:root {
  --bg-color: #080808;
  --bg-sidebar: #111111;
  --text-main: #e0e0e0;
  --text-sub: #7a7a7a;
  --accent: #d32f2f;
  --border: #2a2a2a;
  --font-base: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Noto Serif JP', 'Georgia', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-base);
  line-height: 1.6;
  letter-spacing: 0.05em;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

a {
  color: var(--text-sub);
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: var(--text-main);
}

.global-header {
  position: sticky;
  top: 0;
  width: 100%;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border);
  padding: 15px 0;
  z-index: 100;
  display: flex;
  align-items: center;
}

.back-link:hover {
  color: var(--text-main) !important;
}

.app-container {
  display: flex;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  height: calc(100vh - 60px); /* Adjust for header height */
}

/* Sidebar */
.sidebar {
  width: 300px;
  min-width: 300px;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

/* Global Site Title */
.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  text-decoration: none;
}

.site-title::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
}

/* Section Titles */
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 15px;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
}

/* Calendar */
.calendar-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  text-align: center;
}

.cal-day {
  font-size: 0.8rem;
  color: var(--text-sub);
  padding: 5px 0;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s;
}

.cal-day:hover {
  color: var(--text-main);
  background-color: var(--border);
}

.cal-day.active {
  color: var(--accent);
  border: 1px solid var(--border);
}

.cal-day.has-post {
  font-weight: bold;
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.cal-header {
  font-size: 0.7rem;
  color: var(--border);
  margin-bottom: 10px;
}

/* Recent Entries Sidebar List */
.entries-section {
  padding: 20px;
  flex-grow: 1;
}

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.entry-item {
  cursor: pointer;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.2s;
}

.entry-item:hover {
  opacity: 0.7;
}

.entry-item:last-child {
  border-bottom: none;
}

.entry-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-sub);
  margin-bottom: 5px;
}

.entry-status.public { color: var(--accent); }
.entry-status.private { color: var(--text-sub); }
.entry-status.draft { color: #555; }

.entry-excerpt {
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pagination {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 2px 8px;
  font-size: 0.8rem;
  min-width: 25px;
  text-align: center;
}
.pagination button.active {
  color: var(--accent);
  border-color: var(--accent);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  overflow-x: hidden;
}

/* Editor & View components */
.odai-badge {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 8px;
  border-radius: 2px;
  letter-spacing: 0.1em;
}

.moon-phase {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-left: 15px;
  letter-spacing: 0.1em;
}

.odai-mode-tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  margin-top: 15px;
}

.odai-tab {
  font-size: 0.75rem;
  color: var(--text-sub);
  cursor: pointer;
  padding-bottom: 5px;
  border-bottom: 1px solid transparent;
  transition: all 0.3s;
  letter-spacing: 0.05em;
}

.odai-tab.active {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}

.odai-text {
  font-size: 1.5rem;
  font-family: var(--font-serif);
  color: var(--text-main);
  margin-bottom: 30px;
  line-height: 1.4;
}

.editor-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"],
select {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text-sub);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: var(--font-base);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

textarea {
  flex-grow: 1;
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 20px;
  font-family: var(--font-base);
  font-size: 1rem;
  line-height: 1.8;
  resize: none;
  outline: none;
  border-radius: 3px;
  margin-bottom: 20px;
  max-width: 100%;
}

/* Buttons */
.btn-submit {
  align-self: flex-end;
  background-color: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 10px 30px;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 3px;
}

.btn-submit:hover {
  background-color: var(--accent);
  color: #fff;
}

.action-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-sub);
  border: 1px solid var(--border);
  padding: 5px 15px;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  color: var(--text-main);
  border-color: var(--text-main);
}

/* Post Render */
.post-view {
  margin-top: 20px;
  flex-grow:1;
  width: 100%;
}
.post-view-date {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 20px;
}
.post-view-content {
  font-size: 1rem;
  line-height: 2;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Login simple */
.login-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}
.login-wrap input {
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: #fff;
  margin-bottom: 20px;
}

/* Notification */
#notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text-main);
  color: var(--bg-color);
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 1000;
}
#notification.show { opacity: 1; }

/* Responsive */
@media (max-width: 768px) {
  body {
    height: auto;
    overflow-y: auto;
  }
  .global-header {
    padding: 15px 20px;
  }
  .app-container {
    flex-direction: column;
    overflow-y: visible;
    height: auto;
    padding: 0 15px 20px;
  }
  .cursor-dot, .cursor-outline { display: none; }
  .sidebar {
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border);
    margin-top: 40px;
  }
  .main-content {
    overflow-y: visible;
    padding: 20px 0;
  }
}

/* Custom Scrollbar for Dark Theme */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-sub);
}

/* Custom Cursors */
.cursor-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, opacity 0.3s;
}

.cursor-outline {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(230, 57, 70, 0.4);
  background-color: transparent;
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, background-color 0.3s, border-color 0.3s;
}
