/* Dark Medical Cards Design - Optimized for Dr. Ebrahiminik Website */
/* طراحی کارت‌های تاریک پزشکی - بهینه‌سازی شده برای وب‌سایت دکتر ابراهیمی نیک */

:root {
    --bg: #0b0f14;
    --panel: #0f1520cc;
    --line: #24313f;
    --primary: #00e0ff;
    --accent: #7cffd4;
    --shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 1px #121a22 inset;
    --radius: 20px;
    --text-primary: #ffffff;
    --text-secondary: #b0b8c1;
    --text-muted: #6b7280;
}

/* Dark Medical Card Base Style */
.med-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), #0a0f17cc);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: transform .35s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
    z-index: 1;
}

.med-card:hover {
    transform: translateY(-4px);
}

/* Shimmer Effect */
.med-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%);
    transform: translateX(-120%) rotate(2deg);
    transition: transform .8s ease;
    z-index: 0;
}

.med-card:hover::before {
    transform: translateX(120%) rotate(2deg);
}

/* Glow Effect */
.med-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(50% 120% at 100% 0%, #00e0ff22 0%, transparent 60%),
                radial-gradient(120% 120% at 0% 100%, #7cffd422 0%, transparent 60%);
    mix-blend-mode: screen;
    opacity: .9;
    z-index: 0;
}

/* ECG Animation */
.ecg {
    position: absolute !important;
    left: 0 !important;
    bottom: 0 !important; /* اطمینان از قرارگیری در پایین */
    top: auto !important; /* جلوگیری از تداخل با top */
    height: 40px; /* کاهش از 72px به 40px */
    width: 100%;
    opacity: .4; /* کاهش شفافیت */
    pointer-events: none;
    mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
    filter: drop-shadow(0 0 3px rgba(0,224,255,.2)); /* کاهش سایه */
    z-index: 1;
}

/* Mobile Responsive ECG in Cards */
@media (max-width: 768px) {
    .ecg {
        height: 25px; /* کاهش از 40px به 25px */
        opacity: .15; /* کاهش شفافیت */
        bottom: 0;
        position: relative;
    }
    
    .med-card {
        margin-bottom: 20px !important;
        padding: 15px !important;
    }
    
    .med-card .card-content,
    .med-card .article-content,
    .med-card .service-content,
    .med-card .gallery-item-content {
        padding: 12px !important;
    }
}

@media (max-width: 480px) {
    .ecg {
        height: 20px; /* کاهش از 30px به 20px */
        opacity: .1; /* کاهش شفافیت */
        bottom: 0;
        position: relative;
    }
    
    .med-card {
        margin-bottom: 15px !important;
        padding: 12px !important;
    }
    
    .med-card .card-content,
    .med-card .article-content,
    .med-card .service-content,
    .med-card .gallery-item-content {
        padding: 10px !important;
    }
}

.ecg path {
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 220;
    animation: dash 5s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -440;
    }
}

/* Card Image Styling */
.med-card .card-image,
.med-card .article-image,
.med-card .service-image,
.med-card .gallery-item-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    flex-shrink: 0;
}

.med-card .card-image img,
.med-card .article-image img,
.med-card .service-image img,
.med-card .gallery-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    border-radius: var(--radius) var(--radius) 0 0;
}

.med-card:hover .card-image img,
.med-card:hover .article-image img,
.med-card:hover .service-image img,
.med-card:hover .gallery-item-image img {
    transform: scale(1.05);
}

/* Card Content Styling */
.med-card .card-content,
.med-card .article-content,
.med-card .service-content,
.med-card .gallery-item-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

/* Card Title */
.med-card .card-title,
.med-card .article-title,
.med-card .service-title,
.med-card .gallery-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.med-card .card-title a,
.med-card .article-title a,
.med-card .service-title a,
.med-card .gallery-item-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.med-card .card-title a:hover,
.med-card .article-title a:hover,
.med-card .service-title a:hover,
.med-card .gallery-item-title a:hover {
    color: var(--primary);
}

/* Card Category Badge */
.med-card .card-category,
.med-card .article-category,
.med-card .service-category {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--bg);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Card Description/Text */
.med-card .card-text,
.med-card .article-excerpt,
.med-card .service-description,
.med-card .gallery-item-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Meta Information */
.med-card .card-meta,
.med-card .article-meta,
.med-card .service-meta,
.med-card .gallery-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

.med-card .card-date,
.med-card .article-date,
.med-card .service-date,
.med-card .gallery-item-date {
    color: var(--text-muted);
}

.med-card .card-comments,
.med-card .article-comments {
    color: var(--primary);
    font-weight: 500;
}

/* Service Link */
.med-card .service-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    margin-top: 12px;
}

.med-card .service-link:hover {
    color: var(--accent);
}

/* Grid Layouts */
.med-grid {
    display: grid;
    gap: 18px;
}

@media (min-width: 640px) {
    .med-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .med-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .med-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Apply to existing card classes */
.modern-card,
.modern-article-card,
.service-card,
.gallery-item,
.news-card {
    background: linear-gradient(180deg, var(--panel), #0a0f17cc) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
    position: relative;
    overflow: hidden;
    transition: transform .35s ease;
    z-index: 1;
}

.modern-card:hover,
.modern-article-card:hover,
.service-card:hover,
.gallery-item:hover,
.news-card:hover {
    transform: translateY(-4px) !important;
}

/* Add shimmer effect to existing cards */
.modern-card::before,
.modern-article-card::before,
.service-card::before,
.gallery-item::before,
.news-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%);
    transform: translateX(-120%) rotate(2deg);
    transition: transform .8s ease;
    z-index: 0;
}

.modern-card:hover::before,
.modern-article-card:hover::before,
.service-card:hover::before,
.gallery-item:hover::before,
.news-card:hover::before {
    transform: translateX(120%) rotate(2deg);
}

/* Add glow effect to existing cards */
.modern-card::after,
.modern-article-card::after,
.service-card::after,
.gallery-item::after,
.news-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(50% 120% at 100% 0%, #00e0ff22 0%, transparent 60%),
                radial-gradient(120% 120% at 0% 100%, #7cffd422 0%, transparent 60%);
    mix-blend-mode: screen;
    opacity: .9;
    z-index: 0;
}

/* Update text colors for existing cards */
.modern-card *,
.modern-article-card *,
.service-card *,
.gallery-item *,
.news-card * {
    color: var(--text-primary) !important;
}

.modern-card .card-text,
.modern-article-card .article-excerpt,
.service-card .service-description,
.gallery-item .gallery-item-excerpt,
.news-card .news-card-excerpt {
    color: var(--text-secondary) !important;
}

.modern-card .card-meta *,
.modern-article-card .article-meta *,
.service-card .service-meta *,
.gallery-item .gallery-item-meta *,
.news-card .news-card-meta * {
    color: var(--text-muted) !important;
}

/* Category badges for existing cards */
.modern-card .card-category,
.modern-article-card .article-category,
.service-card .service-category,
.news-card .news-card-badge {
    background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
    color: var(--bg) !important;
    border: none !important;
}

/* Links in existing cards */
.modern-card a,
.modern-article-card a,
.service-card a,
.gallery-item a,
.news-card a {
    color: var(--text-primary) !important;
    text-decoration: none !important;
}

.modern-card a:hover,
.modern-article-card a:hover,
.service-card a:hover,
.gallery-item a:hover,
.news-card a:hover {
    color: var(--primary) !important;
}

/* Service links */
.service-card .service-link {
    color: var(--primary) !important;
}

.service-card .service-link:hover {
    color: var(--accent) !important;
}

/* Comments count */
.modern-card .card-comments,
.modern-article-card .article-comments {
    color: var(--primary) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .med-card .card-content,
    .med-card .article-content,
    .med-card .service-content,
    .med-card .gallery-item-content {
        padding: 16px;
    }
    
    .med-card .card-title,
    .med-card .article-title,
    .med-card .service-title,
    .med-card .gallery-item-title {
        font-size: 1.1rem;
    }
}

/* Ensure proper z-index for content */
.med-card .card-content,
.med-card .article-content,
.med-card .service-content,
.med-card .gallery-item-content,
.modern-card .card-content,
.modern-article-card .article-content,
.service-card .service-content,
.gallery-item .gallery-item-content,
.news-card .news-card-content {
    position: relative;
    z-index: 2;
}

/* Optimize text display for medical content */
.med-card .card-text,
.med-card .article-excerpt,
.med-card .service-description,
.med-card .gallery-item-excerpt,
.modern-card .card-text,
.modern-article-card .article-excerpt,
.service-card .service-description,
.gallery-item .gallery-item-excerpt,
.news-card .news-card-excerpt {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Optimize titles for medical content */
.med-card .card-title,
.med-card .article-title,
.med-card .service-title,
.med-card .gallery-item-title,
.modern-card .card-title,
.modern-article-card .article-title,
.service-card .service-title,
.gallery-item .gallery-item-title,
.news-card .news-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 10px;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Optimize category badges */
.med-card .card-category,
.med-card .article-category,
.med-card .service-category,
.modern-card .card-category,
.modern-article-card .article-category,
.service-card .service-category,
.news-card .news-card-badge {
    background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
    color: var(--bg) !important;
    padding: 5px 12px !important;
    border-radius: 10px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 10px !important;
    display: inline-block !important;
    border: none !important;
}

/* Optimize meta information */
.med-card .card-meta,
.med-card .article-meta,
.med-card .service-meta,
.med-card .gallery-item-meta,
.modern-card .card-meta,
.modern-article-card .article-meta,
.service-card .service-meta,
.gallery-item .gallery-item-meta,
.news-card .news-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Optimize links */
.med-card a,
.modern-card a,
.modern-article-card a,
.service-card a,
.gallery-item a,
.news-card a {
    color: var(--text-primary) !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
}

.med-card a:hover,
.modern-card a:hover,
.modern-article-card a:hover,
.service-card a:hover,
.gallery-item a:hover,
.news-card a:hover {
    color: var(--primary) !important;
}

/* Optimize service links */
.service-card .service-link {
    color: var(--primary) !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
    margin-top: 12px !important;
    display: inline-block !important;
}

.service-card .service-link:hover {
    color: var(--accent) !important;
}

/* Optimize comments count */
.modern-card .card-comments,
.modern-article-card .article-comments {
    color: var(--primary) !important;
    font-weight: 500 !important;
}

/* Responsive optimizations */
@media (max-width: 768px) {
    .med-card .card-title,
    .med-card .article-title,
    .med-card .service-title,
    .med-card .gallery-item-title,
    .modern-card .card-title,
    .modern-article-card .article-title,
    .service-card .service-title,
    .gallery-item .gallery-item-title,
    .news-card .news-card-title {
        font-size: 1.1rem;
    }
    
    .med-card .card-text,
    .med-card .article-excerpt,
    .med-card .service-description,
    .med-card .gallery-item-excerpt,
    .modern-card .card-text,
    .modern-article-card .article-excerpt,
    .service-card .service-description,
    .gallery-item .gallery-item-excerpt,
    .news-card .news-card-excerpt {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
}
