/* Enhanced Responsive Design - Comprehensive Mobile-First Approach */

/* Clickable Poem Cards Enhancement */
.poem-card {
    cursor: pointer;
    transition: all 0.3s ease;
    transform-origin: center;
    position: relative;
    overflow: hidden;
}

.poem-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(139, 69, 19, 0.25);
}

.poem-card:focus {
    outline: 3px solid #8b4513;
    outline-offset: 2px;
}

.poem-card .read-more-btn {
    background: none;
    border: none;
    color: #8b4513;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none; /* Let parent handle the click */
}

.poem-card:hover .read-more-btn {
    background: rgba(139, 69, 19, 0.1);
    transform: translateX(5px);
}

/* Enhanced Mobile Navigation */
.mobile-menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 40px;
        height: 40px;
        cursor: pointer;
        border: none;
        background: none;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-toggle:hover {
        background: rgba(139, 69, 19, 0.1);
    }
    
    .mobile-menu-toggle span {
        width: 24px;
        height: 3px;
        background: #8b4513;
        margin: 2px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }
    
    .mobile-menu-toggle.active span:first-child {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:last-child {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: rgba(255, 248, 240, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: flex-start;
        padding: 80px 1.5rem 2rem;
        gap: 0;
        transition: right 0.3s ease;
        box-shadow: -5px 0 25px rgba(139, 69, 19, 0.15);
        z-index: 999;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .nav-links a {
        display: block;
        width: 100%;
        padding: 1rem;
        border-radius: 10px;
        text-align: left;
        font-size: 1.1rem;
        transition: all 0.3s ease;
    }
    
    .nav-links a:hover,
    .nav-links a.active {
        background: rgba(139, 69, 19, 0.1);
        transform: translateX(5px);
    }
}

/* Responsive Grid Layouts */
@media (max-width: 480px) {
    .poem-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem 0;
    }
    
    .poems-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .poem-card {
        min-height: auto;
    }
    
    .poem-image {
        height: 180px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .poem-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .poems-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .poem-image {
        height: 160px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .poem-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .poems-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1025px) {
    .poem-cards {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2rem;
    }
    
    .poems-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2rem;
    }
}

/* Enhanced Footer Responsiveness */
@media (max-width: 768px) {
    footer .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-section {
        margin-bottom: 1rem;
    }
    
    .footer-section h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .footer-links li {
        margin: 0;
    }
    
    .footer-bottom {
        margin-top: 2rem;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(139, 69, 19, 0.1);
    }
    
    .footer-bottom p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

/* Enhanced Typography Responsiveness */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero p {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .section-header h2 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .section-header p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .poem-title {
        font-size: 1.2rem;
        line-height: 1.4;
    }
    
    .poem-excerpt {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .poem-meta {
        font-size: 0.8rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* Enhanced Form Responsiveness */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-group label {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 1rem;
        padding: 0.8rem;
        border-radius: 8px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-actions .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }
}

/* Enhanced Loading States */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #8b4513;
}

.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); }
}

/* Enhanced Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: #8b4513;
    color: white;
}

.btn-primary:hover {
    background: #a0522d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.3);
}

.btn-secondary {
    background: rgba(139, 69, 19, 0.1);
    color: #8b4513;
    border: 1px solid rgba(139, 69, 19, 0.2);
}

.btn-secondary:hover {
    background: rgba(139, 69, 19, 0.2);
    transform: translateY(-2px);
}

/* Enhanced Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.poem-card:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid #8b4513;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .poem-card {
        border: 2px solid #000;
    }
    
    .poem-card:hover {
        border-color: #8b4513;
    }
}

/* Enhanced Container Responsiveness */
@media (max-width: 480px) {
    .container {
        width: 95%;
        padding: 0 0.5rem;
    }
    
    .kabi-parichaya-section .container,
    .poems-section .container {
        padding: 0 1rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .container {
        width: 90%;
        padding: 0 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        width: 85%;
        padding: 0 1.5rem;
    }
}

/* Enhanced Section Spacing */
@media (max-width: 768px) {
    .kabi-parichaya-section,
    .poems-section {
        padding: 2rem 0;
    }
    
    .kabi-parichaya-box,
    .poems-header-box {
        padding: 1.5rem;
        margin: 1rem 0;
    }
    
    .intro-card {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .poet-photo-section {
        align-self: center;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .mobile-menu-toggle,
    footer,
    .poem-actions,
    .filter-btn,
    .load-more-btn {
        display: none !important;
    }
    
    .poem-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .poem-card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        margin-bottom: 1rem !important;
    }
}
