:root {
    --primary: #6366f1;
    --accent: #f43f5e;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --font-bengali: 'Noto Serif Bengali', serif;
    --font-english: 'Poppins', sans-serif;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body { 
    font-family: var(--font-english); 
    background-color: var(--bg); 
    color: var(--text-main);
    line-height: 1.6;
    transition: background 0.3s ease;
    display: flex;
    flex-direction: column;
}

.wrapper { flex: 1 0 auto; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 1.2rem; }

/* Header */
.main-header {
    background: var(--card-bg);
    padding: 12px 0;
    position: sticky; top: 0; z-index: 1000;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border);
}
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.logo-text { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.header-right { display: flex; align-items: center; gap: 10px; }

.search-wrapper { position: relative; }
.search-wrapper input {
    padding: 8px 35px 8px 15px;
    border-radius: 50px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text-main);
    width: 130px; transition: 0.3s;
}
.search-wrapper input:focus { width: 180px; outline: none; border-color: var(--primary); }
.search-btn {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    background: var(--primary); color: white; border: none;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
}

.theme-btn {
    width: 38px; height: 38px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--card-bg);
    color: var(--text-main); cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Category Bar */
.category-bar { background: var(--card-bg); padding: 10px 0; border-bottom: 1px solid var(--border); }
.categories-pill-box { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.category-pill {
    padding: 6px 12px; border-radius: 4px; background: var(--bg);
    border: 1px solid var(--border); cursor: pointer; white-space: nowrap; 
    font-size: 0.8rem; font-weight: 500;
}
.category-pill.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Poem Grid */
.poem-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 1rem; 
    padding: 1.5rem 0;
}

.poem-card {
    background: var(--card-bg); border-radius: 12px; padding: 1rem;
    border: 1px solid var(--border); cursor: pointer; transition: 0.3s;
    display: flex; flex-direction: column; justify-content: space-between;
    min-height: 140px;
}
.poem-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-photo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.card-poet { color: var(--primary); font-size: 0.7rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { font-family: var(--font-bengali); font-size: 0.95rem; font-weight: 700; line-height: 1.3; }
.card-body { 
    font-family: var(--font-bengali); color: var(--text-muted); 
    font-size: 0.8rem; margin: 8px 0; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Reader View */
.view { display: none; animation: fadeIn 0.4s ease; }
.view.active { display: block; }
.reader-container { max-width: 650px; margin: 2rem auto; }
.poem-reader { background: var(--card-bg); padding: 2rem 1.5rem; border-radius: 20px; border: 1px solid var(--border); text-align: center; }

.reader-photo { 
    max-width: 80%;
    height: auto; 
    border-radius: 12px; 
    border: 3px solid var(--primary); 
    margin-bottom: 1rem; 
    display: inline-block;
}

.poem-content-full {
    font-family: var(--font-bengali); 
    font-size: 1.1rem; 
    line-height: 1.8;
    white-space: pre-line; 
    margin: 1.5rem auto; 
    text-align: center; 
    color: var(--text-main);
}

.react-section {
    display: flex; align-items: center; gap: 10px;
    margin-top: 1.5rem; padding: 8px 12px; background: var(--bg);
    border-radius: 10px; width: fit-content; margin: 1.5rem auto 0;
}
.small-like-btn {
    width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--card-bg); color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.small-like-btn.liked { background: var(--accent); color: white; border-color: var(--accent); }
.react-info { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

.minimal-back-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; font-weight: 500; }

.main-footer { flex-shrink: 0; text-align: center; padding: 1.5rem; background: var(--card-bg); border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.8rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }