/* blog.css - Updated for image support */

.blog-hero {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(
    135deg,
    rgba(0, 200, 150, 0.1),
    rgba(5, 10, 22, 0.95)
  );
  padding-top: 100px;
}

.blog-hero-content {
  max-width: 800px;
  padding: 2rem;
}

.gold-text {
  color: var(--gold);
}

.blog-search {
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  max-width: 400px;
  margin: 2rem auto 0;
}

.blog-search i {
  color: var(--text-muted);
  margin-right: 0.75rem;
}

.blog-search input {
  background: none;
  border: none;
  color: var(--white);
  width: 100%;
  outline: none;
}

.blog-search input::placeholder {
  color: var(--text-muted);
}

/* ====================================
BLOG FILTER
==================================== */
.blog-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.filter-btn {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  color: var(--white);
  cursor: pointer;
  transition: 0.3s;
  font-size: 0.875rem;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--gradient-primary);
  color: var(--dark);
  border-color: transparent;
}

/* ====================================
BLOG GRID SECTION
==================================== */
.blog-grid-section {
  padding: 4rem clamp(1rem, 5vw, 6rem);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ====================================
BLOG CARD
==================================== */
.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-10px);
  border-color: var(--secondary);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Featured Blog Card - 2 column layout */
.blog-card.featured {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.blog-card.featured .blog-image {
  height: 100%;
  min-height: 300px;
}

.blog-card.featured .blog-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ====================================
BLOG IMAGE STYLES
==================================== */
.blog-image {
  background: linear-gradient(135deg, var(--primary), var(--bg-dark));
  min-height: 220px;
  overflow: hidden;
  position: relative;
}

.blog-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.blog-card:hover .blog-image img {
  transform: scale(1.05);
}

/* Fallback for image loading errors */
.blog-image img[src=""],
.blog-image img:not([src]) {
  opacity: 0;
}

/* Style for blog cards that still use icons (as fallback) */
.blog-image i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  color: var(--gold);
}

/* ====================================
BLOG CONTENT
==================================== */
.blog-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(0, 200, 150, 0.15);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--secondary);
  width: fit-content;
}

.blog-card h3 {
  margin-bottom: 0.75rem;
  line-height: 1.4;
  font-size: 1.25rem;
  transition: color 0.3s;
}

.blog-card:hover h3 {
  color: var(--gold);
}

.blog-content p {
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ====================================
BLOG META
==================================== */
.blog-meta {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.blog-meta i {
  margin-right: 0.25rem;
}

/* ====================================
READ MORE BUTTON
==================================== */
.read-more {
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: 0.3s;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: auto;
}

.read-more:hover {
  gap: 1rem;
  color: var(--secondary);
}

/* ====================================
LOAD MORE BUTTON
==================================== */
.load-more {
  text-align: center;
  margin-top: 3rem;
}

.load-more .btn-secondary {
  background: transparent !important;
  border: 1px solid var(--gold);
  color: var(--gold);
  transition: 0.3s;
}

.load-more .btn-secondary:hover {
  background: var(--gradient-gold) !important;
  color: var(--dark);
  transform: translateY(-3px);
}

/* ====================================
NEWSLETTER SECTION
==================================== */
.newsletter {
  background: var(--card-bg);
  padding: 4rem clamp(1rem, 5vw, 6rem);
  text-align: center;
  margin-top: 2rem;
}

.newsletter-content {
  max-width: 600px;
  margin: 0 auto;
}

.newsletter-content h2 {
  margin-bottom: 1rem;
}

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

.newsletter-form input {
  flex: 1;
  padding: 1rem 1.25rem;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--white);
  outline: none;
  font-size: 1rem;
}

.newsletter-form input:focus {
  border-color: var(--secondary);
}

.newsletter-form input::placeholder {
  color: var(--text-muted);
}

.newsletter-form button {
  white-space: nowrap;
}

/* ====================================
RESPONSIVE DESIGN
==================================== */
@media (max-width: 992px) {
  .blog-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
  }
}

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

  .blog-card.featured {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }

  .blog-card.featured .blog-image {
    min-height: 200px;
  }

  .blog-image {
    min-height: 180px;
  }

  .blog-content {
    padding: 1.25rem;
  }

  .blog-card h3 {
    font-size: 1.125rem;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-form button {
    width: 100%;
  }

  .blog-filter {
    gap: 0.75rem;
  }

  .filter-btn {
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .blog-grid-section {
    padding: 2rem 1rem;
  }

  .blog-image {
    min-height: 160px;
  }

  .blog-card h3 {
    font-size: 1rem;
  }

  .blog-content p {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
  }

  .blog-meta {
    font-size: 0.7rem;
  }
}

/* ====================================
ANIMATION FOR LOADING
==================================== */
.blog-card {
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

/* Complete blog hero typography solution */
.blog-hero h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.5rem;
}

.blog-hero h1 .gold-text {
  white-space: nowrap;
}

/* On very small screens, stack gracefully */
@media (max-width: 480px) {
  .blog-hero h1 {
    flex-direction: column;
    gap: 0.25rem;
  }

  .blog-hero h1 .gold-text {
    white-space: normal;
  }
}

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

/* Stagger animation for cards */
.blog-card:nth-child(1) {
  animation-delay: 0.05s;
}
.blog-card:nth-child(2) {
  animation-delay: 0.1s;
}
.blog-card:nth-child(3) {
  animation-delay: 0.15s;
}
.blog-card:nth-child(4) {
  animation-delay: 0.2s;
}
.blog-card:nth-child(5) {
  animation-delay: 0.25s;
}
.blog-card:nth-child(6) {
  animation-delay: 0.3s;
}
.blog-card:nth-child(7) {
  animation-delay: 0.35s;
}
.blog-card:nth-child(8) {
  animation-delay: 0.4s;
}

/* ====================================
EMPTY STATE FOR NO RESULTS
==================================== */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem;
  background: var(--glass-bg);
  border-radius: 24px;
  border: 1px solid var(--border);
}

.no-results i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.no-results p {
  font-size: 1.1rem;
}

/* ====================================
BLOG ADMIN PANEL
==================================== */
.blog-admin-section {
  padding: 2rem clamp(1rem, 5vw, 6rem);
  max-width: 1400px;
  margin: 0 auto;
}

.admin-toggle-btn {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: 0.3s;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-toggle-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.admin-login-box,
#blogAdminPanel {
  margin-top: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2rem;
}

.admin-login-box h3,
#blogAdminPanel h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.admin-login-box h3 i,
#blogAdminPanel h3 i {
  color: var(--gold);
  margin-right: 0.5rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-form-row > * {
  flex: 1;
  min-width: 200px;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  border-color: var(--secondary);
}

.admin-form input::placeholder,
.admin-form textarea::placeholder {
  color: var(--text-muted);
}

.admin-form select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.admin-form select option {
  background: #0e1726;
  color: var(--white);
}

.admin-form textarea {
  resize: vertical;
  min-height: 60px;
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0;
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-panel-header h3 {
  margin-bottom: 0;
}

.admin-logout-btn {
  padding: 0.5rem 1.25rem !important;
  font-size: 0.8rem;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
  background: transparent !important;
}

.admin-logout-btn:hover {
  background: var(--danger) !important;
  color: var(--white) !important;
}

/* Image Upload */
.image-upload-area {
  position: relative;
}

.image-upload-area input[type="file"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  border: 2px dashed var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: 0.3s;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.upload-label:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.upload-label i {
  font-size: 1.5rem;
}

.image-preview {
  position: relative;
  margin-top: 1rem;
}

.image-preview img {
  max-height: 200px;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.remove-preview {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.remove-preview:hover {
  background: var(--danger);
}

.admin-buttons {
  margin-top: 0.5rem;
}

.admin-buttons .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  border: none;
  font-size: 0.95rem;
}

.post-status {
  font-size: 0.85rem;
  margin: 0;
}

.post-status.success {
  color: var(--profit-green);
}

.post-status.error {
  color: var(--danger);
}

/* Admin Posts List */
.admin-posts-list {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.admin-posts-list h4 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.admin-posts-list h4 i {
  color: var(--gold);
  margin-right: 0.5rem;
}

.admin-post-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

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

.admin-post-info strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-post-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.admin-delete-btn {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: 0.3s;
}

.admin-delete-btn:hover {
  background: var(--danger);
  color: white;
}

@media (max-width: 768px) {
  .admin-form-row {
    flex-direction: column;
  }

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

  .admin-post-info strong {
    font-size: 0.8rem;
  }
}

/* ====================================
IMAGE OPTIMIZATION
==================================== */
.blog-image img {
  display: block;
}

/* Lazy loading blur effect */
.blog-image img[data-loaded="false"] {
  filter: blur(10px);
}

.blog-image img[data-loaded="true"] {
  filter: blur(0);
  transition: filter 0.3s ease;
}
