/**
 * News & Articles - Bootstrap Italia Styles
 * Custom CSS for news listing and article pages
 */

/* ==========================================================================
   NEWS LIST STYLES
   ========================================================================== */

/* News page sections */
.news-section {
  margin-bottom: 3rem;
}

.news-section h2 {
  color: var(--primary-color, #0066cc);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

/* Search section */
.news-search-section .input-group .form-control {
  border-right: 0;
  padding: 0.75rem 1rem;
}

.news-search-section .input-group .btn {
  border-left: 0;
  border-color: #ced4da;
}

.news-search-section .input-group .btn:hover {
  background-color: var(--primary-color, #0066cc);
  border-color: var(--primary-color, #0066cc);
  color: white;
}

/* Categories section */
.categories-section .card {
  transition: all 0.3s ease;
  border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer;
}

.categories-section .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  border-color: var(--primary-color, #0066cc);
}

.categories-section .card-title a {
  color: var(--primary-color, #0066cc);
  font-weight: 600;
  text-decoration: none;
}

.categories-section .card-title a:hover {
  color: var(--primary-hover, #004499);
}

/* Enhanced article cards */
.news-article-card {
  transition: all 0.3s ease;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  overflow: hidden;
}

.news-article-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 35px rgba(0,0,0,0.12) !important;
  border-color: var(--primary-color, #0066cc);
}

/* Image container with overlay effects */
.news-article-card .card-img-container {
  height: 200px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.news-article-card .image-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.news-article-card .image-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.news-article-card:hover .image-overlay::after {
  opacity: 1;
}

/* Enhanced image styling */
.news-article-card .image-overlay img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.news-article-card:hover .image-overlay img {
  transform: scale(1.05);
}

/* Article meta styling */
.news-article-card .article-meta {
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding-bottom: 0.75rem;
}

.news-article-card .article-date {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

.news-article-card .article-category .badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.5rem;
}

/* Enhanced title styling */
.news-article-card .card-title a {
  color: #333;
  font-weight: 600;
  line-height: 1.4;
  transition: color 0.3s ease;
}

.news-article-card .card-title a:hover {
  color: var(--primary-color, #0066cc);
}

/* Article summary styling */
.news-article-card .article-summary {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #6c757d;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Read more indicator */
.news-article-card .mt-auto .text-primary {
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.news-article-card:hover .mt-auto .text-primary {
  color: var(--primary-hover, #004499) !important;
  transform: translateX(4px);
}

/* Tags overlay styling */
.news-article-card .position-absolute .badge {
  background-color: rgba(255,255,255,0.95) !important;
  color: var(--primary-color, #0066cc) !important;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(0,0,0,0.1);
  backdrop-filter: blur(4px);
}

/* Placeholder improvements */
.news-article-card .placeholder-image {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px dashed rgba(0,0,0,0.1);
}

.news-grid .card {
  transition: all 0.3s ease;
  border: 1px solid rgba(0,0,0,0.1);
}

.news-grid .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.news-grid .figure img {
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* Placeholder for missing images */
.news-grid .img-responsive-wrapper:not(:has(img)) {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-grid .img-responsive-wrapper:not(:has(img))::before {
  content: "📰";
  font-size: 3rem;
  opacity: 0.3;
}

.news-grid .card:hover .figure img {
  transform: scale(1.05);
}

.news-grid .card-title a {
  color: var(--primary-color, #0066cc);
  transition: color 0.3s ease;
}

.news-grid .card-title a:hover {
  color: var(--primary-hover, #004499);
}

.news-grid .card-body {
  min-height: 200px;
}

/* Bootstrap Icons in news cards */
.news-grid .bi-calendar3 {
  color: var(--primary-color, #0066cc);
}

/* ==========================================================================
   ARTICLE DETAIL STYLES
   ========================================================================== */

/* Article detail layout */
.article-detail {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* Article header */
.article-header {
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 2rem;
}

.article-header h1 {
  color: #333;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.article-header .lead {
  font-size: 1.125rem;
  line-height: 1.6;
  color: #6c757d;
  margin-bottom: 1.5rem;
}

/* Article actions */
.article-actions .dropdown-toggle {
  border-radius: 6px;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.article-actions .dropdown-menu {
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border-radius: 8px;
}

.article-actions .dropdown-item {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.article-actions .dropdown-item:hover {
  background-color: #f8f9fa;
}

/* Article meta header */
.article-meta-header {
  background-color: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.article-meta-header .meta-item {
  min-width: 120px;
}

.article-meta-header .meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.article-meta-header .meta-value {
  font-size: 0.9rem;
  color: #333;
}

/* Hero image */
.article-hero-image .img-responsive-wrapper {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.article-hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

.article-hero-image .figure-caption {
  font-style: italic;
  text-align: center;
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 1rem;
}

/* Table of contents */
.article-toc .card {
  border-radius: 8px;
  border: none;
  background-color: #f8f9fa;
}

.article-toc .card-title {
  color: var(--primary-color, #0066cc);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-toc ul li {
  margin-bottom: 0.5rem;
}

.article-toc ul li a {
  color: #333;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  display: block;
  transition: color 0.3s ease;
}

.article-toc ul li a:hover {
  color: var(--primary-color, #0066cc);
}

/* Article content */
.article-content h2 {
  color: var(--primary-color, #0066cc);
  font-weight: 700;
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}

/* Sidebar */
.article-sidebar {
  position: sticky;
  top: 2rem;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  color: var(--primary-color, #0066cc);
  font-weight: 700;
  margin-bottom: 1rem;
}

/* A cura di section */
.sidebar-section .card {
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.sidebar-section .office-info h4 {
  color: #333;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.sidebar-section .office-contacts .badge {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  background-color: var(--primary-color, #0066cc) !important;
}

.sidebar-section .office-avatar {
  width: 50px;
  height: 50px;
}

.sidebar-section .office-meta {
  font-size: 0.875rem;
}

/* Related articles */
.list-group-item-action {
  transition: all 0.3s ease;
  border-radius: 8px !important;
  margin-bottom: 0.5rem;
}

.list-group-item-action:hover {
  background-color: #f8f9fa !important;
  transform: translateX(5px);
}

.list-group-item h6 {
  color: var(--primary-color, #0066cc);
  font-weight: 600;
}

/* Article navigation */
.article-navigation {
  margin-top: 3rem;
  padding-top: 2rem;
}

.article-navigation .btn {
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 8px;
}

/* Indice della pagina (Table of Contents) */
.indice-pagina {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef !important;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.indice-pagina .btn-link {
  color: var(--primary-color, #0066cc);
  text-decoration: none;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.indice-pagina .btn-link:hover {
  color: var(--primary-hover, #004499);
}

.indice-pagina ul {
  margin: 0;
  padding: 0;
}

.indice-pagina ul li {
  margin-bottom: 0.25rem;
}

.indice-pagina ul li a {
  color: #333;
  font-size: 0.875rem;
  padding: 0.375rem 0;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.indice-pagina ul li a:hover {
  color: var(--primary-color, #0066cc);
  background-color: rgba(0, 102, 204, 0.05);
  transform: translateX(4px);
}

.indice-pagina ul li.ms-3 a {
  font-size: 0.8rem;
  color: #6c757d;
  margin-left: 1rem;
}

/* Sticky positioning for larger screens */
@media (min-width: 992px) {
  .position-lg-sticky.sticky-top {
    top: 2rem;
  }
}

/* Enhanced article layout */
.news-article .prose {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #333;
}

.news-article .prose h2 {
  color: var(--primary-color, #0066cc);
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0.5rem;
}

.news-article .prose h3 {
  color: var(--primary-color, #0066cc);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.news-article .prose p {
  margin-bottom: 1.5rem;
}

.news-article .prose blockquote {
  border-left: 4px solid var(--primary-color, #0066cc);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  background-color: #f8f9fa;
  padding: 1.5rem;
  border-radius: 0.375rem;
}

.news-article .prose ul,
.news-article .prose ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.news-article .prose li {
  margin-bottom: 0.5rem;
}

/* Share buttons styling */
.list-inline .btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.list-inline .btn:hover {
  background-color: var(--primary-color, #0066cc);
  border-color: var(--primary-color, #0066cc);
  color: white;
  transform: translateY(-2px);
}

/* A cura di section enhanced */
.news-article #a-cura-di .card {
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  border: none;
}

.news-article #a-cura-di .office-info h4 {
  color: #333;
  font-weight: 700;
}

.news-article #a-cura-di .badge {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  background-color: var(--primary-color, #0066cc) !important;
  border: none;
}

/* Figure and image enhancements */
.news-article .img-responsive-wrapper {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  margin-bottom: 2rem;
}

.news-article .figure-caption {
  font-style: italic;
  text-align: center;
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 1rem;
  padding: 0 2rem;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .news-article .d-flex.justify-content-lg-end {
    justify-content: flex-start !important;
    flex-direction: column;
    gap: 1rem !important;
  }
  
  .news-article .d-flex.align-items-center.gap-2 {
    justify-content: center;
  }
  
  .indice-pagina {
    position: static !important;
    margin-top: 2rem;
  }
  
  .news-article .prose {
    font-size: 1rem;
  }
  
  .news-article .prose h2 {
    font-size: 1.25rem;
  }
  
  .news-article .prose h3 {
    font-size: 1.125rem;
  }
  
  .news-article .figure-caption {
    padding: 0 1rem;
  }
}

.news-article .article-meta {
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 1rem;
}

.news-article .article-meta .bi {
  color: var(--primary-color, #0066cc);
}

.news-article .figure img {
  width: 100%;
  height: auto;
  border-radius: 0.375rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.news-article .figure-caption {
  font-size: 0.875rem;
  color: #6c757d;
  font-style: italic;
}

/* Prose styling for article content */
.prose {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #333;
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--primary-color, #0066cc);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.prose h2 {
  font-size: 1.5rem;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0.5rem;
}

.prose h3 {
  font-size: 1.25rem;
}

.prose h4 {
  font-size: 1.125rem;
}

.prose p {
  margin-bottom: 1.5rem;
}

.prose blockquote {
  border-left: 4px solid var(--primary-color, #0066cc);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  background-color: #f8f9fa;
  padding: 1.5rem;
  border-radius: 0.375rem;
}

.prose ul,
.prose ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   TAGS & BADGES STYLES
   ========================================================================== */

.field--name-field-tags .field__items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.field--name-field-tags .field__item {
  display: inline-block;
}

.field--name-field-tags a {
  background-color: var(--primary-color, #0066cc);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.field--name-field-tags a:hover {
  background-color: var(--primary-hover, #004499);
  color: white;
}

/* Alternative badge styles */
.badge.bg-primary {
  background-color: var(--primary-color, #0066cc) !important;
}

.badge.bg-secondary {
  background-color: #6c757d !important;
}

/* ==========================================================================
   BREADCRUMB STYLES
   ========================================================================== */

.breadcrumb-container .breadcrumb {
  background-color: transparent;
  padding: 0;
  margin-bottom: 0;
}

.breadcrumb-container .breadcrumb-item + .breadcrumb-item::before {
  content: ">";
  color: #6c757d;
}

.breadcrumb-container .breadcrumb-item a {
  color: var(--primary-color, #0066cc);
  text-decoration: none;
}

.breadcrumb-container .breadcrumb-item a:hover {
  color: var(--primary-hover, #004499);
  text-decoration: underline;
}

.breadcrumb-container .breadcrumb-item.active {
  color: #6c757d;
}

/* ==========================================================================
   PAGINATION STYLES
   ========================================================================== */

.pagination .page-link {
  color: var(--primary-color, #0066cc);
  border-color: #dee2e6;
}

.pagination .page-link:hover {
  color: var(--primary-hover, #004499);
  background-color: #e9ecef;
  border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
  background-color: var(--primary-color, #FFF);
  border-color: var(--primary-color, #0066cc);
}

.pagination .page-item.disabled .page-link {
  color: #6c757d;
}

/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 768px) {
  .news-grid .card-body {
    min-height: auto;
  }
  
  .prose {
    font-size: 1rem;
  }
  
  .prose h2 {
    font-size: 1.25rem;
  }
  
  .prose h3 {
    font-size: 1.125rem;
  }
  
  .news-article .article-meta {
    text-align: center;
  }
}

/* ==========================================================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================================================== */

/* Focus styles for better keyboard navigation */
.news-grid .card-title a:focus,
.field--name-field-tags a:focus,
.breadcrumb-container .breadcrumb-item a:focus {
  outline: 2px solid var(--primary-color, #0066cc);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .news-grid .card {
    border: 2px solid #000;
  }
  
  .field--name-field-tags a {
    border: 1px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .news-grid .card,
  .news-grid .figure img,
  .news-grid .card-title a,
  .field--name-field-tags a {
    transition: none;
  }
  
  .news-grid .card:hover {
    transform: none;
  }
  
  .news-grid .card:hover .figure img {
    transform: none;
  }
}
