/* Enhanced Poem Reader Styles with Attractive Decorative Borders */

/* Golden ratio based spacing and elegant typography */
:root {
    --poem-gold: #d4af37;
    --poem-bronze: #cd7f32;
    --poem-cream: #fff8e7;
    --poem-parchment: #f4f1e8;
    --poem-shadow: rgba(139, 69, 19, 0.15);
    --poem-text: #2c1810;
    --poem-accent: rgba(160, 82, 45, 0.8);
}

/* Main poem reader container with elegant background */
.poem-reader {
    min-height: 85vh;
    padding: 3rem 0;
    background: 
        linear-gradient(135deg, var(--poem-parchment) 0%, var(--poem-cream) 50%, #e8dcc0 100%),
        radial-gradient(circle at 30% 20%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(205, 127, 50, 0.03) 0%, transparent 50%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* Decorative background elements */
.poem-reader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(45deg, transparent 48%, rgba(212, 175, 55, 0.02) 49%, rgba(212, 175, 55, 0.02) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(205, 127, 50, 0.02) 49%, rgba(205, 127, 50, 0.02) 51%, transparent 52%);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Responsive grid layout */
.poem-reader-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
    position: relative;
    z-index: 1;
}

/* Main content column */
.poem-main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 700px;
}

/* Sidebar for image */
.poem-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: sticky;
    top: 2rem;
}

/* Enhanced box styling with ornate borders */
.poem-box {
    background: 
        linear-gradient(135deg, rgba(255, 252, 245, 0.98) 0%, rgba(250, 245, 235, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 2.5rem;
    box-shadow: 
        0 12px 40px var(--poem-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(212, 175, 55, 0.1);
    border: 2px solid rgba(212, 175, 55, 0.2);
    position: relative;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Ornate corner decorations */
.poem-box::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-top: 4px solid var(--poem-gold);
    border-left: 4px solid var(--poem-gold);
    border-top-left-radius: 12px;
    opacity: 0.6;
}

.poem-box::after {
    content: '';
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-bottom: 4px solid var(--poem-gold);
    border-right: 4px solid var(--poem-gold);
    border-bottom-right-radius: 12px;
    opacity: 0.6;
}

/* Hover effects */
.poem-box:hover {
    box-shadow: 
        0 16px 50px rgba(139, 69, 19, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -1px 0 rgba(212, 175, 55, 0.15);
    transform: translateY(-5px) scale(1.01);
    border-color: rgba(212, 175, 55, 0.35);
}

.poem-box:hover::before,
.poem-box:hover::after {
    opacity: 0.9;
    border-color: var(--poem-bronze);
}

/* Special styling for title box */
.poem-title-box {
    text-align: center;
    border: 4px double var(--poem-gold);
    background: 
        linear-gradient(135deg, rgba(255, 248, 240, 0.98) 0%, rgba(245, 240, 230, 0.98) 100%);
    position: relative;
}

.poem-title-box::before {
    border-color: var(--poem-bronze);
    border-width: 5px;
    width: 50px;
    height: 50px;
    top: 15px;
    left: 15px;
}

.poem-title-box::after {
    border-color: var(--poem-bronze);
    border-width: 5px;
    width: 50px;
    height: 50px;
    bottom: 15px;
    right: 15px;
}

/* Manuscript-style content box */
.poem-content-box {
    background: 
        linear-gradient(135deg, rgba(255, 252, 245, 0.98) 0%, rgba(250, 245, 235, 0.98) 100%);
    border-left: 6px solid var(--poem-accent);
    border-right: 2px solid rgba(212, 175, 55, 0.2);
    position: relative;
    font-family: 'Noto Serif Devanagari', serif;
}

/* Lined paper effect for content */
.poem-content-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: 
        linear-gradient(to bottom, 
            var(--poem-gold) 0%, 
            var(--poem-bronze) 50%, 
            var(--poem-gold) 100%);
    margin-left: 45px;
    opacity: 0.4;
}

/* Enhanced image frame styling */
.poem-image-box {
    background: 
        linear-gradient(135deg, rgba(245, 240, 230, 0.98) 0%, rgba(240, 235, 225, 0.98) 100%);
    border: 6px ridge var(--poem-gold);
    padding: 1.5rem;
    position: relative;
}

.poem-image-box::before {
    border-color: var(--poem-bronze);
    border-width: 6px;
    width: 35px;
    height: 35px;
}

.poem-image-box::after {
    border-color: var(--poem-bronze);
    border-width: 6px;
    width: 35px;
    height: 35px;
}

/* Enhanced image styling */
.poem-image {
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 
        0 8px 25px rgba(139, 69, 19, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.4s ease;
    border: 3px solid rgba(255, 255, 255, 0.8);
}

.poem-image:hover {
    transform: scale(1.02);
    box-shadow: 
        0 12px 35px rgba(139, 69, 19, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Typography enhancements */
.poem-title-box h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--poem-text);
    margin: 0;
    text-shadow: 0 2px 4px rgba(139, 69, 19, 0.1);
    line-height: 1.2;
}

.poem-content {
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--poem-text);
    text-align: left;
    white-space: pre-line;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(139, 69, 19, 0.05);
}

/* Back button enhancement */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--poem-gold) 0%, var(--poem-bronze) 100%);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
    background: linear-gradient(135deg, var(--poem-bronze) 0%, var(--poem-gold) 100%);
    border-color: rgba(255, 255, 255, 0.3);
}

/* =====================
   POEM CARD STYLES (for list pages)
   ===================== */

/* Make all poem cards the same height */
.poem-card {
    height: 450px !important; /* Fixed height for consistency */
    display: flex !important;
    flex-direction: column !important;
}

.poem-card-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.poem-card-excerpt {
    flex: 1 !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
}

.read-more-btn {
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
    font-weight: 600 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .poem-reader-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .poem-sidebar {
        order: -1;
        position: static;
    }
    
    .poem-box {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .poem-title-box h1 {
        font-size: 2rem;
    }
    
    .poem-content {
        font-size: 1.2rem;
        line-height: 1.7;
    }
    
    .poem-box::before,
    .poem-box::after {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
    
    /* Mobile card adjustments */
    .poem-card {
        height: 400px !important;
    }
    
    .poem-card-content {
        padding: 1.2rem !important;
    }
    
    .poem-card-title {
        font-size: 1.2rem !important;
    }
    
    .poem-card-excerpt {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    .poem-reader {
        padding: 1.5rem 0;
    }
    
    .poem-box {
        padding: 1rem;
        border-radius: 15px;
    }
    
    .poem-title-box h1 {
        font-size: 1.8rem;
    }
    
    .poem-content {
        font-size: 1.1rem;
    }
    
    .back-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* Print styles */
@media print {
    .poem-reader {
        background: white !important;
        padding: 1rem 0;
    }
    
    .poem-box {
        border: 2px solid #333 !important;
        box-shadow: none !important;
        background: white !important;
        page-break-inside: avoid;
    }
    
    .back-btn {
        display: none !important;
    }
}

/* Tablet responsive adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    .poem-card {
        height: 420px !important;
    }
}

/* ======================
   LOADING ANIMATIONS & UTILITIES
   ====================== */

/* Beautiful loading spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 69, 19, 0.1);
    border-left: 4px solid var(--poem-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading container enhancement */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    flex-direction: column;
    gap: 1rem;
    color: var(--poem-text);
    font-family: 'Noto Serif Devanagari', serif;
}

.loading-container p {
    font-size: 1.2rem;
    color: var(--poem-accent);
    margin: 0;
}

/* Error container enhancement */
.error-container {
    text-align: center;
    padding: 3rem;
    color: #666;
    background: rgba(255, 252, 245, 0.9);
    border-radius: 20px;
    border: 2px solid rgba(220, 53, 69, 0.2);
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.1);
}

.error-container h2 {
    color: #dc3545;
    margin-bottom: 1rem;
    font-family: 'Noto Serif Devanagari', serif;
}

/* ======================
   POET INFO & SHARING
   ====================== */

/* Kabi Parichaya specific styling */
.kabi-parichaya-box {
    background: linear-gradient(135deg, 
        rgba(248, 243, 235, 0.98) 0%, 
        rgba(243, 238, 230, 0.98) 100%);
    border: 3px solid rgba(139, 69, 19, 0.25);
    position: relative;
}

.kabi-parichaya-box::before {
    content: '🖋️';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 248, 240, 0.98);
    padding: 8px 12px;
    border-radius: 50%;
    font-size: 1.3rem;
    border: 3px solid var(--poem-gold);
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.2);
}

.kabi-parichaya-box h3 {
    color: var(--poem-bronze);
    font-size: 1.6rem;
    margin: 2rem 0 1.5rem 0;
    text-align: center;
    font-family: 'Noto Serif Devanagari', serif;
    border-bottom: 2px solid rgba(139, 69, 19, 0.3);
    padding-bottom: 0.8rem;
    position: relative;
}

.kabi-parichaya-box h3::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--poem-gold), transparent);
    border-radius: 2px;
}

.poet-info {
    text-align: center;
    color: var(--poem-text);
    line-height: 1.8;
    padding: 0 1rem;
}

.poet-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--poem-bronze);
    margin-bottom: 1rem;
    text-shadow: 0 1px 3px rgba(139, 69, 19, 0.1);
}

.poet-description {
    font-size: 1.05rem;
    color: rgba(60, 40, 20, 0.9);
    line-height: 1.7;
    margin-bottom: 2rem;
}

/* Enhanced share section */
.share-section {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px dashed rgba(139, 69, 19, 0.2);
}

.share-section h4 {
    color: var(--poem-bronze);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-family: 'Noto Serif Devanagari', serif;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.share-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.4rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--poem-gold) 0%, var(--poem-bronze) 100%);
}

.share-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

.share-btn:hover::before {
    width: 120%;
    height: 120%;
}

.share-btn:hover {
    transform: scale(1.15) translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    border-color: rgba(255, 255, 255, 0.9);
}

.share-facebook { 
    background: linear-gradient(135deg, #3b5998 0%, #2d4373 100%);
    color: white; 
}

.share-twitter { 
    background: linear-gradient(135deg, #1da1f2 0%, #0d8bd9 100%);
    color: white; 
}

.share-copy { 
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white; 
}

/* ======================
   ENHANCED CONTENT STYLING
   ====================== */

/* Poem text enhancements */
.poem-content {
    font-size: 1.35rem;
    line-height: 1.9;
    color: var(--poem-text);
    text-align: center;
    white-space: pre-line;
    font-weight: 500;
    letter-spacing: 0.8px;
    text-shadow: 0 1px 3px rgba(139, 69, 19, 0.08);
    padding: 1rem 2rem;
    font-family: 'Noto Serif Devanagari', serif;
}

/* Title enhancements */
.poem-title-box h1::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--poem-gold), var(--poem-bronze), var(--poem-gold), transparent);
    border-radius: 2px;
}

/* Poem meta information */
.poem-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.poem-category, .poem-date {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.15), rgba(160, 82, 45, 0.1));
    padding: 0.7rem 1.3rem;
    border-radius: 25px;
    font-size: 0.95rem;
    color: var(--poem-bronze);
    font-weight: 600;
    border: 1px solid rgba(139, 69, 19, 0.2);
    box-shadow: 0 3px 10px rgba(139, 69, 19, 0.1);
    transition: all 0.3s ease;
}

.poem-category:hover, .poem-date:hover {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.25), rgba(160, 82, 45, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.2);
}
