/* Mobile Home Page Optimizations */

/* Modern Mobile Post List Styles */
@media (max-width: 767.98px) {
  /* Container and Layout */
  .home-main-container {
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
  }
  
  .home-main-container .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
  }
  
  /* Modern Mobile Container */
  .modern-mobile-container {
    padding: 16px;
    background: #f8f9fa;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  }
  
  /* Modern Section Headers */
  .modern-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #eb2227 0%, #d32f2f 100%);
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(235, 34, 39, 0.18);
  }
  
  .modern-section-header::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #fff;
    border-radius: 2px;
  }
  
  .modern-section-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
    flex: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.10);
  }
  
  /* Modern Post Cards */
  .modern-post-card {
    background: #fff;
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
  }
  
  /* Horizontal Layout for Mobile */
  .modern-post-card.horizontal {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }
  
  .modern-post-card.horizontal .modern-post-image {
    flex: 0 0 120px;
    width: 120px;
    height: 120px;
    position: relative;
    overflow: hidden;
  }
  
  .modern-post-card.horizontal .modern-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
  }
  
  .modern-post-card.horizontal .modern-post-content {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  
  .modern-post-card.horizontal .modern-post-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
  }
  
  .modern-post-card.horizontal .modern-post-excerpt {
    color: #555;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .modern-post-card.horizontal .modern-post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: #666;
    margin-top: auto;
  }
  
  .modern-post-card.horizontal .modern-post-category {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(235, 34, 39, 0.9);
    color: #fff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    backdrop-filter: blur(10px);
  }
  
  .modern-post-card.horizontal:active {
    transform: scale(0.98);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  }
  
  .modern-post-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  }
  
  .modern-post-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
  }
  
  .modern-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
  }
  
  .modern-post-card:hover .modern-post-image img {
    transform: scale(1.05);
  }
  
  .modern-post-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(235, 34, 39, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
  }
  
  .modern-post-content {
    padding: 20px;
  }
  
  .modern-post-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.4;
    margin-bottom: 12px;
    display: block;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    max-height: none;
    text-decoration: none;
  }
  
  .modern-post-title:hover {
    color: #eb2227;
  }
  
  .modern-post-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: #666;
    margin-top: 12px;
  }
  
  .modern-post-date,
  .modern-post-views {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  .modern-post-excerpt {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  /* Modern Ad Blocks */
  .modern-ad-block {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }
  
  /* Section Dividers */
  .modern-section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #ddd, transparent);
    margin: 32px 0;
  }
  
  /* Floating Action Button */
  .modern-floating-action {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #eb2227;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(235, 34, 39, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
  }
  
  .modern-floating-action:active {
    transform: scale(0.9);
  }
  
  .modern-floating-action svg {
    width: 24px;
    height: 24px;
    color: #fff;
  }
  
  /* Loading Skeletons */
  .modern-loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
    height: 20px;
    margin-bottom: 8px;
  }
  
  @keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
  
  /* Enhanced Typography */
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
  }
  
  .modern-post-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  }
  
  /* Touch-friendly improvements */
  .modern-post-card,
  .modern-floating-action {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  /* Improved spacing */
  .row.gx-4 {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  .col-lg-8,
  .col-lg-4 {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  /* Remove Bootstrap gutters on mobile */
  .gx-4 > * {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .modern-mobile-container {
    background: #1a1a1a;
  }
  
  .modern-post-card {
    background: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .modern-post-card.horizontal {
    background: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .modern-post-title {
    color: #fff;
  }
  
  .modern-post-card.horizontal .modern-post-title {
    color: #fff;
  }
  
  .modern-post-excerpt {
    color: #ccc;
  }
  
  .modern-post-card.horizontal .modern-post-excerpt {
    color: #ccc;
  }
  
  .modern-post-meta {
    color: #999;
  }
  
  .modern-post-card.horizontal .modern-post-meta {
    color: #999;
  }
  
  .modern-ad-block {
    background: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.1);
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 991.98px) {
  .modern-mobile-container {
    padding: 24px;
  }
  
  .modern-post-card {
    margin-bottom: 24px;
  }
  
  .modern-post-card.horizontal .modern-post-image {
    flex: 0 0 140px;
    width: 140px;
    height: 140px;
  }
  
  .modern-post-card.horizontal .modern-post-title {
    font-size: 1.1rem;
  }
  
  .modern-post-image {
    height: 220px;
  }
  
  .modern-post-title {
    font-size: 1.2rem;
  }
}

/* Desktop optimizations */
@media (min-width: 992px) {
  .modern-mobile-container {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .modern-post-card {
    margin-bottom: 28px;
  }
  
  .modern-post-card.horizontal .modern-post-image {
    flex: 0 0 160px;
    width: 160px;
    height: 160px;
  }
  
  .modern-post-card.horizontal .modern-post-title {
    font-size: 1.2rem;
  }
  
  .modern-post-image {
    height: 240px;
  }
  
  .modern-post-title {
    font-size: 1.3rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .modern-post-card:hover {
    transform: none;
  }
  
  .modern-post-card:active {
    transform: scale(0.98);
  }
  
  .modern-floating-action:active {
    transform: scale(0.9);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .modern-post-card,
  .modern-post-image img,
  .modern-floating-action {
    transition: none;
  }
  
  .modern-loading-skeleton {
    animation: none;
  }
}

/* High contrast support */
@media (prefers-contrast: high) {
  .modern-post-card {
    border: 2px solid #000;
  }
  
  .modern-section-header {
    border: 2px solid #fff;
  }
  
  .modern-post-title {
    color: #000;
  }
  
  .modern-post-meta {
    color: #333;
  }
}

/* Print styles */
@media print {
  .modern-floating-action {
    display: none;
  }
  
  .modern-post-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .modern-section-header {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000;
  }
}

/* Legacy mobile styles for backward compatibility */
@media (max-width: 767.98px) {
  /* Main Featured Post */
  .main-featured-post {
    flex-direction: column !important;
    padding: 1rem !important;
    margin: 0.5rem !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  }
  
  .main-featured-post .featured-news-img {
    width: 100% !important;
    height: 200px !important;
    margin-right: 0 !important;
    margin-bottom: 1rem !important;
    border-radius: 8px !important;
  }
  
  .main-featured-post .featured-news-title {
    font-size: 1.1rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.5rem !important;
  }
  
  .main-featured-post .featured-news-badge {
    font-size: 0.85rem !important;
    padding: 0.25em 0.75em !important;
    margin-bottom: 0.75rem !important;
  }
  
  /* Important News Section */
  .important-news-card {
    margin: 0.5rem !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  }
  
  .important-news-content {
    padding: 1rem !important;
  }
  
  .important-news-card .col-md-6 {
    margin-bottom: 1rem !important;
  }
  
  .important-news-card .col-md-6:last-child {
    margin-bottom: 0 !important;
  }
  
  .important-news-img {
    height: 150px !important;
    border-radius: 8px !important;
  }
  
  .important-news-title {
    font-size: 0.95rem !important;
    line-height: 1.3 !important;
    margin-top: 0.75rem !important;
  }
  
  /* Home Feed Tabs */
  .home-feed-card {
    margin: 0.5rem !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  }
  
  .nav-tabs {
    border-radius: 12px 12px 0 0 !important;
    padding: 0.3rem !important;
    background: #0a4d0a !important;
  }
  
  .nav-tabs .nav-link {
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #fff !important;
    background: #0a4d0a !important;
    border: none !important;
    font-weight: bold !important;
    border-radius: 0 !important;
    margin-right: 0 !important;
    transition: background 0.2s !important;
  }
  
  .nav-tabs .nav-link.active {
    background: #8cc63f !important;
    color: #fff !important;
    border: none !important;
  }
  
  .nav-tabs .nav-link i {
    margin-right: 0.5rem !important;
  }
  
  .home-feed-card .tab-content {
    padding: 1rem !important;
  }
  
  /* News List Items */
  .news-list-item {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    border-bottom: 1px solid #eee !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
  }
  
  .news-list-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
  }
  
  .news-list-item .card-img {
    width: 100% !important;
    height: 180px !important;
    margin-right: 0 !important;
    margin-bottom: 0.75rem !important;
    border-radius: 8px !important;
  }
  
  .news-list-item .card-title {
    font-size: 1rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.5rem !important;
    min-height: auto !important;
    color: #222 !important;
    font-weight: 600 !important;
  }
  
  .news-list-item .card-meta {
    font-size: 0.85rem !important;
    color: #666 !important;
  }
  
  /* Sidebar */
  .sidebar {
    margin: 0.5rem !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  }
  
  .special-news-item {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.75rem !important;
    margin-bottom: 1rem !important;
    border-bottom: 1px solid #eee !important;
  }
  
  .special-news-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
  }
  
  .special-news-item .card-img {
    width: 100% !important;
    height: 120px !important;
    margin-left: 0 !important;
    margin-bottom: 0.75rem !important;
    border-radius: 8px !important;
  }
  
  .special-news-item .card-title {
    font-size: 0.9rem !important;
    line-height: 1.3 !important;
    min-height: auto !important;
    max-height: none !important;
    -webkit-line-clamp: unset !important;
    color: #222 !important;
    font-weight: 500 !important;
  }
  
  /* Section Headers */
  .section-header {
    padding: 1rem !important;
    font-size: 1.1rem !important;
    border-radius: 12px 12px 0 0 !important;
    font-weight: bold !important;
    color: #fff !important;
  }
  
  .section-header-green-red {
    background: #eb2227 !important;
  }
  
  /* Pagination */
  .pagination-wrapper {
    padding: 1rem !important;
  }
  
  .pagination .page-link {
    min-width: 44px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.9rem !important;
  }
  
  /* Touch-friendly improvements */
  .card-style a,
  .nav-link,
  .btn {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .home-main-container {
    padding: 0 1rem !important;
  }
  
  .main-featured-post {
    flex-direction: row !important;
    padding: 1.5rem !important;
  }
  
  .main-featured-post .featured-news-img {
    width: 40% !important;
    height: 180px !important;
    margin-right: 1.5rem !important;
    margin-bottom: 0 !important;
  }
  
  .main-featured-post .featured-news-title {
    font-size: 1.2rem !important;
  }
  
  .news-list-item {
    flex-direction: row !important;
    align-items: center !important;
  }
  
  .news-list-item .card-img {
    width: 120px !important;
    height: 90px !important;
    margin-right: 1rem !important;
    margin-bottom: 0 !important;
  }
  
  .special-news-item {
    flex-direction: row-reverse !important;
    align-items: center !important;
  }
  
  .special-news-item .card-img {
    width: 100px !important;
    height: 80px !important;
    margin-left: 1rem !important;
    margin-bottom: 0 !important;
  }
  
  .important-news-card,
  .home-feed-card {
    margin: 1rem !important;
  }
}

@media (min-width: 992px) {
  .home-main-container {
    padding: 0 2rem !important;
  }
  
  .main-featured-post {
    padding: 2rem !important;
  }
  
  .main-featured-post .featured-news-img {
    width: 45% !important;
    height: 220px !important;
    margin-right: 2rem !important;
  }
  
  .main-featured-post .featured-news-title {
    font-size: 1.4rem !important;
  }
  
  .news-list-item .card-img {
    width: 140px !important;
    height: 100px !important;
  }
  
  .special-news-item .card-img {
    width: 120px !important;
    height: 90px !important;
  }
}

@media (hover: none) and (pointer: coarse) {
  .card-style:hover {
    transform: none !important;
  }
  
  .nav-link:active,
  .btn:active {
    transform: scale(0.98) !important;
  }
  
  .news-list-item:active {
    background-color: rgba(0,0,0,0.05) !important;
  }
  
  .special-news-item:active {
    background-color: rgba(0,0,0,0.05) !important;
  }
}

.news-list-item.loading {
  opacity: 0.6;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .nav-link,
  .card-style,
  .btn {
    transition: none !important;
  }
  
  .main-featured-post .featured-news-img {
    transition: none !important;
  }
}

@media (prefers-contrast: high) {
  .card-style {
    border: 2px solid #000 !important;
  }
  
  .nav-tabs .nav-link {
    border: 2px solid #fff !important;
  }
  
  .news-list-item {
    border-bottom: 2px solid #000 !important;
  }
  
  .special-news-item {
    border-bottom: 2px solid #000 !important;
  }
}

@media (prefers-color-scheme: dark) {
  .main-featured-post,
  .important-news-card,
  .home-feed-card,
  .sidebar {
    background: #2d2d2d !important;
    color: #fff !important;
  }
  
  .news-list-item .card-title,
  .special-news-item .card-title {
    color: #fff !important;
  }
  
  .news-list-item .card-meta {
    color: #ccc !important;
  }
  
  .news-list-item,
  .special-news-item {
    border-bottom-color: #444 !important;
  }
}

.card-img {
  border-radius: 8px;
  object-fit: cover;
}

@media print {
  .nav-tabs,
  .pagination,
  .adblock {
    display: none !important;
  }
  
  .main-featured-post,
  .important-news-card,
  .home-feed-card,
  .sidebar {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

.modern-post-card.horizontal .modern-post-title {
  font-size: 14px;
}

.modern-post-card.horizontal .modern-post-title {
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
}

.special-news-section,
.sidebar-right {
  margin-top: 2rem;
} 

@media (max-width: 480px) {
  .modern-section-header {
    padding: 14px 10px;
    border-radius: 14px;
  }
  .modern-section-title {
    font-size: 1.15rem;
    letter-spacing: 0.5px;
  }
} 

.modern-section-header {
  display: flex;
  align-items: center;
  background: none;
  border-radius: 0;
  padding: 10px 22px 10px 14px;
  margin-bottom: 20px;
  box-shadow: none;
  width: fit-content;
}

.modern-section-dots {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-right: 10px;
  height: 22px;
}
.modern-section-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin: 1.5px 0;
}
.modern-section-dot.dot-blue { background: #1e90ff; }
.modern-section-dot.dot-red { background: #eb2227; }

.modern-section-text {
  color: #eb2227;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
} 

@media (max-width: 767.98px) {
  .mobile-pro-list {
    margin: 0;
    padding: 0;
    list-style: none;
    width: 100%;
  }
  .mobile-pro-list-item {
    display: flex;
    align-items: flex-start;
    width: 100%;
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    margin: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    min-height: 70px;
    gap: 12px;
  }
  .mobile-pro-list-item:last-child {
    border-bottom: none;
  }
  .mobile-pro-list-img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 4px;
    margin-right: 10px;
    background: #f0f0f0;
  }
  .mobile-pro-list-content {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
  }
  .mobile-pro-list-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #222;
    margin: 0 0 4px 0;
    line-height: 1.3;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  .mobile-pro-list-badge {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background: #cb0000;
    border-radius: 4px;
    padding: 2px 8px;
    margin-bottom: 2px;
    margin-right: 6px;
    white-space: nowrap;
  }
} 

@media (max-width: 767.98px) {
  .important-news-listcard {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 8px 6px !important;
    margin-bottom: 16px !important;
  }
  .important-news-list-img {
    width: 100% !important;
    height: 120px !important;
    object-fit: cover !important;
    margin-bottom: 8px !important;
    border-radius: 6px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .important-news-list-title {
    font-size: 1.08rem !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    display: block !important;
    text-align: left !important;
  }
} 