/* Blog Page - Professional Modern Design */

:root {
  --blog-primary: #667eea;
  --blog-secondary: #764ba2;
  --blog-accent: #f093fb;
  --blog-text: #2d3748;
  --blog-text-light: #718096;
  --blog-bg: #ffffff;
  --blog-card-bg: #ffffff;
  --blog-border: #e2e8f0;
  --blog-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --blog-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --blog-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

body {
  background: linear-gradient(to bottom, #f7fafc 0%, #edf2f7 100%);
  min-height: 100vh;
  color: var(--blog-text);
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 10000;
  place-items: center;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: 'Rubik', sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
}

/* Active Nav Link */
.nav-menu li a.active {
  background: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

/* Main Blog Container */
.blog-main {
  margin-top: 80px;
}

/* Hero Section */
.blog-hero {
  background: var(--blog-gradient);
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}

.blog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.blog-hero-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.blog-hero-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  color: white;
  margin-bottom: 1rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.blog-hero-subtitle {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
  max-width: 600px;
  margin: 0 auto;
}

/* Featured Blog Section */
.blog-featured-section {
  padding: 3rem 0;
  background: var(--blog-bg);
}

.section-label {
  font-family: 'Rubik', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blog-text-light);
  margin-bottom: 1.5rem;
}

.blog-featured {
  background: var(--blog-card-bg);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--blog-shadow-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-featured:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.blog-featured-image-wrapper {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea, #764ba2);
}

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

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

.blog-featured-badge {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--blog-primary);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-family: 'Rubik', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--blog-shadow);
}

.blog-featured-content {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.blog-featured-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.blog-category {
  background: var(--blog-gradient);
  color: white;
  padding: 0.375rem 0.875rem;
  border-radius: 50px;
  font-family: 'Rubik', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-date {
  color: var(--blog-text-light);
  font-family: 'Rubik', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
}

.blog-featured-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  color: var(--blog-text);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.blog-featured-description {
  font-family: 'Rubik', sans-serif;
  font-size: 1.125rem;
  color: var(--blog-text-light);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.blog-featured-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.blog-featured-btn {
  background: var(--blog-gradient);
  color: white;
  border: none;
  padding: 0.875rem 2rem;
  border-radius: 50px;
  font-family: 'Rubik', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

.blog-featured-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.blog-featured-btn:active {
  transform: translateY(0);
}

.blog-featured-likes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--blog-text-light);
  font-family: 'Rubik', sans-serif;
  font-weight: 600;
}

.blog-likes-icon {
  font-size: 1.25rem;
  color: #e53e3e;
}

/* Blog Posts Section */
.blog-posts-section {
  padding: 3rem 0 5rem;
  background: linear-gradient(to bottom, var(--blog-bg) 0%, #f7fafc 100%);
}

.blog-posts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.blog-search-wrapper {
  position: relative;
  flex: 0 0 auto;
}

.blog-search {
  width: 100%;
  min-width: 250px;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid var(--blog-border);
  border-radius: 50px;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9375rem;
  background: var(--blog-card-bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  direction: rtl;
}

.blog-search:focus {
  outline: none;
  border-color: var(--blog-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.blog-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  color: var(--blog-text-light);
  pointer-events: none;
}

/* Blog Grid */
.blogs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

/* Blog Card */
.blog-card {
  background: var(--blog-card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--blog-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--blog-border);
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--blog-shadow-lg);
}

.blog-figure {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--blog-gradient);
}

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

.blog-card:hover .blog-figure img {
  transform: scale(1.08);
}

.blog-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-grow: 1;
}

.blog-subtitle {
  font-family: 'Rubik', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blog-text-light);
}

.blog-title-sm {
  font-family: 'Rubik', sans-serif;
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--blog-text);
  line-height: 1.3;
  margin: 0.25rem 0;
}

.blog-desc {
  font-family: 'Rubik', sans-serif;
  font-size: 0.9375rem;
  color: var(--blog-text-light);
  line-height: 1.6;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--blog-border);
  font-family: 'Rubik', sans-serif;
  font-size: 0.875rem;
  color: var(--blog-text-light);
}

.blog-actions {
  padding: 0 1.5rem 1.5rem;
}

.blog-read {
  width: 100%;
  background: var(--blog-gradient);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.blog-read:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.blog-read:active {
  transform: translateY(0);
}

/* Empty State */
.blog-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--blog-text-light);
}

.blog-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.blog-empty-title {
  font-family: 'Rubik', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--blog-text);
  margin-bottom: 0.5rem;
}

.blog-empty-text {
  font-family: 'Rubik', sans-serif;
  font-size: 1rem;
  color: var(--blog-text-light);
}

/* Blog Modal */
.blog-modal {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: none;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.blog-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.blog-modal-content {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  background: var(--blog-card-bg);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

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

.blog-modal-close {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: var(--blog-shadow);
}

.blog-modal-close:hover {
  transform: scale(1.1);
  background: white;
}

.blog-modal-close svg {
  color: var(--blog-text);
}

.blog-modal-header {
  padding: 3rem 3rem 2rem;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.blog-modal-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.blog-modal-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 900;
  color: var(--blog-text);
  line-height: 1.2;
}

.blog-modal-image-wrapper {
  width: 100%;
  max-height: 500px;
  overflow: hidden;
  background: var(--blog-gradient);
}

.blog-modal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.blog-modal-body {
  padding: 2.5rem 3rem;
}

.blog-modal-content-text {
  font-family: 'Rubik', sans-serif;
  font-size: 1.125rem;
  line-height: 1.9;
  color: var(--blog-text);
  white-space: pre-wrap;
}

.blog-modal-footer {
  padding: 1.5rem 3rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--blog-border);
}

.blog-like-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--blog-gradient);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

.blog-like-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.blog-like-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.blog-like-icon {
  font-size: 1.125rem;
}

.blog-modal-likes {
  font-family: 'Rubik', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--blog-text-light);
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 7000;
  animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-content {
  background: var(--blog-card-bg);
  border: 2px solid var(--blog-border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--blog-shadow-lg);
  font-family: 'Rubik', sans-serif;
  min-width: 280px;
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-text {
  font-weight: 600;
  color: var(--blog-text);
  flex-grow: 1;
}

.toast-success .toast-content {
  border-color: #48bb78;
  background: #f0fff4;
}

.toast-error .toast-content {
  border-color: #f56565;
  background: #fff5f5;
}

/* Alert Dialog */
.alert {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: none;
  place-items: center;
  padding: 1rem;
}

.alert-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.alert-content {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--blog-card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--blog-shadow-lg);
  animation: alertPopIn 0.25s ease;
}

@keyframes alertPopIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.alert-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.alert-icon {
  font-size: 1.5rem;
}

.alert-title {
  font-family: 'Rubik', sans-serif;
  font-weight: 800;
  color: var(--blog-text);
  flex-grow: 1;
}

.alert-close {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--blog-text-light);
  transition: background 0.2s ease;
}

.alert-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

.alert-body {
  padding: 1.5rem;
  font-family: 'Rubik', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--blog-text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.alert-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0 1.5rem 1.5rem;
}

.alert-ok {
  background: var(--blog-gradient);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.alert-ok:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

  .blog-featured-content {
    padding: 2rem;
  }

  .blog-featured-image-wrapper {
    aspect-ratio: 16 / 9;
  }

  .blogs-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .blog-posts-header {
    flex-direction: column;
    align-items: stretch;
  }

  .blog-search-wrapper {
    width: 100%;
  }

  .blog-modal-header,
  .blog-modal-body,
  .blog-modal-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .blog-modal-title {
    font-size: 1.75rem;
  }

  .blog-modal-content-text {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .blog-hero {
    padding: 3rem 0 2.5rem;
  }

  .blog-featured-section,
  .blog-posts-section {
    padding: 2rem 0 3rem;
  }

  .blog-featured-content {
    padding: 1.5rem;
  }

  .blog-featured-title {
    font-size: 1.5rem;
  }

  .blog-featured-description {
    font-size: 1rem;
  }
}
