:root {
    /* Upnode Corporate Identity */
    --primary-green: #0a192f;         /* Main Dark Navy */
    --primary-green-light: #0284c7;   /* Upnode Tech Cyan */
    --accent-orange: #d97736;         /* Gold/Amber Accent */
    --bg-cream: #f4f6f9;              /* Modern Soft Slate Neutral Background */
    --bg-cream-light: #f8fafc;        /* Soft White-Slate Surface */
    --text-dark: #0f172a;             /* Deep Slate Dark Text */
    --text-muted: #64748b;            /* Muted Slate Text */
    --white: #ffffff;
    --border-light: #e2e8f0;          /* Modern Light Border */
    --border-tan: #e2e8f0;
}

* { 
    box-sizing: border-box; 
    -webkit-user-select: none; 
    user-select: none; 
}

body {
    margin: 0; 
    padding: 0;
    background-color: var(--bg-cream);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-dark);
    padding-bottom: 70px;
}

/* Header Bar */
header {
    background-color: var(--primary-green);
    color: var(--white);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-title { 
    font-weight: bold; 
    font-size: 15px; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
}
.header-actions { 
    display: flex; 
    gap: 6px; 
    align-items: center; 
}

.btn-header {
    background-color: rgba(255,255,255,0.15);
    color: white; 
    border: 1px solid rgba(255,255,255,0.3);
    padding: 5px 10px; 
    border-radius: 4px;
    font-size: 12px; 
    font-weight: bold; 
    cursor: pointer;
    text-decoration: none; 
    display: inline-flex; 
    align-items: center; 
    gap: 4px;
}
.btn-website { 
    background-color: rgba(255,255,255,0.25); 
    border-color: rgba(255,255,255,0.5); 
}
.btn-logout { 
    background-color: #ef4444; 
    border: none; 
}
.btn-install { 
    background-color: var(--accent-orange); 
    border: none; 
}

/* House Promo Banner */
.ad-container { margin-bottom: 12px; }
.house-ad {
    background: white;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    border-top: 3px solid var(--accent-orange);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.ad-badge {
    background: var(--accent-orange);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 4px;
}
.house-ad p { 
    font-size: 12px; 
    margin: 4px 0 8px 0; 
    color: var(--text-dark); 
}
.ad-cta-btn {
    background: var(--primary-green);
    color: white;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}

/* Search Bar */
.search-container { margin-bottom: 12px; }
.search-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    font-size: 14px;
    outline: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.search-input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(10, 25, 47, 0.12);
}

/* Category Filter Section */
.category-filter-container { margin-bottom: 15px; }
.category-pills-row, .subthemes-pills-row {
    display: flex; 
    gap: 6px; 
    overflow-x: auto;
    padding-bottom: 8px; 
    align-items: center;
    -webkit-overflow-scrolling: touch;
}
.category-pills-row::-webkit-scrollbar, .subthemes-pills-row::-webkit-scrollbar { 
    display: none; 
}

.filter-label, .sub-label {
    font-size: 12px; 
    font-weight: bold;
    color: var(--primary-green); 
    white-space: nowrap;
}
.cat-pill, .sub-pill {
    background: white; 
    border: 1px solid var(--border-light);
    padding: 5px 12px; 
    border-radius: 16px; 
    font-size: 11px;
    font-weight: 600; 
    white-space: nowrap; 
    cursor: pointer; 
    color: var(--text-dark);
}
.cat-pill.active, .sub-pill.active {
    background: var(--primary-green); 
    color: white; 
    border-color: var(--primary-green);
}

/* Top Authors Action Bar */
.top-authors-bar {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: white; 
    padding: 10px 12px; 
    border-radius: 6px;
    margin-bottom: 15px; 
    border: 1px solid var(--border-light);
}
.top-authors-title { 
    font-size: 12px; 
    font-weight: bold; 
    color: var(--primary-green); 
}
.btn-top-authors {
    background: var(--primary-green-light); 
    color: white; 
    border: none;
    padding: 4px 10px; 
    border-radius: 12px; 
    font-size: 11px;
    font-weight: bold; 
    cursor: pointer;
}

/* Tab Content Screens */
.tab-screen { 
    display: none; 
    padding: 15px; 
    max-width: 800px; 
    margin: 0 auto; 
}
.tab-screen.active { display: block; }

/* TAB 1: READ NOW */
#pdf-render {
    width: 100%; 
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
    background: #fff;
}
.controls {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-top: 15px; 
    background: white; 
    padding: 10px; 
    border-radius: 8px;
}
.controls button {
    background: var(--primary-green); 
    color: white; 
    border: none;
    padding: 8px 16px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold;
}
.chapter-body {
    background: white; 
    padding: 25px; 
    border-radius: 8px;
    line-height: 1.8; 
    font-size: 18px; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    margin-bottom: 15px; 
    user-select: text; 
    -webkit-user-select: text;
}

/* TAB 2 & 3: STORE & LIBRARY GRID */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 15px;
}
.book-card {
    background: white; 
    border-radius: 8px; 
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); 
    display: flex;
    flex-direction: column; 
    text-align: center;
}
.book-cover-container {
    width: 100%; 
    aspect-ratio: 2 / 3;
    background: rgba(0, 0, 0, 0.04); 
    overflow: hidden;
    display: flex; 
    align-items: center; 
    justify-content: center;
}
.book-card img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    display: block; 
}
.book-info { 
    padding: 10px; 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
}
.book-title { 
    font-size: 14px; 
    font-weight: bold; 
    margin-bottom: 2px; 
    color: var(--primary-green); 
}
.book-author { 
    font-size: 12px; 
    color: var(--text-muted); 
    margin-bottom: 6px; 
}

.action-btn {
    background: var(--primary-green); 
    color: white; 
    border: none;
    padding: 8px 10px; 
    border-radius: 4px; 
    font-size: 12px;
    font-weight: bold; 
    cursor: pointer; 
    width: 100%; 
    text-decoration: none;
    display: inline-block; 
    text-align: center; 
    margin-top: 4px;
}
.action-btn.btn-free { background: var(--primary-green-light); }

/* Social Media Clickable Badges */
.modal-social-badges { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
    flex-wrap: wrap; 
}
.social-badge {
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    width: 28px; 
    height: 28px; 
    border-radius: 50%; 
    color: #ffffff !important;
    font-size: 13px; 
    text-decoration: none;
}
.social-badge.fb { background-color: #1877f2; }
.social-badge.tt { background-color: #000000; }
.social-badge.tw { background-color: #000000; }
.social-badge.ig { background-color: #e1306c; }

/* Guest Empty State Box */
.guest-box {
    grid-column: 1/-1; 
    text-align: center;
    background: white; 
    padding: 30px 20px;
    border-radius: 8px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-top: 10px;
}

/* Bottom Tab Navigation Bar */
.nav-tabs {
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    height: 60px;
    background: white; 
    display: flex; 
    justify-content: space-around;
    align-items: center; 
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); 
    z-index: 1000;
}
.tab-btn {
    background: none; 
    border: none; 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
    color: var(--text-muted);
    font-size: 11px; 
    font-weight: 600; 
    cursor: pointer; 
    flex-grow: 1; 
    height: 100%;
}
.tab-btn span.icon { 
    font-size: 20px; 
    margin-bottom: 2px; 
}
.tab-btn.active { 
    color: var(--primary-green-light); 
    font-weight: bold; 
}

.hidden { display: none !important; }