/* ============================================
   Blog Styles — Matches Portfolio Dark Theme
   ============================================ */

/* Shared base (inherits from ../style.css variables) */
.blog-page {
  min-height: 100vh;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-family: var(--font-body);
}

/* ============ Blog Header ============ */
.blog-header {
  text-align: center;
  padding: 8rem 0 3rem;
}

.blog-header h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.blog-header h1 span {
  background: linear-gradient(to right, var(--color-accent), #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.blog-header p {
  color: var(--color-text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.blog-search {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

.blog-search i {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.blog-search input {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 3rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50px;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

.blog-search input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

/* ============ Blog Grid ============ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
  padding-bottom: 4rem;
}

.blog-card {
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 0.3s ease,
              box-shadow 0.4s ease;
}

.blog-card:hover {
  transform: translateY(-8px);
  border-color: var(--color-accent);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5),
              0 0 20px rgba(249, 115, 22, 0.08);
}

.blog-card-image {
  height: 180px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.blog-card-gradient {
  background: linear-gradient(135deg, 
    rgba(249, 115, 22, 0.15) 0%, 
    rgba(139, 92, 246, 0.15) 50%,
    rgba(6, 182, 212, 0.1) 100%);
}

.blog-card-body {
  padding: 1.5rem;
}

.blog-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.blog-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  line-height: 1.3;
  color: var(--color-text-primary);
}

.blog-card-excerpt {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.blog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.blog-tag {
  font-size: 0.7rem;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.2);
  color: var(--color-accent);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 6rem 2rem;
  color: var(--color-text-muted);
}

.blog-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.blog-empty h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-secondary);
}

/* ============ Post View ============ */
.blog-post-view {
  max-width: 800px;
  margin: 0 auto;
  padding: 8rem 0 4rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2rem;
  transition: gap 0.3s ease;
}

.back-link:hover {
  gap: 0.8rem;
}

.blog-post-view #post-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

#post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Markdown rendered content */
.post-content {
  line-height: 1.9;
  color: var(--color-text-secondary);
  font-size: 1.05rem;
}

.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
  color: var(--color-text-primary);
  margin: 2rem 0 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.6rem; }
.post-content h3 { font-size: 1.3rem; }

.post-content p { margin-bottom: 1.2rem; }

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

.post-content img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  margin: 1.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.post-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.5rem 1.5rem;
  margin: 1.5rem 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--color-text-secondary);
}

.post-content pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.post-content :not(pre) > code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--color-accent);
}

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

.post-content li { margin-bottom: 0.4rem; }

.post-content hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin: 2.5rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.post-content th, .post-content td {
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.post-content th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  color: var(--color-text-primary);
}

/* ============ Editor Layout ============ */
.editor-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.editor-sidebar {
  background: rgba(10, 10, 10, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

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

.sidebar-header button,
.sidebar-actions button {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-header button:hover,
.sidebar-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-accent);
}

#new-post-btn {
  background: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
  color: #fff !important;
}

#new-post-btn:hover {
  background: var(--color-accent-hover) !important;
}

.posts-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.sidebar-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.sidebar-post {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.sidebar-post:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-post.active {
  background: rgba(249, 115, 22, 0.08);
  border-left: 3px solid var(--color-accent);
}

.sidebar-post-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.sidebar-post-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.sidebar-post-status {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.sidebar-post-status.published {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.sidebar-post-status.draft {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

/* Editor Main */
.editor-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-toolbar {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 10, 10, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.meta-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.meta-fields input {
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.meta-fields input:focus {
  border-color: var(--color-accent);
}

.meta-fields input::placeholder {
  color: var(--color-text-muted);
}

.toolbar-actions {
  display: flex;
  gap: 0.25rem;
}

.toolbar-actions button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.toolbar-actions button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Editor Panes */
.editor-panes {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.editor-write {
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
}

.editor-write textarea {
  width: 100%;
  padding: 1.5rem;
  background: transparent;
  border: none;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.8;
  resize: none;
  outline: none;
  overflow-y: auto;
}

.editor-write textarea::placeholder {
  color: var(--color-text-muted);
}

.editor-write textarea.drag-over {
  background: rgba(249, 115, 22, 0.03);
  outline: 2px dashed var(--color-accent);
  outline-offset: -8px;
}

.editor-preview {
  overflow-y: auto;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.01);
}

.preview-content {
  line-height: 1.9;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

/* Reuse post-content styles for preview */
.preview-content h1, .preview-content h2, .preview-content h3,
.preview-content h4, .preview-content h5, .preview-content h6 {
  color: var(--color-text-primary);
  margin: 1.5rem 0 0.75rem;
  font-weight: 700;
}

.preview-content h1 { font-size: 1.8rem; }
.preview-content h2 { font-size: 1.5rem; }
.preview-content h3 { font-size: 1.2rem; }
.preview-content p { margin-bottom: 1rem; }

.preview-content a { color: var(--color-accent); }

.preview-content img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 1rem 0;
}

.preview-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.preview-content pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.preview-content code { font-family: var(--font-mono); font-size: 0.85em; }

.preview-content :not(pre) > code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--color-accent);
}

.preview-content ul, .preview-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.preview-content li { margin-bottom: 0.3rem; }

.preview-placeholder {
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
  margin-top: 3rem;
}

/* Editor Footer */
.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 10, 10, 0.6);
}

.editor-status {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.editor-status.success { color: var(--color-success); }
.editor-status.error { color: var(--color-error); }

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

.editor-actions .btn {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.editor-actions .btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

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

.editor-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}

.editor-actions .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

.editor-actions .btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.editor-actions .btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

/* ============ Blog Navbar (reuse portfolio nav) ============ */
.blog-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  background: rgba(5, 5, 5, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.blog-nav .nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-primary);
  text-decoration: none;
}

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

.blog-nav .nav-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.blog-nav .nav-links a:hover,
.blog-nav .nav-links a.active {
  color: var(--color-accent);
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .blog-grid { grid-template-columns: 1fr; }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    display: none;
  }

  .editor-panes {
    grid-template-columns: 1fr;
  }

  .editor-preview {
    display: none;
  }

  .meta-fields {
    grid-template-columns: 1fr;
  }

  .blog-header {
    padding: 6rem 1rem 2rem;
  }
}
