/**
 * Diario Styles
 * Yoga Bimbi Roma - Homepage Style Consistency
 */

/* CSS Variables matching homepage */
:root {
  --primary-color: #FF6B6B;
  --secondary-color: #4ECDC4;
  --accent-color: #FFE66D;
  --text-dark: #2C3E50;
  --text-light: #5A6C7D;
  --background-light: #FFF8F3;
  --white: #FFFFFF;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
}

/* ============================================
   FONT RENDERING OPTIMIZATION FOR MOBILE
   ============================================ */

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Prevent text inflation on mobile browsers */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.skip-to-main {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: top 0.3s ease;
}

.skip-to-main:focus {
  top: 0;
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

/* ============================================
   HERO DIARIO - With Background Image
   ============================================ */

.diario-hero {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.75) 100%),
              url('/diarioYogaBimbiRoma_back.png') center center / cover no-repeat;
  color: var(--text-dark);
  padding: 6rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 450px;
  display: flex;
  align-items: center;
  background-attachment: fixed;
}

.diario-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.2) 50%, transparent 80%);
  pointer-events: none;
  z-index: 1;
}

.diario-hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(78, 205, 196, 0.05) 100%);
  pointer-events: none;
  z-index: 1;
}

@keyframes patternMove {
  0% { background-position: 0 0; }
  100% { background-position: 80px 80px; }
}

.diario-hero .container {
  position: relative;
  z-index: 2;
}

.diario-title {
  font-family: 'Comfortaa', cursive;
  font-size: 3.5rem;
  font-weight: 800;
  margin: 0 0 1.5rem;
  position: relative;
  z-index: 2;
  color: #2C3E50;
  text-shadow: 3px 3px 6px rgba(255, 255, 255, 0.9),
               -1px -1px 3px rgba(255, 255, 255, 0.9),
               0 0 20px rgba(255, 255, 255, 0.7);
  animation: titleFadeIn 1s ease-out;
  letter-spacing: -0.02em;
}

@keyframes titleFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.diario-title i {
  font-size: 3rem;
  margin-right: 0.75rem;
  color: #FF6B6B;
  filter: drop-shadow(0 3px 6px rgba(255, 255, 255, 0.9))
          drop-shadow(0 0 10px rgba(255, 107, 107, 0.3));
  animation: bookBounce 2s ease-in-out infinite;
}

@keyframes bookBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(-5deg); }
}

.diario-subtitle {
  font-size: 1.5rem;
  color: #2C3E50;
  margin: 0 auto;
  max-width: 650px;
  position: relative;
  z-index: 2;
  font-weight: 600;
  line-height: 1.6;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.95),
               -1px -1px 2px rgba(255, 255, 255, 0.95),
               0 0 15px rgba(255, 255, 255, 0.8);
  animation: subtitleFadeIn 1s ease-out 0.3s backwards;
}

@keyframes subtitleFadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   FILTERS
   ============================================ */

.diario-filters {
  background: var(--white);
  padding: 2rem 0;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
  z-index: 5;
}

.filters-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  position: relative;
  z-index: 10;
}

.search-box {
  flex: 1;
  min-width: 250px;
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
}

.search-box:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.search-box i {
  color: #999;
  margin-right: 0.75rem;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: 'Quicksand', sans-serif;
}

.search-box .clear-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: 0.5rem;
  font-size: 1.2rem;
  transition: color 0.3s ease;
}

.search-box .clear-btn:hover {
  color: var(--primary-color);
}

.filter-dropdown {
  position: relative;
  z-index: 10;
}

.filter-btn {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.filter-btn i:last-child {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.filter-btn.active i:last-child {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  padding: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  text-align: left;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  color: #333;
}

.dropdown-item:hover {
  background: #f5f5f5;
  color: var(--primary-color);
}

.dropdown-item.active {
  background: var(--gradient-2);
  color: white;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-tag {
  background: var(--gradient-2);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-tag button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.filter-tag button:hover {
  opacity: 1;
}

/* ============================================
   CONTENT GRID
   ============================================ */

.diario-content {
  padding: 3rem 0;
  background: var(--background-light);
  position: relative;
  z-index: 1;
}

.diario-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 3rem;
}

.posts-container {
  min-height: 500px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

/* ============================================
   POST CARD - Enhanced with Bootstrap
   ============================================ */

.post-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.post-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15) !important;
}

.post-card:hover .post-card-image img {
  transform: scale(1.08);
}

.post-card-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #FFE6F0 0%, #C8E6C9 100%);
  position: relative;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card:hover .post-card-image img {
  transform: scale(1.05);
}

.post-card-category {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: white;
  color: #333;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.post-card-category i {
  font-size: 0.8rem;
}

.post-card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-title {
  font-family: 'Comfortaa', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: #333;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.post-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
  position: relative;
}

.post-card:hover .post-card-title a {
  color: var(--primary-color);
}

.post-card-excerpt {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.post-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
  font-size: 0.85rem;
  color: #999;
}

.post-card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.post-card-meta-item i {
  font-size: 0.9rem;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.post-tag {
  background: #f0f0f0;
  color: #666;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-tag:hover {
  background: var(--gradient-2);
  color: white !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(240, 93, 108, 0.3);
}

/* ============================================
   PAGINATION - Enhanced with Bootstrap
   ============================================ */

.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 3rem;
}

.pagination .page-link {
  font-family: 'Quicksand', sans-serif;
  color: #333;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  margin: 0 0.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.5rem 0.875rem;
  font-size: 0.95rem;
}

.pagination .page-link:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(240, 93, 108, 0.05), rgba(240, 93, 108, 0.1));
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(240, 93, 108, 0.2);
}

.pagination .page-item.active .page-link {
  background: var(--gradient-2);
  border-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px rgba(240, 93, 108, 0.3);
}

.pagination .page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #e0e0e0;
}

.pagination-info {
  color: #666;
  font-size: 0.9rem;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  position: sticky;
  top: 2rem;
  align-self: flex-start;
}

.widget {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.widget-title {
  font-family: 'Comfortaa', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.widget-title i {
  color: var(--primary-color);
}

.categories-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.categories-list li {
  margin-bottom: 0.75rem;
}

.categories-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  transition: all 0.3s ease;
}

.categories-list a:hover {
  background: var(--gradient-2);
  color: white;
  transform: translateX(5px);
}

.category-icon {
  margin-right: 0.5rem;
}

.category-count {
  background: white;
  color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.categories-list a:hover .category-count {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.popular-posts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.popular-post {
  display: flex;
  gap: 1rem;
  text-decoration: none;
  color: #333;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.75rem;
  border-radius: 8px;
}

.popular-post:hover {
  background: linear-gradient(135deg, #fff5f9, #f9f9f9);
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.1);
}

.popular-post-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: linear-gradient(135deg, #FFE6F0 0%, #C8E6C9 100%);
  overflow: hidden;
  flex-shrink: 0;
}

.popular-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popular-post-content {
  flex: 1;
  min-width: 0;
}

.popular-post-title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0 0 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-post-meta {
  font-size: 0.8rem;
  color: #999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud-item {
  background: #f0f0f0;
  color: #666;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tag-cloud-item:hover {
  background: var(--gradient-2) !important;
  color: white !important;
  border-color: transparent !important;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(240, 93, 108, 0.3);
}

.tag-cloud-item:hover .badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: white !important;
}

.widget-cta {
  background: var(--gradient-2);
  color: white;
}

.widget-cta .widget-title {
  color: white;
}

.widget-cta .widget-title i {
  color: white;
}

.widget-cta p {
  margin: 0 0 1rem;
  opacity: 0.95;
}

.widget-cta a {
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.widget-cta a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(188, 24, 136, 0.4) !important;
}

/* ============================================
   STATES
   ============================================ */

.loading-state,
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f0f0f0;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state i {
  font-size: 4rem;
  color: #ddd;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: 'Comfortaa', cursive;
  font-size: 1.5rem;
  color: var(--text-dark);
  margin: 0 0 0.5rem;
}

.empty-state p {
  color: var(--text-light);
  margin: 0 0 1.5rem;
}

.empty-state button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(240, 93, 108, 0.4) !important;
}

/* ============================================
   SKELETON LOADER - Enhanced
   ============================================ */

.skeleton-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.skeleton-item {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.3s ease-out;
}

.skeleton-image {
  height: 200px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  position: relative;
}

.skeleton-image::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}

.skeleton-title,
.skeleton-text {
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  margin: 1rem 1.5rem;
  border-radius: 4px;
}

.skeleton-title {
  height: 24px;
}

.skeleton-text.short {
  width: 60%;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   MICRO-INTERACTIONS & ANIMATIONS
   ============================================ */

/* Fade in animation for cards */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Stagger animation for post cards */
.post-card {
  animation: fadeInUp 0.5s ease-out backwards;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.15s; }
.post-card:nth-child(3) { animation-delay: 0.2s; }
.post-card:nth-child(4) { animation-delay: 0.25s; }
.post-card:nth-child(5) { animation-delay: 0.3s; }
.post-card:nth-child(6) { animation-delay: 0.35s; }
.post-card:nth-child(7) { animation-delay: 0.4s; }
.post-card:nth-child(8) { animation-delay: 0.45s; }
.post-card:nth-child(9) { animation-delay: 0.5s; }

/* Widget animations */
.widget {
  animation: scaleIn 0.4s ease-out backwards;
}

.widget:nth-child(1) { animation-delay: 0.1s; }
.widget:nth-child(2) { animation-delay: 0.2s; }
.widget:nth-child(3) { animation-delay: 0.3s; }
.widget:nth-child(4) { animation-delay: 0.4s; }

/* Search box focus effect */
.search-box {
  position: relative;
}

.search-box::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50px;
  background: var(--gradient-2);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
}

.search-box:focus-within::after {
  opacity: 0.15;
}

/* Button ripple effect */
.filter-btn,
.page-link {
  position: relative;
  overflow: hidden;
}

.filter-btn::after,
.page-link::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(240, 93, 108, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.filter-btn:active::after,
.page-link:active::after {
  width: 300px;
  height: 300px;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Loading state pulse */
.loading-state {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Spinner enhanced */
.spinner-border {
  animation: spin 0.75s linear infinite;
}

/* Empty state fade in */
.empty-state {
  animation: fadeIn 0.5s ease-out;
}

.empty-state i {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Tag hover sparkle */
.tag-cloud-item,
.post-tag {
  position: relative;
}

.tag-cloud-item::before,
.post-tag::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
  opacity: 0;
  transition: opacity 0.5s;
}

.tag-cloud-item:hover::before,
.post-tag:hover::before {
  opacity: 1;
  animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Category link slide effect */
.categories-list a {
  position: relative;
  overflow: hidden;
}

.categories-list a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-color);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.categories-list a:hover::before {
  transform: translateX(0);
}

/* Popular post image zoom */
.popular-post-image {
  position: relative;
  overflow: hidden;
}

.popular-post-image img {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.popular-post:hover .popular-post-image img {
  transform: scale(1.1);
}

/* Page transition helper class */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.3s ease-out;
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 3px solid rgba(240, 93, 108, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Smooth image loading */
img {
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards;
}

img[src=""],
img:not([src]) {
  opacity: 0;
}

/* Progress indicator for long content */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--gradient-2);
  z-index: 9999;
  transition: width 0.1s ease-out;
}

/* ============================================
   RESPONSIVE - Enhanced Multi-Device Support
   ============================================ */

/* Tablet Landscape (1024px and below) */
@media (max-width: 1024px) {
  .diario-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
  }

  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .widget {
    margin-bottom: 0;
  }
}

/* Tablet Portrait (768px and below) */
@media (max-width: 768px) {
  /* Hero adjustments */
  .diario-hero {
    padding: 4rem 0 3rem;
    min-height: 380px;
    background-position: center center;
    background-attachment: scroll;
  }

  .diario-title {
    font-size: 2.5rem;
    text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.9);
  }

  .diario-title i {
    font-size: 2.2rem;
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0;
    filter: drop-shadow(1px 1px 2px rgba(255, 255, 255, 0.8));
  }

  .diario-subtitle {
    font-size: 1.2rem;
    padding: 0 1rem;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
  }

  /* Filters stack on mobile */
  .filters-wrapper {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .search-box,
  .filter-dropdown {
    width: 100%;
  }

  .filter-btn {
    width: 100%;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
  }

  .dropdown-menu {
    left: 0;
    right: 0;
    width: 100%;
  }

  /* Posts grid single column */
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .post-card-image {
    height: 200px;
  }

  .post-card-title {
    font-size: 1.2rem;
    line-height: 1.5;
  }

  .post-card-excerpt {
    font-size: 0.95rem;
    line-height: 1.65;
  }

  /* Sidebar becomes accordion-style on mobile */
  .sidebar {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Pagination adjustments */
  .pagination nav {
    width: 100%;
  }

  .pagination .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }

  .pagination .page-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
  }

  .pagination-info {
    width: 100%;
    text-align: center;
    margin-top: 1rem;
  }

  /* Widget improvements */
  .widget {
    padding: 1.25rem;
  }

  .widget-title {
    font-size: 1rem;
  }

  /* Popular posts stacked better */
  .popular-post {
    padding: 0.5rem;
  }

  .popular-post-image {
    width: 70px;
    height: 70px;
  }

  .popular-post-title {
    font-size: 0.85rem;
  }

  /* Category list touch-friendly */
  .categories-list a {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }

  .category-count {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }

  /* Tags cloud responsive */
  .tag-cloud-item {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* Mobile Landscape (640px and below) */
@media (max-width: 640px) {
  .diario-hero {
    padding: 2.5rem 0 2rem;
  }

  .diario-title {
    font-size: 1.75rem;
  }

  .diario-subtitle {
    font-size: 0.95rem;
  }

  .diario-filters {
    padding: 1.5rem 0;
  }

  .diario-content {
    padding: 2rem 0;
  }

  .post-card-image {
    height: 180px;
  }

  .post-card-body {
    padding: 1.25rem;
  }

  .post-card-title {
    font-size: 1.15rem;
  }

  .post-card-excerpt {
    font-size: 0.9rem;
  }

  /* Compact pagination for small screens */
  .pagination .page-link {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    margin: 0 0.15rem;
  }

  .pagination .page-link .d-none {
    display: none !important;
  }
}

/* Mobile Portrait (480px and below) */
@media (max-width: 480px) {
  .diario-hero {
    padding: 3rem 0 2.5rem;
    min-height: 320px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.78) 100%),
                url('/diarioYogaBimbiRoma_back.png') center center / cover no-repeat;
    background-attachment: scroll;
  }

  .diario-title {
    font-size: 2rem;
    line-height: 1.3;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
  }

  .diario-title i {
    font-size: 1.8rem;
    margin-right: 0.4rem;
    filter: drop-shadow(1px 1px 2px rgba(255, 255, 255, 0.8));
  }

  .diario-subtitle {
    font-size: 1.1rem;
    padding: 0 0.75rem;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
  }

  .diario-filters {
    padding: 1.25rem 0;
  }

  .search-box {
    padding: 0.65rem 1.25rem;
  }

  .search-box input {
    font-size: 0.95rem;
  }

  .filter-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
  }

  .diario-content {
    padding: 1.5rem 0;
  }

  .posts-grid {
    gap: 1.25rem;
  }

  .post-card-image {
    height: 160px;
  }

  .post-card-body {
    padding: 1rem;
  }

  .post-card-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
  }

  .post-card-excerpt {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.65;
    color: #555;
  }

  .post-card-meta {
    font-size: 0.8rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .post-card-tags {
    margin-top: 0.5rem;
  }

  .widget {
    padding: 1rem;
  }

  .widget-title {
    font-size: 0.95rem;
  }

  .categories-list a {
    padding: 0.75rem 0.875rem;
    font-size: 0.9rem;
  }

  .popular-post-image {
    width: 60px;
    height: 60px;
  }

  .popular-post-title {
    font-size: 0.8rem;
  }

  .popular-post-meta {
    font-size: 0.75rem;
  }

  .tag-cloud-item {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
  }

  /* Compact footer spacing */
  .pagination {
    margin-top: 2rem;
  }

  .empty-state {
    padding: 3rem 1.5rem;
  }

  .empty-state i {
    font-size: 3rem;
  }

  .empty-state h3 {
    font-size: 1.25rem;
  }

  .empty-state p {
    font-size: 0.9rem;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .filter-btn,
  .search-box,
  .dropdown-item,
  .categories-list a,
  .tag-cloud-item,
  .post-tag,
  .page-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Remove hover states on touch devices */
  .post-card:hover {
    transform: none;
  }

  .post-card:active {
    transform: translateY(-4px);
    transition: transform 0.1s ease;
  }

  /* Tap highlight removal */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* Smoother scrolling on mobile */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
}

/* High Resolution Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Sharper images and icons */
  .post-card-image img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
  /* This can be implemented if dark mode is desired */
  /* Currently keeping light theme consistent */
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .post-card:hover {
    transform: none;
  }

  .spinner {
    animation: none;
    opacity: 0.5;
  }
}

/* ============================================
   ANDROID-SPECIFIC OPTIMIZATIONS
   ============================================ */

/* Extra small screens (Android phones) - Force crisp text rendering */
@media only screen and (max-width: 600px) {
  body,
  .post-card-title,
  .post-card-excerpt,
  .diario-title,
  .diario-subtitle {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Ensure minimum readable font sizes on small screens */
  .post-card-excerpt {
    font-size: max(0.9rem, 14px);
  }

  .post-card-title {
    font-size: max(1.1rem, 17px);
  }

  /* Remove any text shadows that might cause blur on Android */
  .post-card-title,
  .post-card-excerpt,
  .post-card-meta {
    text-shadow: none !important;
  }

  /* Enhance contrast for better readability */
  .post-card-excerpt {
    color: #444;
  }

  .post-card-title {
    color: #222;
  }
}

/* ============================================
   GUEST COMMENTS STYLES
   ============================================ */

/* Guest badge per commenti da utenti non autenticati */
.guest-badge {
  display: inline-block;
  background: linear-gradient(135deg, #FFE66D 0%, #FFC107 100%);
  color: #333;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 0.5rem;
  box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
  animation: guestBadgePulse 2s ease-in-out infinite;
}

@keyframes guestBadgePulse {
  0%, 100% {
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
  }
  50% {
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.5);
  }
}

/* Stili per i campi input guest */
.guest-info-fields input {
  font-family: 'Quicksand', sans-serif;
}

.guest-info-fields input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.guest-info-fields input:invalid:not(:placeholder-shown) {
  border-color: #e74c3c;
}

.guest-info-fields input:valid:not(:placeholder-shown) {
  border-color: #27ae60;
}

/* Mobile responsiveness per form guest */
@media (max-width: 640px) {
  .guest-info-fields {
    grid-template-columns: 1fr !important;
  }

  .guest-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    margin-left: 0.35rem;
  }
}

/* Textarea commenti migliorato */
#commentTextarea:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}
