/* Ayurvedic Medicine Cards Section */

/* Medicine Section Container */
.medicine-section {
    padding: 60px 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 253, 250, 0.9) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.medicine-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Medicine Cards Grid */
.medicine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (min-width: 640px) {
    .medicine-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .medicine-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
}

/* Individual Medicine Card */
.medicine-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.08),
        0 4px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid #d1d5db;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Fixed aspect ratio for consistent sizing */
    aspect-ratio: 16/9; /* Adjust this ratio to match your screen.png */
    min-height: 180px; /* Minimum height for mobile */
}

/* Medicine Card Hover Effects */
.medicine-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Medicine Card Background Image */
.medicine-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
    /* Ensure images maintain aspect ratio */
    object-fit: cover;
}

.medicine-card:hover .medicine-card-bg {
    transform: scale(1.1);
}

/* Medicine Card Overlay */
.medicine-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.1) 40%,
        rgba(0, 0, 0, 0.4) 100%
    );
    transition: opacity 0.3s ease;
}

.medicine-card:hover .medicine-card-overlay {
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.05) 40%,
        rgba(0, 0, 0, 0.3) 100%
    );
}

/* Medicine Name Label */
.medicine-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 70%,
        transparent 100%
    );
    color: white;
    z-index: 10;
    transition: all 0.3s ease;
}

.medicine-name h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
}

.medicine-name p {
    font-size: 0.8rem;
    margin: 0;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hover Effects for Name */
.medicine-card:hover .medicine-name {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.5) 70%,
        transparent 100%
    );
    transform: translateY(0);
}

/* Benefits Tooltip (appears on hover) */
.medicine-benefits {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 20px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 15;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.medicine-card:hover .medicine-benefits {
    opacity: 1;
    transform: translateY(0);
}

.medicine-benefits span {
    font-size: 0.75rem;
    color: #374151;
    font-weight: 500;
}

/* Specific Color Gradients for Each Medicine */
.medicine-card[data-medicine="अश्वगंधा"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.medicine-card[data-medicine="ब्राह्मी"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.medicine-card[data-medicine="त्रिफला"] {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.medicine-card[data-medicine="हल्दी"] {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.medicine-card[data-medicine="गिलोय"] {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.medicine-card[data-medicine="आंवला"] {
    background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
}

.medicine-card[data-medicine="नीम"] {
    background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
}

.medicine-card[data-medicine="तुलसी"] {
    background: linear-gradient(135deg, #fdbb2d 0%, #22c1c3 100%);
}

/* Section Title */
.medicine-section-title {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
    z-index: 10;
}

.medicine-section-title h2 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.medicine-section-title p {
    font-size: 1.1rem;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Loading Animation */
.medicine-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #6b7280;
}

.medicine-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (min-width: 640px) {
    .medicine-card {
        min-height: 200px; /* Increased height for tablets */
    }
}

@media (min-width: 768px) {
    .medicine-card {
        min-height: 220px; /* Increased height for desktops */
    }
}

@media (min-width: 1024px) {
    .medicine-card {
        min-height: 240px; /* Maximum height for large screens */
    }
}

@media (max-width: 640px) {
    .medicine-section {
        padding: 40px 0;
    }
    
    .medicine-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 16px;
    }
    
    .medicine-card {
        min-height: 160px;
    }
    
    .medicine-section-title h2 {
        font-size: 2rem;
    }
    
    .medicine-section-title p {
        font-size: 1rem;
        padding: 0 20px;
    }
    
    .medicine-name {
        padding: 12px;
    }
    
    .medicine-name h3 {
        font-size: 1rem;
    }
    
    .medicine-name p {
        font-size: 0.75rem;
    }
}

/* Fade-in animation */
.medicine-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.medicine-card:nth-child(1) { animation-delay: 0.1s; }
.medicine-card:nth-child(2) { animation-delay: 0.2s; }
.medicine-card:nth-child(3) { animation-delay: 0.3s; }
.medicine-card:nth-child(4) { animation-delay: 0.4s; }
.medicine-card:nth-child(5) { animation-delay: 0.5s; }
.medicine-card:nth-child(6) { animation-delay: 0.6s; }
.medicine-card:nth-child(7) { animation-delay: 0.7s; }
.medicine-card:nth-child(8) { animation-delay: 0.8s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility */
.medicine-card:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.medicine-card:focus:not(:focus-visible) {
    outline: none;
}