/* ============================================
   MINIMALIST BLOG - CSS
   Intentional Minimalism + Avant-Garde Design
   ============================================ */

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

:root {
  /* Light Theme (Default) */
  --bg: #fafafa;
  --bg-secondary: #ffffff;
  --text: #0a0a0a;
  --text-muted: #737373;
  --border: #e5e5e5;
  --primary: #0a0a0a;
  --primary-hover: #262626;
  --accent: #6366f1;
  --card-hover: rgba(0, 0, 0, 0.02);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
.dark {
  --bg: #0a0a0a;
  --bg-secondary: #171717;
  --text: #fafafa;
  --text-muted: #a3a3a3;
  --border: #262626;
  --primary: #fafafa;
  --primary-hover: #e5e5e5;
  --card-hover: rgba(255, 255, 255, 0.02);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Rose Theme */
.rose {
  --bg: #fff1f2;
  --bg-secondary: #ffffff;
  --text: #1f1f1f;
  --text-muted: #6b6b6b;
  --border: #fecdd3;
  --primary: #e11d48;
  --primary-hover: #be123c;
  --accent: #e11d48;
}

/* Ocean Theme */
.ocean {
  --bg: #0c1222;
  --bg-secondary: #131c31;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #1e3a5f;
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --accent: #38bdf8;
  --card-hover: rgba(56, 189, 248, 0.05);
}

/* Forest Theme */
.forest {
  --bg: #f0fdf4;
  --bg-secondary: #ffffff;
  --text: #14532d;
  --text-muted: #4d7c5f;
  --border: #bbf7d0;
  --primary: #16a34a;
  --primary-hover: #15803d;
  --accent: #16a34a;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

/* ============ Layout ============ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============ Navbar ============ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: var(--bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  transition: transform var(--transition);
}

.logo:hover .logo-icon {
  transform: rotate(6deg);
}

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

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ============ Theme Switcher ============ */
.theme-switcher {
  position: relative;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
}

.theme-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  text-align: left;
}

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

.theme-option.active {
  background: var(--card-hover);
}

.theme-option svg:first-child {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.theme-option.active svg:first-child {
  color: var(--accent);
}

.theme-option span {
  flex: 1;
}

.theme-option svg:last-child {
  color: var(--accent);
  margin-left: auto;
}

/* ============ Hero Section ============ */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6rem 1.5rem 4rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, transparent 50%, rgba(99, 102, 241, 0.08) 100%);
}

.floating-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: float 8s ease-in-out infinite;
}

.shape-1 {
  width: 300px;
  height: 300px;
  background: var(--accent);
  opacity: 0.08;
  top: 10%;
  left: 10%;
}

.shape-2 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  opacity: 0.05;
  bottom: 10%;
  right: 10%;
  animation-delay: -4s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(30px) scale(1.1);
  }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
}

.hero-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 3rem;
}

.scroll-indicator {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(10px);
  }
}

/* ============ Cards ============ */
.section {
  padding: 4rem 0;
}

.section-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.section-label.muted {
  color: var(--text-muted);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.card {
  display: block;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--text-muted);
}

.card-hover-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, var(--card-hover) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.card:hover .card-hover-gradient {
  opacity: 1;
}

.card-content {
  position: relative;
  z-index: 1;
}

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

.tag {
  padding: 0.25rem 0.75rem;
  background: var(--card-hover);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.card-title-lg {
  font-size: 1.75rem;
}

.card-excerpt {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.meta-info {
  display: flex;
  gap: 1rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.arrow-icon {
  color: var(--text-muted);
  transition: transform var(--transition);
}

.card:hover .arrow-icon {
  transform: translate(4px, -4px);
  color: var(--primary);
}

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  text-align: center;
}

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

/* ============ Animations ============ */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 0;
}

.delay-1 {
  animation-delay: 0.1s;
}
.delay-2 {
  animation-delay: 0.2s;
}
.delay-3 {
  animation-delay: 0.3s;
}
.delay-4 {
  animation-delay: 0.4s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .nav-links {
    gap: 1rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 60vh;
  }
}

/* ============ Profile Page ============ */
.profile-page {
  min-height: 100vh;
  padding: 6rem 1.5rem 3rem;
}

.profile-container {
  max-width: 640px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 2rem;
  transition: color var(--transition);
}

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

.profile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  background: var(--primary);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
}

.profile-info h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.profile-info p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.account-info {
  display: flex;
  flex-direction: column;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.account-row:last-child {
  border-bottom: none;
}

.account-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.account-value {
  font-weight: 500;
  font-size: 0.9375rem;
}

/* ============ Write Page ============ */
.write-page {
  min-height: 100vh;
  padding: 6rem 1.5rem 3rem;
}

.write-container {
  max-width: 800px;
  margin: 0 auto;
}

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

.write-actions {
  display: flex;
  gap: 0.75rem;
}

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

.write-title-input {
  width: 100%;
  padding: 1rem 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: border-color var(--transition);
}

.write-title-input:focus {
  outline: none;
  border-color: var(--primary);
}

.write-title-input::placeholder {
  color: var(--text-muted);
}

.write-excerpt-input {
  width: 100%;
  padding: 0.75rem 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 1.125rem;
  color: var(--text-muted);
  transition: border-color var(--transition);
}

.write-excerpt-input:focus {
  outline: none;
  border-color: var(--primary);
  color: var(--text);
}

.write-excerpt-input::placeholder {
  color: var(--text-muted);
}

.tags-section label,
.content-section label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

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

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: var(--card-hover);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.tag-item button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}

.tag-item button:hover {
  color: var(--text);
}

.tag-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.tag-input-wrapper input {
  flex: 1;
  padding: 0.625rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
}

.tag-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-icon-sm {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon-sm:hover {
  background: var(--card-hover);
  border-color: var(--text-muted);
}

.tag-hint,
.content-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.write-content-input {
  width: 100%;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  line-height: 1.7;
  resize: vertical;
  min-height: 400px;
}

.write-content-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Write Preview */
.write-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.preview-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.preview-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.preview-excerpt {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.preview-meta {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.preview-content {
  font-size: 1.0625rem;
  line-height: 1.8;
}

.preview-content h1,
.preview-content h2,
.preview-content h3 {
  margin: 1.5rem 0 1rem;
  font-weight: 600;
}

.preview-content code {
  background: var(--card-hover);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ============================================
   RICH TEXT EDITOR
   ============================================ */

.rich-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-secondary);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.rich-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Toolbar */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 8px;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

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

.toolbar-btn:active {
  background: var(--border);
  transform: scale(0.95);
}

.toolbar-btn svg {
  width: 16px;
  height: 16px;
}

/* Editor Content Area */
.editor-content {
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  padding: 20px 24px;
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text);
  outline: none;
}

.editor-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* Editor Content Styling */
.editor-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 1.5rem 0 1rem;
  letter-spacing: -0.02em;
}

.editor-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.editor-content p {
  margin-bottom: 1rem;
}

.editor-content ul,
.editor-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.editor-content li {
  margin-bottom: 0.5rem;
}

.editor-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--accent);
  background: var(--card-hover);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-muted);
}

.editor-content code {
  background: var(--card-hover);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9em;
  color: var(--accent);
}

.editor-content pre {
  background: var(--bg);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1rem 0;
}

.editor-content pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

.editor-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.editor-content a:hover {
  text-decoration-thickness: 2px;
}

.editor-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
}

.editor-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

/* Responsive Toolbar */
@media (max-width: 640px) {
  .editor-toolbar {
    padding: 6px 8px;
    gap: 1px;
  }

  .toolbar-btn {
    width: 28px;
    height: 28px;
  }

  .toolbar-btn svg {
    width: 14px;
    height: 14px;
  }

  .toolbar-divider {
    margin: 0 4px;
    height: 20px;
  }

  .editor-content {
    min-height: 300px;
    padding: 16px;
  }
}

/* ============================================
   POST ACTIONS (Edit/Delete)
   ============================================ */

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

.post-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-danger {
  color: #ef4444 !important;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1) !important;
}

/* Delete Modal Danger Styling */
.modal-icon-danger {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.btn-confirm-danger {
  background: #ef4444 !important;
}

.btn-confirm-danger:hover {
  background: #dc2626 !important;
}

/* Responsive */
@media (max-width: 640px) {
  .post-header-actions {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .post-actions {
    width: 100%;
  }

  .post-actions .btn {
    flex: 1;
    justify-content: center;
  }
}
