/* --- Core Variables & Theming --- */
:root {
    --bg-color: #121212;
    --surface-color: #000000;
    --text-primary: #ffffff;
    --text-secondary: #8e8e8e;
    --border-color: #262626;
    
    --primary-color: #7F00FF;
    --primary-hover: #6a00d6;
    
    --nav-height: 65px;
    --header-height: 60px;
    --app-max-width: 480px;
}

/* Light Mode Overrides */
body.light-mode {
    --bg-color: #f0f2f5;
    --surface-color: #ffffff;
    --text-primary: #000000;
    --text-secondary: #737373;
    --border-color: #dbdbdb;
}

/* --- Base & Desktop Wrapper --- */
* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* Desktop background */
body {
    background-color: #050505; 
    color: var(--text-primary);
    display: flex;
    justify-content: center;
}

/* The Mobile Viewport constraint */
#app-wrapper {
    width: 100%;
    max-width: var(--app-max-width);
    min-height: 100vh;
    background-color: var(--surface-color);
    position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    overflow-x: hidden;
    padding-top: var(--header-height);
    padding-bottom: var(--nav-height);
}

/* --- Splash Screen --- */
#splash-screen {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--app-max-width); height: 100vh;
    background-color: var(--surface-color);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; transition: opacity 0.5s ease;
}

.logo-container { text-align: center; color: var(--primary-color); }
.icon-logo { font-size: 4rem; margin-bottom: 10px; }

a {
  color: inherit;              /* use parent text color */
  text-decoration: underline; /* keep underline */
}

a:visited {
  color: inherit;              /* no purple visited color */
}

a:hover,
a:focus {
  text-decoration-thickness: 2px; /* nicer underline on hover */
}


/* --- Top Header (Glassmorphism) --- */
.top-header {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--app-max-width); height: var(--header-height);
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px); /* Premium blur effect */
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px; z-index: 100;
    border-bottom: 1px solid var(--border-color);
}
body.light-mode .top-header { background-color: rgba(255, 255, 255, 0.85); }

.search-bar {
    display: flex; align-items: center;
    background-color: var(--bg-color);
    border-radius: 8px; padding: 6px 12px; width: 70%;
}
.search-bar i { color: var(--text-secondary); font-size: 0.9rem; margin-right: 8px; }
.search-bar input {
    background: none; border: none; color: var(--text-primary);
    width: 100%; outline: none; font-size: 0.95rem;
}

button { background: none; border: none; color: var(--text-primary); font-size: 1.3rem; cursor: pointer; }

/* --- Sidebar & Toggle Switch --- */
.sidebar-overlay {
    position: fixed; 
    top: 0; 
    /* Aligns perfectly on both mobile screens and centered desktop wrapper */
    left: max(0px, calc(50vw - (var(--app-max-width) / 2)));
    width: 100%; 
    max-width: var(--app-max-width); 
    height: 100vh;
    background: rgba(0,0,0,0.6); 
    z-index: 1000;
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.3s;
}
.sidebar-overlay.active { 
    opacity: 1; 
    pointer-events: all; 
}

#sidebar {
    position: fixed; 
    top: 0; 
    /* Lock to the left edge of the app view */
    left: max(0px, calc(50vw - (var(--app-max-width) / 2)));
    transform: translateX(-100%); /* Hide completely off-canvas to the left */
    width: 280px; 
    height: 100vh;
    background-color: var(--surface-color); 
    z-index: 1001;
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border-color);
}
#sidebar.active { 
    transform: translateX(0); /* Slide smoothly into view */
}

.sidebar-header { padding: 20px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border-color); }

.sidebar-links { list-style: none; padding: 20px; }
.sidebar-links li { margin-bottom: 25px; }
.sidebar-links a { color: var(--text-primary); text-decoration: none; font-size: 1.1rem; display: flex; align-items: center; gap: 15px;}
.sidebar-links a i { color: var(--text-secondary); font-size: 1.2rem; width: 20px;}

/* Toggle Switch CSS */
.theme-toggle-container {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px; border-bottom: 1px solid var(--border-color); font-weight: 500;
}
.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(24px); }

/* --- Feed & Instagram Styles --- */
.post { border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 10px; }

.post-header { display: flex; align-items: center; padding: 12px 15px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; margin-right: 12px; }
.author-info { display: flex; flex-direction: column; }
.author-name { font-weight: 600; font-size: 0.95rem; }
.post-time { font-size: 0.75rem; color: var(--text-secondary); }

.subscribe-btn {
    margin-left: auto; background-color: var(--border-color); color: var(--text-primary);
    padding: 6px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: 600;
}
.subscribe-btn:hover { background-color: var(--primary-color); color: white;}

/* Reader */
.reader-container { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.reader-container::-webkit-scrollbar { display: none; }
.comic-page { min-width: 100%; scroll-snap-align: center; }
.comic-page img { width: 100%; display: block; object-fit: cover; }

/* Interactive Actions */
.post-actions { display: flex; justify-content: space-between; padding: 10px 15px 5px; }
.action-left { display: flex; gap: 18px; }
.action-btn { font-size: 1.5rem; transition: transform 0.1s, color 0.2s; }
.action-btn:active { transform: scale(0.9); }
.action-btn:hover { color: var(--text-secondary); }

.post-stats { padding: 0 15px; font-weight: 600; font-size: 0.9rem; margin-bottom: 5px; }
.post-caption { padding: 0 15px; font-size: 0.9rem; line-height: 1.4; margin-bottom: 10px;}

/* Comment Input */
.comment-section {
    display: flex; align-items: center; padding: 5px 15px; margin-top: 5px;
}
.avatar-small { width: 28px; height: 28px; border-radius: 50%; margin-right: 12px; }
.comment-input {
    flex: 1; background: none; border: none; color: var(--text-primary);
    font-size: 0.9rem; outline: none;
}
.post-comment-btn {
    color: var(--primary-color); font-weight: 600; font-size: 0.9rem; margin-left: 10px;
}

/* --- Bottom Navigation (Glassmorphism + Icons) --- */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--app-max-width); height: var(--nav-height);
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex; justify-content: space-around; align-items: center;
    border-top: 1px solid var(--border-color); z-index: 100;
}
body.light-mode .bottom-nav { background-color: rgba(255, 255, 255, 0.9); }

.nav-item {
    color: var(--text-secondary); text-decoration: none; font-size: 0.7rem;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    width: 60px; transition: color 0.2s;
}
.nav-item i { font-size: 1.4rem; }
.nav-item.active { color: var(--text-primary); }



/* --- Auth Screen Styling site input style--- */
.auth-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
}

.auth-card {
    background-color: var(--surface-color);
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
}

.hidden { display: none; }

.auth-header { margin-bottom: 30px; }
.auth-logo { font-size: 3rem; color: var(--primary-color); margin-bottom: 10px; }
.auth-header h2 { font-size: 1.5rem; margin-bottom: 5px; }
.auth-header p { color: var(--text-secondary); font-size: 0.9rem; }

/* Input Styling */
.input-group {
    position: relative;
    margin-bottom: 15px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    padding: 14px 15px 14px 45px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--primary-color);
}

/* Options & Buttons */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 25px;
    color: var(--text-secondary);
}

.forgot-link { color: var(--primary-color); text-decoration: none; font-weight: 600; }

.auth-btn {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-btn:hover { background-color: var(--primary-hover); }

.auth-footer { margin-top: 25px; font-size: 0.9rem; color: var(--text-secondary); }
.link-text { color: var(--primary-color); font-weight: 700; cursor: pointer; margin-left: 5px; }

/* --- Auth Screen Styling site input style end--- */


/* --- Profile Page Styling --- */
.profile-container {
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header & Avatar */
.no-underline{
    text-decoration: none;
}

.display-off{
    display: none;
}
.profile-header {
    text-align: center;
    margin-bottom: 30px;
}

.avatar-container {
    position: relative;
    display: inline-block;
    margin-bottom: 15px;
}
.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}
.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    padding: 3px;
    object-fit: cover;
}

.edit-avatar-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface-color);
}

.user-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 2px; }
.user-email { color: var(--text-secondary); font-size: 0.9rem; }

/* Balance Card */
.balance-card {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), #4b0096);
    border-radius: 20px;
    padding: 25px;
    color: white;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 10px 20px rgba(127, 0, 255, 0.3);
}

.card-content { position: relative; z-index: 2; }
.card-label { font-size: 0.85rem; opacity: 0.8; }
.balance-amount { font-size: 2rem; font-weight: 800; margin: 5px 0 15px 0; }

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.card-circle {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    z-index: 1;
}

/* Profile Menu */
.menu-group {
    background-color: var(--surface-color);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: left;
    transition: background 0.2s;
}

.menu-item:last-child { border-bottom: none; }
.menu-item:active { background-color: var(--bg-color); }

.menu-icon {
    width: 35px;
    height: 35px;
    background-color: var(--bg-color);
    color: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1rem;
}

.menu-item span { flex: 1; font-weight: 500; }
.arrow { font-size: 0.8rem; color: var(--text-secondary); }

.logout-btn { color: #ff4b4b; }
.logout-btn .menu-icon { background-color: rgba(255, 75, 75, 0.1); color: #ff4b4b; }
/* --- profile page style end --- */


/* --- Category Page Styling --- */
.category-container {
    padding: 15px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    margin: 20px 0 12px;
}

.section-header h3 { font-size: 1.1rem; font-weight: 700; }
.view-all { font-size: 0.8rem; color: var(--primary-color); text-decoration: none; font-weight: 600; }

/* Genre Chips */
.genre-filter-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 15px;
    scrollbar-width: none;
}
.genre-filter-row::-webkit-scrollbar { display: none; }

.genre-chip {
    white-space: nowrap;
    padding: 8px 18px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
}
.genre-chip.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Featured Cards (Horizontal) */
.horizontal-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 0 15px;
    scrollbar-width: none;
}
.horizontal-scroll::-webkit-scrollbar { display: none; }

.featured-card {
    min-width: 220px;
    height: 300px;
    position: relative;
    border-radius: 15px;
    overflow: hidden;
}
.featured-card img { width: 100%; height: 100%; object-fit: cover; }

.featured-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 40px 15px 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 20%, transparent);
    color: white;
}
.featured-overlay h4 { font-size: 1rem; margin-bottom: 8px; }

.badge {
    background: #ff4b4b;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 800;
}

/* Main Grid (Vertical) */
.story-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 0 15px 30px;
}

.story-item {
    display: flex;
    flex-direction: column;
}

.thumbnail-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 3/4;
}
.thumbnail-wrapper img { width: 100%; height: 100%; object-fit: cover; }

.rating-tag {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(0,0,0,0.7);
    color: #ffcc00;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

.story-info { padding-top: 10px; }
.story-genre { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; }
.story-title { font-size: 0.95rem; margin: 2px 0 10px; line-height: 1.2; height: 2.4em; overflow: hidden; }

/* Professional Subscribe Buttons */
.subscribe-btn-sm {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
}

.subscribe-full-btn {
    width: 100%;
    background-color: var(--bg-color);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.2s;
}
.subscribe-full-btn:hover {
    background-color: var(--primary-color);
    color: white;
}
/* --- Category Page Styling end --- */

/* --- Library Page Layout --- */
.library-container {
    padding: 25px 20px;
    animation: fadeIn 0.4s ease;
}

.page-header { margin-bottom: 25px; }
.section-title { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); }
.section-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

/* Subscription List */
.subscription-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lib-card {
    background-color: var(--surface-color);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    gap: 15px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, background-color 0.3s;
}

/* Thumbnail Styling */
.lib-thumb {
    position: relative;
    flex-shrink: 0;
}
.lib-thumb img {
    width: 95px;
    height: 135px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.progress-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 10px;
    border: 3px solid var(--surface-color);
}

.completed-tag {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #2ecc71;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border: 3px solid var(--surface-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Content Details */
.lib-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.lib-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}
.lib-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

/* Progress Tracking */
.lib-progress-wrapper { margin: 12px 0; }
.lib-progress-bar {
    height: 8px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}
.lib-progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #a044ff);
}
.ch-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Action Button */
.continue-btn {
    display: block;
    text-align: center;
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.2s;
}

.continue-btn.secondary {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.continue-btn:active { opacity: 0.8; transform: scale(0.98); }

/* --- Story Library Styling --- */


/* --- Transaction History Layout --- */
.history-container {
    padding: 25px 20px;
    animation: fadeIn 0.4s ease;
}

/* Filter Chips */
.history-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    overflow-x: auto;
    padding-bottom: 5px;
}
.filter-chip {
    padding: 8px 18px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}
.filter-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Date Dividers */
.date-divider {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin: 25px 0 15px 5px;
}

/* Transaction Items */
.transaction-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tx-item {
    background: var(--surface-color);
    padding: 15px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-color);
}

.tx-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Transaction Icon Colors */
.tx-icon.sub { background: rgba(127, 0, 255, 0.1); color: var(--primary-color); }
.tx-icon.deposit { background: rgba(46, 204, 113, 0.1); color: #2ecc71; }
.tx-icon.failed { background: rgba(231, 76, 60, 0.1); color: #e74c3c; }

.tx-details { flex: 1; }
.tx-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.tx-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Amount Styling */
.tx-amount {
    font-weight: 800;
    font-size: 0.95rem;
}
.tx-amount.negative { color: var(--text-primary); } /* Or #e74c3c if you want red */
.tx-amount.positive { color: #2ecc71; }
.tx-amount.neutral { color: var(--text-secondary); opacity: 0.5; }

.load-more-container {
    margin-top: 30px;
    padding-bottom: 50px;
    text-align: center;
}

.load-more-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.load-more-btn:active {
    transform: scale(0.95);
    background: var(--border-color);
}

/* Minimal Spinner */
.loader-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* --- Transaction History Layout  end --- */

/* --- Notifications Layout --- */
.notifications-container {
    padding: 25px 20px;
    animation: fadeIn 0.4s ease;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mark-read-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

/* Notification List */
.notif-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.notif-item {
    background: var(--surface-color);
    padding: 15px;
    border-radius: 18px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: background 0.3s;
}

/* Unread State Styling */
.notif-item.unread {
    background: rgba(127, 0, 255, 0.03); /* Subtle purple tint */
    border-color: rgba(127, 0, 255, 0.2);
}

.unread-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    top: 15px;
    right: 15px;
}

/* Icon Styles */
.notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.notif-icon.story { background: rgba(127, 0, 255, 0.1); color: var(--primary-color); }
.notif-icon.wallet { background: rgba(46, 204, 113, 0.1); color: #2ecc71; }
.notif-icon.system { background: rgba(52, 152, 219, 0.1); color: #3498db; }
.notif-icon.promo { background: rgba(241, 196, 15, 0.1); color: #f1c40f; }

/* Content Styling */
.notif-content { flex: 1; }

.notif-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notif-text strong { font-weight: 700; }

.notif-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
/* --- Notifications Layout end  --- */

/* --- Search & Discovery Hub --- */
.search-results-container {
    padding: 20px;
    animation: slideUp 0.3s ease-out;
}

.search-meta-section { margin-bottom: 30px; }

.meta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tiny-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    font-weight: 800;
}

.clear-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 700;
}

/* Tag Cloud (Recent Searches) */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-chip {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Trending List Styling */
.trending-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trend-card {
    background: var(--surface-color);
    padding: 15px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: 0.2s;
}

.trend-rank {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--primary-color);
    opacity: 0.8;
}

.trend-info { flex: 1; }
.trend-title { display: block; color: var(--text-primary); font-weight: 700; font-size: 0.95rem; }
.trend-meta { font-size: 0.75rem; color: var(--text-secondary); }

.hot-icon { color: #ff4b4b; font-size: 0.9rem; }

/* --- Vertical Results View --- */
.results-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.search-result-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item img {
    width: 80px;
    height: 110px;
    border-radius: 10px;
    object-fit: cover;
}

.result-details { flex: 1; }
.result-title { color: var(--text-primary); font-size: 1rem; margin-bottom: 4px; }
.result-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.result-tags { display: flex; gap: 6px; }
.result-tags .tag {
    font-size: 0.65rem;
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 5px;
    color: var(--text-secondary);
}

/* --- Search & Discovery Hub end--- */

/* --- Story Reader Styling --- */

/* --- Reader Layout --- */
 /* --- Reader Container --- */
.reader-container {
    background: var(--bg-color); /* Linked to theme */
    min-height: 100vh;
    color: var(--text-primary); /* Linked to theme */
    transition: background 0.3s, color 0.3s;
}

.reader-header {
    position: fixed;
    top: 0;
    width: 100%;
    max-width: var(--app-max-width);
    height: 65px;
    background: var(--surface-color); /* Theme-aware surface */
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 15px;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.reader-meta { flex: 1; margin-left: 15px; }
.story-name { font-size: 0.9rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.chapter-label { font-size: 0.75rem; color: var(--primary-color); opacity: 0.9; }

.header-btn {
    background: none; border: none; 
    color: var(--text-primary); /* Fixes icon visibility */
    width: 40px; height: 40px; font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
}

/* Comic Panels */
.comic-viewport { padding-top: 65px; background: var(--bg-color); }
.panel img { width: 100%; display: block; height: auto; }

/* Bottom Nav */
.reader-footer-nav {
    padding: 60px 20px 120px;
    text-align: center;
    background: var(--bg-color);
}

.nav-controls {
    display: flex; gap: 15px; margin-top: 20px;
}

.btn-nav {
    flex: 1; padding: 16px; border-radius: 14px;
    text-decoration: none; font-weight: 700; font-size: 0.9rem;
    transition: 0.2s;
}
.btn-nav.next { background: var(--primary-color); color: #fff; } /* Primary buttons usually stay brand-colored */
.btn-nav.prev { 
    background: var(--surface-color); 
    color: var(--text-primary); 
    border: 1px solid var(--border-color); 
}

/* --- Side Drawer --- */
.side-menu {
    position: fixed;
    top: 0; right: -300px;
    width: 300px; height: 100%;
    background: var(--surface-color);
    z-index: 1000;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
}

.side-menu.active { right: 0; }

.drawer-header {
    padding: 20px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}

.drawer-body { flex: 1; overflow-y: auto; padding: 15px; }

.ch-link {
    display: flex; align-items: center; gap: 15px;
    padding: 15px; border-radius: 12px;
    text-decoration: none; color: var(--text-primary);
    margin-bottom: 8px; background: var(--bg-color);
}

.ch-link.active { border: 1px solid var(--primary-color); background: rgba(127, 0, 255, 0.05); }
.ch-index { font-weight: 900; opacity: 0.3; font-size: 1.1rem; }
.ch-title { font-weight: 600; font-size: 0.9rem; flex: 1; }
.ch-link small { color: var(--primary-color); font-weight: 800; font-size: 0.65rem; }

.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 999;
}

/* --- Reader Interaction Bar --- */
.reader-action-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--app-max-width);
    height: 70px;
    background: var(--surface-color); /* Responsive BG */
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 90;
}

.action-btn {
    background: none; border: none; 
    color: var(--text-primary); /* Fixes icon visibility */
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 0.7rem; opacity: 0.8;
}
.action-btn i { font-size: 1.2rem; }
.action-btn.liked { color: #ff4b4b; opacity: 1; }
.action-btn.liked i { animation: heartBeat 0.3s ease; }

/* --- Comment Section Styling --- */
.reader-comments {
    padding: 30px 20px 120px; 
    background: var(--bg-color); /* Responsive BG */
    border-top: 1px solid var(--border-color);
}

.comment-header h3 { font-size: 1.1rem; margin-bottom: 20px; color: var(--text-primary); }

.comment-input-area {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface-color);
    padding: 10px 15px; border-radius: 30px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.user-avatar { width: 35px; height: 35px; border-radius: 50%; object-fit: cover; }

.comment-input-area input {
    background: none; border: none; flex: 1;
    color: var(--text-primary); outline: none; font-size: 0.9rem;
}

.send-comment-btn { background: none; border: none; color: var(--primary-color); font-size: 1.1rem; }

/* Comment Feed Fixes */
.comment-item { display: flex; gap: 12px; margin-bottom: 20px; }
.comment-body { flex: 1; }
.username { 
    display: block; 
    font-weight: 700; 
    font-size: 0.85rem; 
    margin-bottom: 2px; 
    color: var(--text-primary); /* Prevents "White on White" */
}
.text { 
    font-size: 0.9rem; 
    color: var(--text-secondary); /* Balanced gray/dark-gray */
    line-height: 1.4; 
}
.time { 
    font-size: 0.7rem; 
    color: var(--text-secondary); 
    opacity: 0.6; 
    display: block; 
    margin-top: 5px; 
}

/* Adjust nav for Footer Bar */
.chapter-nav-wrapper { 
    padding: 40px 20px; 
    background: var(--bg-color); 
    border-top: 1px solid var(--border-color);
}


/* --- Story Reader Styling end--- */

/* --- Desktop & Tablet Enhancements --- */
@media (min-width: 850px) {
    /* Dock the sidebar permanently to the left of the mobile view */
    #sidebar {
        transform: translateX(0) !important; /* Keep it always open */
        /* Position it right next to the 480px app wrapper */
        left: calc(50vw - (var(--app-max-width) / 2) - 280px) !important; 
        border-radius: 20px 0 0 20px; /* Optional: Gives it a smooth app-like corner */
    }

    /* Hide the mobile toggle buttons and overlay */
    #header-menu-btn, 
    #sidebar-close-btn {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}