/* Modern Card Grid Design - News & Articles Section */
/* استایل کارت‌های مدرن برای بخش اخبار و مقالات */

/* RTL Defaults for Home Sections */
.homepage-section,
.rtlDir {
    direction: rtl;
    text-align: right;
}

/* Grid Layout for News Section - Fixed for even distribution */
.news-section .section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
    align-items: stretch; /* Ensure all cards have same height */
}

/* Modern Card Base Style - Fixed height and flex layout */
.modern-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure all cards have same height */
    min-height: 320px; /* Smaller minimum height for consistency */
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.modern-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Card Image Styling - Fixed height */
.modern-card .card-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.modern-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    border-radius: 12px 12px 0 0;
}

.modern-card:hover .card-image img {
    transform: scale(1.05);
}

/* Image Overlay for Better Text Readability */
.modern-card .card-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg, 
        rgba(0, 0, 0, 0.1) 0%, 
        rgba(0, 0, 0, 0.3) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-card:hover .card-image::after {
    opacity: 1;
}

/* Card Content - Flex grow to fill remaining space */
.modern-card .card-content {
    padding: 15px;
    text-align: right;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Card Title */
.modern-card .card-title {
    font-size: 1.1rem;
    color: #ffffff;
    margin: 0 0 10px 0;
    cursor: pointer;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
    font-weight: 600;
    line-height: 1.3;
}

.modern-card .card-title:hover {
    color: #00bfa5;
    text-decoration: none;
}

/* Card Description - Fixed height with overflow */
.modern-card .card-text {
    font-size: 0.9rem;
    color: #ffffff;
    line-height: 1.5;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1; /* Take remaining space */
    min-height: 45px; /* Smaller minimum height for consistency */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Card Meta Information - Fixed at bottom */
.modern-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #ffffff;
    margin-top: 12px;
    padding-top: 12px;
    direction: rtl;
    flex-shrink: 0; /* Keep meta at bottom */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.modern-card .card-date {
    color: #ffffff;
    font-weight: 500;
}

/* Articles Section Carousel Cards - Fixed Layout */
.articles-section {
    padding: 80px 0;
    background: transparent;
}

.articles-section .owl-carousel {
    margin: 0;
    padding: 0;
}

.articles-section .owl-item {
    padding: 10px;
    height: auto;
}

.articles-section .owl-item-post {
    height: 100%;
    display: flex;
}

.articles-section .modern-article-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 320px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.articles-section .modern-article-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.articles-section .modern-article-card .article-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    flex-shrink: 0;
}

.articles-section .modern-article-card .article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.articles-section .modern-article-card:hover .article-image img {
    transform: scale(1.05);
}

.articles-section .modern-article-card .article-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: right;
    justify-content: space-between;
}

.articles-section .modern-article-card .article-category {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    align-self: flex-start;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.articles-section .modern-article-card .article-title {
    font-size: 1.1rem;
    color: #ffffff;
    margin: 0 0 8px 0;
    cursor: pointer;
    transition: color 0.3s ease;
    font-weight: 600;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.articles-section .modern-article-card .article-title a {
    color: inherit;
    text-decoration: none;
}

.articles-section .modern-article-card .article-title:hover,
.articles-section .modern-article-card .article-title a:hover {
    color: #00bfa5;
}

.articles-section .modern-article-card .article-excerpt {
    font-size: 0.8rem;
    color: #cccccc;
    line-height: 1.4;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 45px;
    margin-bottom: 12px;
}

.articles-section .modern-article-card .article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: #999;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.articles-section .modern-article-card .article-date {
    color: #1de9b6;
    font-weight: 500;
}

.articles-section .modern-article-card .article-comments {
    color: #999;
}

/* Owl Carousel Navigation for Articles */
.articles-section .owl-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 10;
}

.articles-section .owl-nav button {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    font-size: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
    pointer-events: auto !important;
    opacity: 0.8;
}

.articles-section .owl-nav button:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    transform: scale(1.1) !important;
    opacity: 1;
}

.articles-section .owl-dots {
    text-align: center;
    margin-top: 30px;
}

.articles-section .owl-dots .owl-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3) !important;
    margin: 0 5px;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
}

.articles-section .owl-dots .owl-dot.active {
    background: linear-gradient(135deg, #00e0b8, #00c4a7) !important;
    transform: scale(1.2);
    border-color: #00d7b1 !important;
    box-shadow: 0 4px 12px rgba(0, 224, 184, 0.35);
}

/* Responsive Design for Articles */
@media (max-width: 768px) {
    .articles-section .modern-article-card {
        min-height: 350px;
    }
    
    .articles-section .modern-article-card .article-content {
        padding: 15px;
    }
    
    .articles-section .modern-article-card .article-title {
        font-size: 1rem;
    }
    
    .articles-section .modern-article-card .article-excerpt {
        min-height: 50px;
    }
    
    .articles-section .owl-nav {
        padding: 0 10px;
    }
    
    .articles-section .owl-nav button {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Responsive Design - Improved grid breakpoints */
@media (max-width: 768px) {
    .news-section .section-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .modern-card {
        min-height: 280px; /* Smaller minimum height on mobile */
    }
    
    .modern-card .card-content {
        padding: 12px;
    }
    
    .modern-card .card-title {
        font-size: 1rem;
    }
    
    .modern-card .card-text {
        min-height: 40px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .news-section .section-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .modern-card {
        min-height: 300px;
    }
}

@media (min-width: 1025px) {
    .news-section .section-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .modern-card {
        min-height: 320px;
    }
}

/* Enhanced Hover Effects */
.modern-card .card-title a,
.modern-article-card .article-title a {
    color: inherit;
    text-decoration: none;
    position: relative;
}

.modern-card .card-title a:hover,
.modern-article-card .article-title a:hover {
    color: #00bfa5;
}

.modern-card .card-title a::after,
.modern-article-card .article-title a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background: linear-gradient(90deg, #1de9b6, #00bfa5);
    transition: width 0.3s ease;
}

.modern-card .card-title a:hover::after,
.modern-article-card .article-title a:hover::after {
    width: 100%;
}

/* Category Badge */
.modern-card .card-category,
.modern-article-card .article-category {
    display: inline-block;
    background: rgba(29, 233, 182, 0.2);
    color: #1de9b6;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-bottom: 8px;
    border: 1px solid rgba(29, 233, 182, 0.3);
}

/* Glow Effect on Hover */
.modern-card:hover,
.modern-article-card:hover {
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(29, 233, 182, 0.1);
}

/* Override conflicting styles from modern-home-sections.css */
.news-section .section-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 15px !important;
    align-items: stretch !important;
}

/* Ensure cards don't get affected by conflicting row styles */
.news-section .section-grid:not(.row) {
    display: grid !important;
}

/* Fix for any remaining uneven card heights */
.modern-card {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Additional fixes for perfect card alignment */
.news-section .section-grid.news-main-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 15px !important;
    align-items: stretch !important;
    justify-items: stretch !important;
}

.news-section .section-grid.news-main-grid .modern-card {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Ensure consistent card content spacing */
.news-section .section-grid.news-main-grid .modern-card .card-content {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

/* Fix for card text overflow */
.news-section .section-grid.news-main-grid .modern-card .card-text {
    flex: 1 1 auto !important;
    min-height: 45px !important;
    max-height: 60px !important;
    overflow: hidden !important;
}

/* Ensure meta stays at bottom */
.news-section .section-grid.news-main-grid .modern-card .card-meta {
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

/* Global fixes for better layout consistency */
.homepage-section {
    position: relative;
    z-index: 1;
}

/* Fix for any conflicting styles */
.owl-carousel {
    position: relative;
}

.owl-stage {
    display: flex;
    align-items: stretch;
}

.owl-item {
    display: flex;
    height: auto;
}

/* Ensure proper spacing */
.container {
    position: relative;
    z-index: 2;
}

/* Fix for any background conflicts */
.articles-section,
.news-section {
    background: transparent !important;
    position: relative;
    z-index: 1;
}

/* Ensure proper text colors */
.articles-section *,
.news-section * {
    color: inherit;
}

/* Fix for any overflow issues */
.modern-card,
.modern-article-card {
    overflow: hidden;
    word-wrap: break-word;
}

/* Ensure proper image display */
.modern-card img,
.modern-article-card img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Fix for any flex issues */
.modern-card .card-content,
.modern-article-card .article-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Ensure proper link styling */
.modern-card a,
.modern-article-card a {
    text-decoration: none;
    color: inherit;
}

.modern-card a:hover,
.modern-article-card a:hover {
    text-decoration: none;
}

/* Services Section Cards - Exact Match with News Cards Style */
.services-section {
    padding: 5px 0;
    margin-top: 0 !important;
    background: transparent;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
    align-items: stretch; /* Ensure all cards have same height */
}

.service-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure all cards have same height */
    min-height: 320px; /* Same minimum height as news cards */
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.service-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Service Image - Exact match with news card image */
.service-card .service-image {
    position: relative;
    width: 100%;
    height: 160px; /* Same height as news cards */
    overflow: hidden;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.service-card .service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    border-radius: 12px 12px 0 0;
}

.service-card:hover .service-image img {
    transform: scale(1.05);
}

/* Image Overlay for Better Text Readability - Same as news cards */
.service-card .service-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg, 
        rgba(0, 0, 0, 0.1) 0%, 
        rgba(0, 0, 0, 0.3) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.service-card:hover .service-image::after {
    opacity: 1;
}

/* Service Content - Exact match with news card content */
.service-card .service-content {
    padding: 15px;
    text-align: right;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Service Title - Exact match with news card title */
.service-card .service-title {
    font-size: 1.1rem;
    color: #ffffff;
    margin: 0 0 10px 0;
    cursor: pointer;
    transition: color 0.3s ease;
    font-weight: 600;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.service-card .service-title a {
    color: inherit;
    text-decoration: none;
}

.service-card .service-title:hover,
.service-card .service-title a:hover {
    color: #00bfa5;
}

/* Service Description - Exact match with news card text */
.service-card .service-description {
    font-size: 0.9rem;
    color: #ffffff;
    line-height: 1.5;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1; /* Take remaining space */
    min-height: 45px; /* Same minimum height as news cards */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Service Category - Exact match with news card category */
.service-card .service-category {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    align-self: flex-start;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Service Meta - Exact match with news card meta */
.service-card .service-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #ffffff;
    margin-top: 12px;
    padding-top: 12px;
    direction: rtl;
    flex-shrink: 0; /* Keep meta at bottom */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.service-card .service-date {
    color: #1de9b6;
    font-weight: 500;
}

.service-card .service-link {
    color: #ffffff;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.service-card .service-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transform: translateY(-2px);
}

/* Responsive Design for Services - Exact match with News Cards */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .service-card {
        min-height: 320px; /* Same as news cards */
    }
    
    .service-card .service-content {
        padding: 15px;
    }
    
    .service-card .service-title {
        font-size: 1.1rem;
    }
    
    .service-card .service-description {
        min-height: 45px; /* Same as news cards */
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .service-card {
        min-height: 320px; /* Same as news cards */
    }
}

@media (min-width: 1025px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
    
    .service-card {
        min-height: 320px; /* Same as news cards */
    }
}

/* Ensure perfect alignment for all cards */
.services-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 15px !important;
    align-items: stretch !important;
    justify-items: stretch !important;
}

.services-grid .service-card {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.services-grid .service-card .service-content {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.services-grid .service-card .service-description {
    flex: 1 1 auto !important;
    min-height: 45px !important;
    max-height: 60px !important;
    overflow: hidden !important;
}

.services-grid .service-card .service-meta {
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

/* Override any conflicting styles */
.services-section .glass-card,
.services-section .glow-border {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
}

.services-section .grid-entry-title {
    display: none !important;
}

/* Force ECG to bottom of cards */
.service-card .ecg,
.modern-card .ecg,
.modern-article-card .ecg,
.med-card .ecg {
    position: absolute !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    z-index: 1 !important;
}

/* Additional override for all ECG elements */
.ecg {
    position: absolute !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    z-index: 1 !important;
}
