/* ==========================================
   தமிழ் பொன்மொழிகள் — Global stylesheet
   Mobile first, app style UI
   ========================================== */

:root {
    --brand: #004B93;
    --brand-dark: #00376d;
    --brand-soft: #e7f0fa;
    --ink: #172033;
    --ink-soft: #475467;
    --muted: #98a2b3;
    --line: #e6eaf2;
    --bg: #f5f7fb;
    --card: #ffffff;
    --green: #25D366;
    --amber: #f79009;
    --pink: #e0245e;
    --radius-lg: 22px;
    --radius: 15px;
    --radius-sm: 12px;
    --shadow: 0 8px 30px rgba(16, 24, 40, .08);
    --shadow-sm: 0 3px 12px rgba(16, 24, 40, .05);
    --nav-h: 62px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding-bottom: calc(var(--nav-h) + 26px);
    background: var(--bg);
    color: var(--ink);
    font-family: "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--brand);
    text-decoration: none;
}

img {
    max-width: 100%;
}

::selection {
    background: var(--brand);
    color: #fff;
}

/* ---------- Top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 14px;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .14);
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    min-width: 0;
}

.brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(255, 255, 255, .16);
    font-size: 17px;
}

.brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 18px;
}

.top-icon:active {
    transform: scale(.94);
}

/* ---------- Layout ---------- */

.page {
    max-width: 620px;
    margin: 0 auto;
    padding: 16px 14px 28px;
}

.page-head {
    margin: 4px 0 16px;
}

.page-title {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
}

.page-sub {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.section {
    margin-top: 24px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 800;
}

.section-title i {
    color: var(--brand);
}

.section-link {
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--brand);
}

/* ---------- Hero quote card ---------- */

.card-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    padding: 6px 13px;
    border-radius: 50px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
}

a.card-pill:hover {
    background: var(--brand);
    color: #fff;
}

.quote-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 400px;
    padding: 34px 22px 26px;
    border-radius: var(--radius-lg);
    background: var(--card);
    text-align: center;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.quote-card::before,
.quote-card::after {
    position: absolute;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 140px;
    line-height: 1;
    color: rgba(0, 75, 147, .07);
    pointer-events: none;
}

.quote-card::before {
    content: "\201C";
    top: -34px;
    left: 6px;
}

.quote-card::after {
    content: "\201D";
    right: 6px;
    bottom: -70px;
}

.quote-icon {
    position: relative;
    z-index: 2;
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 23px;
}

.quote-text {
    position: relative;
    z-index: 2;
    font-size: 21px;
    line-height: 1.9;
    font-weight: 700;
    color: var(--ink);
}

.quote-card--sm {
    min-height: 0;
    padding: 26px 20px 22px;
}

.quote-card--sm .quote-icon {
    width: 42px;
    height: 42px;
    font-size: 19px;
    margin-bottom: 14px;
}

.quote-card--sm .quote-text {
    font-size: 18px;
    line-height: 1.8;
}

.quote-author {
    position: relative;
    z-index: 2;
    margin-top: 22px;
    color: var(--ink-soft);
    font-size: 13.5px;
    font-weight: 600;
}

.quote-meta {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 11.5px;
}

.quote-meta .dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--muted);
}

.quote-index {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 3;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

/* ---------- Action buttons ---------- */

.actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 14px;
}

.actions--4 {
    grid-template-columns: repeat(4, 1fr);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 11px 4px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform .12s ease;
}

.action-btn i {
    font-size: 18px;
    color: var(--brand);
}

.action-btn:active {
    transform: scale(.95);
}

.action-btn.is-on i {
    color: var(--pink);
}

.action-btn.is-on {
    background: #fff1f4;
}

.action-btn[data-tone="green"] i {
    color: var(--green);
}

.action-btn[data-tone="amber"] i {
    color: var(--amber);
}

/* ---------- Prev / next ---------- */

.navigation {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.nav-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 13px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(0, 75, 147, .22);
    cursor: pointer;
}

.nav-btn.light {
    background: var(--card);
    color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.nav-btn:hover {
    background: var(--brand-dark);
    color: #fff;
}

.nav-btn.light:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.nav-btn.disabled {
    opacity: .45;
    pointer-events: none;
}

/* ---------- List rows ---------- */

.quote-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quote-row {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease;
}

.quote-row:active {
    transform: scale(.99);
}

.quote-row-body {
    flex: 1;
    min-width: 0;
}

.quote-row-body h3 {
    margin: 0 0 8px;
    font-size: 14.5px;
    line-height: 1.75;
    font-weight: 700;
    color: var(--ink);
}

.quote-row-body h3:hover {
    color: var(--brand);
}

.row-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
    font-size: 11.5px;
}

.row-meta .tag {
    padding: 3px 9px;
    border-radius: 50px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 700;
}

.row-meta .tag:hover {
    background: var(--brand);
    color: #fff;
}

.fav-btn {
    align-self: flex-start;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #f4f6fa;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
}

.fav-btn.is-on {
    background: #fff1f4;
    color: var(--pink);
}

/* ---------- Search ---------- */

.search-box {
    position: relative;
    margin-bottom: 14px;
}

.search-box i.bi-search {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 16px;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 14px 46px 14px 44px;
    border: 1px solid var(--line);
    border-radius: 50px;
    background: var(--card);
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    outline: none;
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 75, 147, .12);
}

.search-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #eef1f6;
    color: var(--ink-soft);
    font-size: 15px;
    cursor: pointer;
}

/* ---------- Filter chips ---------- */

.chips {
    display: flex;
    gap: 8px;
    margin: 0 -14px 14px;
    padding: 2px 14px 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 50px;
    background: var(--card);
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.chip .count {
    color: var(--muted);
    font-weight: 600;
}

.chip.active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.chip.active .count {
    color: rgba(255, 255, 255, .75);
}

/* ---------- Category grid ---------- */

.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cat-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease;
}

.cat-card:active {
    transform: scale(.98);
}

.cat-card:hover {
    color: var(--brand);
}

.cat-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 18px;
}

.cat-name {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.4;
}

.cat-count {
    color: var(--muted);
    font-size: 11.5px;
}

/* ---------- Stats ---------- */

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.stat {
    padding: 14px 8px;
    border-radius: var(--radius);
    background: var(--card);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat b {
    display: block;
    font-size: 19px;
    font-weight: 800;
    color: var(--brand);
}

.stat span {
    color: var(--muted);
    font-size: 11.5px;
}

/* ---------- Info cards (about) ---------- */

.info-card {
    display: flex;
    gap: 13px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    margin-bottom: 10px;
}

.info-card .info-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 18px;
}

.info-card h3 {
    margin: 0 0 4px;
    font-size: 14.5px;
    font-weight: 800;
}

.info-card p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.75;
}

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination .page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 16px;
    border-radius: 50px;
    background: var(--card);
    color: var(--brand);
    font-size: 12.5px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.pagination .page-btn.disabled {
    opacity: .45;
    pointer-events: none;
}

.pagination .page-num {
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 700;
}

/* ---------- Empty state ---------- */

.empty {
    padding: 46px 20px;
    border-radius: var(--radius-lg);
    background: var(--card);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.empty i {
    font-size: 42px;
    color: var(--brand);
    opacity: .35;
}

.empty h3 {
    margin: 14px 0 6px;
    font-size: 16px;
    font-weight: 800;
}

.empty p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
}

.btn-primary-app {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 22px;
    border: 0;
    border-radius: 50px;
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
}

.btn-ghost-app {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 20px;
    border-radius: 50px;
    background: var(--brand-soft);
    color: var(--brand);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

/* ---------- Bottom navigation ---------- */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: var(--nav-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -3px 14px rgba(16, 24, 40, .06);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.bottom-nav-item i {
    font-size: 19px;
}

.bottom-nav-item.active {
    color: var(--brand);
}

.bottom-nav-item.active i {
    transform: translateY(-1px);
}

/* ---------- Footer ---------- */

.footer {
    padding: 22px 14px 10px;
    text-align: center;
    color: var(--muted);
    font-size: 11.5px;
}

.footer p {
    margin: 0;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.footer-links a {
    color: var(--brand);
    font-weight: 700;
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + 18px);
    z-index: 1100;
    transform: translate(-50%, 20px);
    max-width: 88%;
    padding: 12px 20px;
    border-radius: 50px;
    background: rgba(23, 32, 51, .94);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Share sheet ---------- */

.share-sheet {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(16, 24, 40, .45);
    padding: 12px;
}

.share-sheet.show {
    display: flex;
}

.share-sheet-inner {
    width: 100%;
    max-width: 480px;
    padding: 18px 16px 14px;
    border-radius: 20px;
    background: #fff;
    animation: sheetUp .22s ease;
}

@keyframes sheetUp {
    from { transform: translateY(24px); opacity: .6; }
    to { transform: translateY(0); opacity: 1; }
}

.share-sheet-title {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border: 0;
    border-radius: var(--radius-sm);
    background: #f6f8fc;
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
}

.share-item i {
    font-size: 22px;
}

.share-item.whatsapp i { color: var(--green); }
.share-item.facebook i { color: #1877f2; }
.share-item.twitter i { color: #1d9bf0; }
.share-item.copy i { color: var(--brand); }

.share-sheet-close {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: #eef1f6;
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

/* ---------- Misc helpers ---------- */

.d-none {
    display: none !important;
}

.spinner {
    width: 22px;
    height: 22px;
    margin: 22px auto;
    border: 3px solid var(--brand-soft);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    height: 84px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, #eef1f6 25%, #f8fafc 50%, #eef1f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    margin-bottom: 10px;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ---------- Desktop ---------- */

@media (min-width: 768px) {
    .topbar {
        padding: 0 30px;
    }

    .page {
        padding: 28px 20px 40px;
    }

    .quote-card {
        min-height: 470px;
        padding: 48px 44px 34px;
    }

    .quote-text {
        font-size: 27px;
    }

    .quote-card--sm {
        min-height: 0;
    }

    .actions {
        gap: 12px;
    }

    .cat-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .bottom-nav {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        max-width: 620px;
        border-radius: 18px 18px 0 0;
    }
}

@media print {
    .topbar,
    .bottom-nav,
    .actions,
    .navigation,
    .footer,
    .share-sheet,
    .toast {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .quote-card {
        box-shadow: none;
        border: 1px solid #ddd;
        min-height: 0;
    }
}