/* CSS Custom Properties for theming */
:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
  --color-accent: #0066cc;
  --color-border: #e0e0e0;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --max-width: 650px;
}

[data-theme="dark"] {
  --color-bg: #1a1a1a;
  --color-text: #e0e0e0;
  --color-text-muted: #999999;
  --color-accent: #66b3ff;
  --color-border: #333333;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Base */
html {
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
  line-height: 1.3;
  margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  margin-bottom: 1em;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--color-border);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre {
  font-family: var(--font-mono);
  background-color: var(--color-border);
  padding: 1em;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 1em;
}

pre code {
  background: none;
  padding: 0;
}

/* Layout */
header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

header nav {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 600;
  color: var(--color-text);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--color-text-muted);
}

.nav-links a:hover {
  color: var(--color-text);
  text-decoration: none;
}

main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  width: 100%;
}

footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--color-border);
}

/* Theme Toggle */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
  color: var(--color-text);
}

.sun-icon { display: none; }
.moon-icon { display: inline; }

[data-theme="dark"] .sun-icon { display: inline; }
[data-theme="dark"] .moon-icon { display: none; }

/* Home Page */
.home {
  text-align: center;
  padding: 4rem 0;
}

.home h1 {
  margin-bottom: 1rem;
}

.home .intro {
  color: var(--color-text-muted);
  max-width: 400px;
  margin: 0 auto 2rem;
}

.home-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.home-nav .separator {
  color: var(--color-text-muted);
}

/* Empty State */
.empty-state {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Blog List */
.blog-list h1 {
  margin-bottom: 2rem;
}

.post-list {
  list-style: none;
}

.post-item {
  margin-bottom: 1rem;
}

.post-item a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--color-text);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.post-item a:hover {
  text-decoration: none;
  color: var(--color-accent);
}

.post-title {
  font-weight: 500;
}

.post-date {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Blog Post */
.blog-post {
  max-width: 100%;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.post-header h1 {
  margin-bottom: 0.5rem;
}

.post-header .post-date {
  color: var(--color-text-muted);
}

.post-content {
  margin-bottom: 2rem;
}

.post-content h2 {
  margin-top: 2rem;
}

.post-content ul, .post-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.post-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

/* Projects */
.projects-list h1 {
  margin-bottom: 2rem;
}

.projects {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-card {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

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

.project-name {
  margin-bottom: 0.5rem;
}

.project-description {
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background-color: var(--color-border);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}

.project-links {
  display: flex;
  gap: 1rem;
}

/* Quotes */
.quotes-list h1 {
  margin-bottom: 1rem;
}

.random-quote-btn {
  background-color: var(--color-accent);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.random-quote-btn:hover {
  opacity: 0.9;
}

#random-quote {
  margin-bottom: 2rem;
}

#random-quote:empty {
  display: none;
}

.quotes {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.quote-card {
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--color-border);
  margin: 0;
}

.quote-card.quote-own {
  border-left-color: var(--color-accent);
}

.quote-content {
  font-style: italic;
  margin-bottom: 0.5rem;
}

.quote-author {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.own-marker {
  color: var(--color-accent);
  margin-left: 0.25rem;
}

/* Admin Styles */
.admin-login {
  max-width: 300px;
  margin: 4rem auto;
  text-align: center;
}

.admin-login h1 {
  margin-bottom: 1.5rem;
}

.admin-login .error {
  color: #dc3545;
  margin-bottom: 1rem;
}

.admin-dashboard {
  max-width: 100%;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.admin-section {
  margin-bottom: 3rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.section-header h2 {
  margin: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.admin-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.admin-table .actions {
  display: flex;
  gap: 1rem;
}

.admin-table .quote-preview {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}

.status-published {
  background-color: #d4edda;
  color: #155724;
}

.status-draft {
  background-color: #fff3cd;
  color: #856404;
}

[data-theme="dark"] .status-published {
  background-color: #1e4620;
  color: #a3d9a5;
}

[data-theme="dark"] .status-draft {
  background-color: #4a3f00;
  color: #ffc107;
}

.inline-form {
  display: inline;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-danger {
  color: #dc3545;
}

/* Editor */
.admin-editor {
  max-width: 100%;
}

.editor-header {
  margin-bottom: 2rem;
}

.editor-header a {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}

.editor-header h1 {
  margin: 0;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
}

.form-group textarea {
  resize: vertical;
  font-family: var(--font-mono);
}

.form-group.checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-group.checkbox input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
}

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

.btn-primary:hover {
  opacity: 0.9;
  text-decoration: none;
}

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

.btn-secondary:hover {
  opacity: 0.8;
  text-decoration: none;
}

/* Invite Success */
.invite-success {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: var(--color-card-bg);
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.invite-success p {
  margin-bottom: 1rem;
}

.invite-link-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.invite-url-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
