/* ===================================
   Notion-Inspired Styles
   Clean, minimal, typography-focused
   =================================== */

:root {
  /* Light mode - Notion-like palette */
  --bg: #FFFFFF;
  --bg-secondary: #F7F7F5;
  --text: #37352F;
  --text-secondary: #787774;
  --text-tertiary: #9B9A97;
  --border: #E9E9E7;
  --border-hover: #C3C2C9;
  --card-bg: #FFFFFF;
  --card-hover: #F7F7F5;
  --accent: #2383E2;
  --accent-hover: #0B6CDC;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --code-bg: #F7F7F5;
}

.dark {
  /* Dark mode - Notion-like palette */
  --bg: #191919;
  --bg-secondary: #202020;
  --text: #D4D4D4;
  --text-secondary: #9B9A97;
  --text-tertiary: #6B6B6B;
  --border: #373C3F;
  --border-hover: #545B5E;
  --card-bg: #2F3437;
  --card-hover: #373C3F;
  --accent: #57A8FF;
  --accent-hover: #7AB8FF;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
  --code-bg: #2F3437;
}

/* ===================================
   Base & Reset
   =================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.15s ease, color 0.15s ease;
}

/* ===================================
   Layout
   =================================== */

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 40px;
}

main {
  padding: 48px 0 96px;
  min-height: calc(100vh - 160px);
}

/* ===================================
   Header
   =================================== */

.site-header {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.1s ease;
}

.header-nav a:hover {
  color: var(--text);
}

/* ===================================
   Page Header
   =================================== */

.page-header {
  margin-bottom: 40px;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ===================================
   Ideas List (Notion Database View)
   =================================== */

.ideas-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

/* ===================================
   Idea Cards (List View)
   =================================== */

.idea-card {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

.idea-card:last-child {
  border-bottom: none;
}

.idea-card:hover {
  background: var(--card-hover);
}

.card-link {
  display: block;
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
}

.idea-card h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.4;
}

.card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-date {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ===================================
   Idea Detail Page
   =================================== */

.idea-detail {
  max-width: 680px;
  margin: 0 auto;
}

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

.back-link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.1s ease;
}

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

.idea-meta time {
  font-size: 13px;
  color: var(--text-tertiary);
}

.idea-content {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}

/* Typography in content */
.idea-content h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 32px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.idea-content h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 24px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.idea-content p {
  margin-bottom: 16px;
}

.idea-content strong {
  font-weight: 600;
}

.idea-content em {
  font-style: italic;
}

.idea-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.1s ease;
}

.idea-content a:hover {
  border-bottom-color: var(--accent);
}

/* Code blocks */
.idea-content code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  color: var(--text);
}

.idea-content pre {
  background: var(--code-bg);
  padding: 12px 16px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 16px 0;
}

.idea-content pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Lists */
.idea-content ul {
  list-style: disc;
  padding-left: 24px;
  margin: 12px 0 16px;
}

.idea-content ul li {
  margin-bottom: 4px;
  line-height: 1.6;
}

.idea-content ul li::marker {
  color: var(--text-secondary);
}

/* Blockquotes */
.idea-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Horizontal Rule */
.idea-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ===================================
   Admin Pages
   =================================== */

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.admin-header h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table thead {
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover {
  background: var(--card-hover);
}

.admin-table .slug {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===================================
   Forms
   =================================== */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.1);
}

.form-group textarea {
  min-height: 200px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  line-height: 1.6;
}

.form-help {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-error {
  padding: 12px 16px;
  background: rgba(255, 87, 87, 0.1);
  border: 1px solid rgba(255, 87, 87, 0.2);
  border-radius: 4px;
  color: #E03E3E;
  font-size: 14px;
  margin-bottom: 20px;
}

.dark .form-error {
  background: rgba(255, 120, 120, 0.15);
  border-color: rgba(255, 120, 120, 0.25);
  color: #FF9E9E;
}

/* ===================================
   Buttons
   =================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s ease, border-color 0.1s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--card-hover);
  border-color: var(--border-hover);
}

.btn:active {
  background: var(--bg-secondary);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

.btn-danger {
  color: #E03E3E;
  border-color: rgba(255, 87, 87, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 87, 87, 0.1);
  border-color: rgba(255, 87, 87, 0.4);
}

.dark .btn-danger {
  color: #FF9E9E;
  border-color: rgba(255, 120, 120, 0.3);
}

.dark .btn-danger:hover {
  background: rgba(255, 120, 120, 0.15);
  border-color: rgba(255, 120, 120, 0.4);
}

/* ===================================
   Theme Toggle
   =================================== */

.theme-toggle {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
  color: var(--text);
}

.theme-toggle:hover {
  background: var(--card-hover);
  border-color: var(--border-hover);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* ===================================
   Footer
   =================================== */

footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ===================================
   Login Page
   =================================== */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.login-card h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  text-align: center;
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  main {
    padding: 32px 0 64px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .idea-detail h1 {
    font-size: 28px;
    letter-spacing: -0.03em;
  }

  .idea-content {
    font-size: 15px;
  }

  .idea-content h2 {
    font-size: 20px;
  }

  .idea-content h3 {
    font-size: 16px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .admin-table {
    font-size: 13px;
  }

  .admin-table th,
  .admin-table td {
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 8px 0;
  }

  .login-card {
    padding: 24px 20px;
  }

  .idea-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
