/* Uniform Poem Cards CSS - Ensures all poem cards have same size and are clickable */

/* Base poem card styling with fixed dimensions */
.poem-card {
    background: rgba(255, 248, 240, 0.9);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(160, 82, 45, 0.1);
    
    /* Fixed dimensions for uniformity */
    height: 480px !important;
    min-height: 480px !important;
    max-height: 480px !important;
    display: flex !important;
    flex-direction: column !important;
    
    /* Ensure clickability */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Hover effects for clickable cards */
.poem-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(139, 69, 19, 0.2);
    cursor: pointer;
}

.poem-card:focus {
    outline: 3px solid rgba(139, 69, 19, 0.5);
    outline-offset: 2px;
    transform: translateY(-3px);
}

/* Fixed image section */
.poem-card .poem-image {
    height: 200px !important;
    min-height: 200px !important;
    max-height: 200px !important;
    background: linear-gradient(135deg, #f4f1e8 0%, #e8dcc0 100%);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.poem-card .poem-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.poem-card:hover .poem-image img {
    transform: scale(1.05);
}

/* Fixed content section */
.poem-card .poem-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: calc(480px - 200px) !important; /* Total height minus image height */
    min-height: calc(480px - 200px) !important;
    max-height: calc(480px - 200px) !important;
}

/* Title styling with fixed height */
.poem-card .poem-title {
    font-size: 1.3rem;
    color: #3d2914;
    margin: 0 0 1rem 0;
    font-weight: 700;
    line-height: 1.3;
    height: 3.4rem; /* Fixed height for 2 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-shrink: 0;
}

/* Excerpt container with fixed height */
.poem-card .poem-excerpt-container {
    flex-grow: 1;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.poem-card .poem-excerpt {
    color: #5a4037;
    line-height: 1.6;
    font-size: 0.95rem;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    flex-grow: 1;
}

/* Meta section with fixed height */
.poem-card .poem-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #8b4513;
    border-top: 1px solid rgba(160, 82, 45, 0.1);
    padding-top: 1rem;
    margin-bottom: 1rem;
    height: auto;
    flex-shrink: 0;
}

.poem-card .poem-author {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.poem-card .poem-date {
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Actions section */
.poem-card .poem-actions {
    flex-shrink: 0;
    height: auto;
}

.poem-card .read-more-btn {
    background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    width: 100%;
    justify-content: center;
}

.poem-card .read-more-btn:hover {
    background: linear-gradient(135deg, #a0522d 0%, #8b4513 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.3);
}

/* Category badge */
.poem-card .poem-category {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(139, 69, 19, 0.9);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 5;
    backdrop-filter: blur(5px);
}

/* Icon styling */
.poem-card .poem-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: rgba(139, 69, 19, 0.3);
    background: linear-gradient(135deg, rgba(255, 248, 240, 0.8) 0%, rgba(232, 220, 192, 0.8) 100%);
}

/* Grid layout for poem cards */
.poem-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
    margin-top: 2rem;
}

.poems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .poem-card {
        height: 450px !important;
        min-height: 450px !important;
        max-height: 450px !important;
    }
    
    .poem-card .poem-content {
        padding: 1rem;
        height: calc(450px - 180px) !important;
        min-height: calc(450px - 180px) !important;
        max-height: calc(450px - 180px) !important;
    }
    
    .poem-card .poem-image {
        height: 180px !important;
        min-height: 180px !important;
        max-height: 180px !important;
    }
    
    .poem-card .poem-title {
        font-size: 1.2rem;
        height: 3rem;
    }
    
    .poem-card .poem-excerpt {
        font-size: 0.9rem;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
    
    .poem-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem 0;
    }
    
    .poems-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .poem-card {
        height: 420px !important;
        min-height: 420px !important;
        max-height: 420px !important;
    }
    
    .poem-card .poem-content {
        height: calc(420px - 160px) !important;
        min-height: calc(420px - 160px) !important;
        max-height: calc(420px - 160px) !important;
    }
    
    .poem-card .poem-image {
        height: 160px !important;
        min-height: 160px !important;
        max-height: 160px !important;
    }
    
    .poem-card .poem-title {
        font-size: 1.1rem;
        height: 2.8rem;
    }
}

/* Ensure clickability is maintained */
.poem-card * {
    pointer-events: none; /* Prevent child elements from intercepting clicks */
}

.poem-card {
    pointer-events: auto; /* Enable clicks on the card itself */
}

/* Loading and empty states */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 480px;
    color: #8b4513;
}

.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(139, 69, 19, 0.1);
    border-top: 4px solid #8b4513;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* View all card styling */
.view-all-card {
    grid-column: 1 / -1;
    margin-top: 1rem;
}

.view-all-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.1) 0%, rgba(160, 82, 45, 0.1) 100%);
    border: 2px dashed rgba(139, 69, 19, 0.3);
    border-radius: 15px;
    text-decoration: none;
    color: #8b4513;
    transition: all 0.3s ease;
    height: 200px;
    justify-content: center;
}

.view-all-link:hover {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.15) 0%, rgba(160, 82, 45, 0.15) 100%);
    border-color: rgba(139, 69, 19, 0.5);
    transform: translateY(-3px);
}

.view-all-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.view-all-link h3 {
    margin: 0.5rem 0;
    font-size: 1.5rem;
}

.view-all-link p {
    margin: 0.5rem 0;
    opacity: 0.8;
}

.view-all-link .arrow {
    font-size: 1.5rem;
    margin-top: 0.5rem;
}
