:root {
    --accent-blue: #2f58a8;
    --accent-blue-hover: #214287;
}

body {
    background-color: #050505;
    color: #EAEAEA;
    font-family: 'Roboto', sans-serif;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.main-header {
    background-color: #121212;
    padding: 10px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1c1c1c;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #EAEAEA;
    text-decoration: none;
    flex-shrink: 0;
}

.main-nav {
    display: flex;
    gap: 25px;
    align-items: center;
}

.main-nav a {
    color: #EAEAEA;
    text-decoration: none;
    transition: color 0.2s;
}
.main-nav a.active-nav {
    color: #FF424D;
}
.main-nav a:hover { color: #FF424D; }
.admin-link { color: #FFD700 !important; }

.main-header a[href="/auth/login"],
.main-header a[href="/auth/register"] {
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 4px 14px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    margin-left: 8px;
    transition: all 0.2s;
}
.main-header a[href="/auth/login"]:hover,
.main-header a[href="/auth/register"]:hover {
    background: var(--accent-blue);
    color: #050505 !important;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
}

.burger-menu-btn {
    background: none;
    border: none;
    color: #EAEAEA;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s;
}
.burger-menu-btn:hover { color: #FF424D; }

.burger-menu {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: #121212;
    border: 1px solid #1c1c1c;
    border-radius: 8px;
    min-width: 150px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 1000;
}
.burger-menu.active { display: block; }
.burger-menu a {
    display: block;
    padding: 12px 20px;
    color: #EAEAEA;
    text-decoration: none;
    transition: background 0.2s;
}
.burger-menu a:hover { background: #1c1c1c; }
.burger-menu a:last-child { color: #FF424D; }

.logout-button {
    background: none;
    border: 1px solid var(--accent-blue);
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.2s;
}
.logout-button:hover {
    background: var(--accent-blue);
    color: #fff;
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        padding: 15px 20px;
    }
    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    .logo { order: 1; }
    .user-profile { order: 2; }
}

.content-section {
    background-color: #121212;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}
h2 {
    border-bottom: 1px solid #1f1f1f;
    padding-bottom: 10px;
    margin-top: 0;
    font-weight: normal;
}

.carousel { 
    display: flex; 
    overflow-x: auto; 
    padding-bottom: 15px; 
    gap: 20px; 
    scrollbar-width: none; 
    -ms-overflow-style: none; 
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    cursor: grab;
    user-select: none;
    touch-action: pan-y;
}
.carousel::-webkit-scrollbar { display: none; }
.card { min-width: 140px; width: 140px; flex: 0 0 auto; text-decoration: none; color: #EAEAEA; }
.card img { width: 140px; height: 200px; object-fit: cover; border-radius: 8px; display: block; user-select: none; pointer-events: none; }
.card h3 { font-size: 0.95rem; margin: 8px 0 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 600px) {
	body { font-size: 15px; }
	.container { margin: 10px auto; padding: 0 12px; }
	.main-header { padding: 12px 14px; gap: 12px; }
	.main-nav { gap: 14px; flex-wrap: wrap; }
	.profile-avatar { width: 34px; height: 34px; }
	.logout-button { padding: 6px 10px; }
	.content-section { padding: 16px; border-radius: 10px; }
	.carousel { gap: 14px; scroll-snap-type: x proximity; }
	.card { min-width: 120px; width: 120px; scroll-snap-align: start; }
	.card img { width: 120px; height: 172px; user-select: none; pointer-events: none; }
	h2 { font-size: 1.1rem; }
}

@media (max-width: 400px) {
	.main-nav a { font-size: 0.95rem; }
	.logo { font-size: 1.25rem; }
}
.card { background-color: #1c1c1c; border-radius: 8px; overflow: hidden; text-align: center; flex: 0 0 150px; text-decoration: none; color: inherit; display: block; }
.card:hover { color: inherit; }
.card img { display: block; width: 100%; height: 210px; object-fit: cover; user-select: none; pointer-events: none; }
.card h3 { font-size: 0.9rem; padding: 10px; margin: 0; font-weight: normal; }

.topic-list, .update-list { list-style: none; padding: 0; }
.topic-list li, .update-list li { display: flex; justify-content: space-between; padding: 12px 5px; border-bottom: 1px solid #1c1c1c; }
.topic-list li:last-child, .update-list li:last-child { border-bottom: none; }
.topic-list a { color: #EAEAEA; text-decoration: none; }
.topic-list a:hover { color: #FF424D; }
.topic-list span { color: #888; }
.update-list li { align-items: center; }
.update-cover-art { width: 50px; height: 70px; object-fit: cover; border-radius: 4px; margin-right: 15px; flex-shrink: 0; }
.update-info { flex-grow: 1; display: flex; flex-direction: column; }
.update-info a { color: #EAEAEA; text-decoration: none; font-size: 1.1rem; }
.update-info a:hover { color: #FF424D; }
.update-info span { color: #aaa; font-size: 0.9rem; margin-top: 4px; }
.update-list time { color: #888; margin-left: 20px; }
.hidden-by-default { display: none !important; }

.view-more-container { text-align: center; margin-top: 20px; }
.view-more-btn { display: inline-block; padding: 10px 25px; background-color: var(--accent-blue); border: 1px solid var(--accent-blue); color: #fff; text-decoration: none; border-radius: 20px; transition: all 0.2s ease; cursor: pointer; }
.view-more-btn:hover { background-color: var(--accent-blue-hover); border-color: var(--accent-blue-hover); color: #fff; }
.update-list.scrollable { max-height: 400px; overflow-y: auto; padding-right: 10px; }
.update-list.scrollable::-webkit-scrollbar { width: 8px; }
.update-list.scrollable::-webkit-scrollbar-track { background: #1c1c1c; border-radius: 4px; }
.update-list.scrollable::-webkit-scrollbar-thumb { background: #292929; border-radius: 4px; }
.update-list.scrollable::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

#bell-icon { font-size: 1.5rem; color: #ccc; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; }
#bell-icon:hover { color: white; }
#notification-dot { position: absolute; top: 0; right: -2px; width: 8px; height: 8px; background-color: #007bff; border-radius: 50%; display: none; }
#notification-panel { display: none; flex-direction: column; position: absolute; top: 50px; right: 0; width: 350px; background-color: #1c1c1c; border: 1px solid #292929; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); z-index: 100; }
.notification-header, .notification-footer { padding: 10px 15px; background-color: #232323; }
.notification-header { border-bottom: 1px solid #292929; font-weight: bold; }
.notification-footer { border-top: 1px solid #292929; text-align: center; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#notification-panel .view-all-link { color: #FF9E45; text-decoration: none; font-size: 0.9rem; }
#clear-notifications-btn { background: none; border: none; color: #FF424D; cursor: pointer; font-size: 0.9rem; }
#notification-panel ul { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
#notification-panel li a { display: block; padding: 12px 15px; color: #EAEAEA; text-decoration: none; border-bottom: 1px solid #292929; }
#notification-panel li:last-child a { border-bottom: none; }
#notification-panel li a:hover { background-color: #292929; }
.no-notifications { padding: 20px; text-align: center; color: #888; }

/* Heart Icons */
.heart-icon-svg {
    vertical-align: middle;
    transition: fill 0.2s, stroke 0.2s;
    fill: currentColor;
    stroke: currentColor;
}
/* Ensure heart shapes are filled */
.heart-icon-svg path { fill: currentColor; }
.chapter-likes { color: #fff; }
/* Colored heart when user has liked the chapter */
.chapter-likes.liked {
    color: #FF424D;
}
.heart-icon,
.comment-heart-icon,
.reply-heart-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* --- Общее модальное окно (центральное) --- */
.app-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.app-modal {
    background-color: #161616;
    border-radius: 12px;
    padding: 20px 24px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
    border: 1px solid #2a2a2a;
}

.app-modal-title {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.app-modal-text {
    margin: 4px 0;
    font-size: 0.95rem;
    color: #cccccc;
    white-space: pre-wrap;
}

.app-modal-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.app-modal-button {
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.app-modal-button.primary {
    background-color: var(--accent-blue);
    color: #fff;
}

.app-modal-button.secondary {
    background-color: #2f2f2f;
    color: #eaeaea;
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--accent-blue);
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}
.btn:hover {
    background: var(--accent-blue-hover);
}

.login-callout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 6px;
    background: rgba(47, 88, 168, 0.15);
    border: 1px solid rgba(47, 88, 168, 0.4);
    color: #e5ecff;
    font-size: 0.95rem;
    margin-top: 15px;
}
.login-callout a {
    color: var(--accent-blue);
    font-weight: 600;
    text-decoration: none;
}
.login-callout a:hover {
    color: var(--accent-blue-hover);
}

.app-modal-field {
    margin-top: 10px;
}

.app-modal-field-inline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-end;
}

.app-modal-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: #cccccc;
}

.app-modal-input {
    width: 100%;
    box-sizing: border-box;
    background-color: #1f1f1f;
    border: 1px solid #333;
    color: #eaeaea;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.9rem;
}