/* css/style.css */
:root {
    --bg-color: #1a1a2e;
    --sidebar-bg: #16213e;
    --card-bg: #0f3460;
    --accent-color: #e94560;
    --text-color: #eee;
    --text-muted: #aaa;
    --sidebar-width: 240px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-links {
    list-style: none;
    margin-top: 20px;
}

.nav-links li a {
    display: block;
    padding: 15px 20px;
    transition: background 0.2s, border-left 0.2s;
    border-left: 4px solid transparent;
}

.nav-links li a:hover,
.nav-links li a.active {
    background-color: rgba(233, 69, 96, 0.1);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
}

/* Content Area */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
}

.search-bar input {
    background-color: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 8px 15px;
    border-radius: 20px;
    outline: none;
    width: 250px;
}

#main-content {
    padding: 20px;
    flex: 1;
}

/* Library Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.book-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: fadeIn 0.4s ease-out;
    display: flex;
    height: 180px;
}

.book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.book-cover {
    width: 120px;
    min-width: 120px;
    height: 100%;
    object-fit: cover;
    background-color: #222;
}

.book-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    overflow: hidden;
}

.book-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-title a:hover {
    color: var(--accent-color) !important;
}

.book-chapter-info {
    font-size: 13px;
    color: var(--accent-color);
    margin-bottom: 8px;
}

.book-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-stats {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
}

.btn {
    display: inline-block;
    text-align: center;
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: opacity 0.2s;
}

button.btn:hover {
    opacity: 0.9;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.form-control {
    width: 100%;
    background-color: var(--sidebar-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 10px 15px;
    border-radius: 6px;
    outline: none;
    font-size: 15px;
}

.form-control:focus {
    border-color: var(--accent-color);
}

textarea.form-control {
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

/* Reader Styles */
.reader-container {
    max-width: 65%;
    margin: 0 auto;
    font-size: 18px;
    /* Base size, can be overridden by JS later */
    line-height: var(--reader-line-height, 1.8);
    color: var(--reader-text-color, var(--text-color));
    background: var(--reader-bg, transparent);
    padding: 20px;
    border-radius: 8px;
}

.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0;
}

.reader-content p {
    margin-bottom: 20px;
    text-indent: 1.5em;
    /* Traditional book indentation */
}

/* System Interface Box */
.system-interface {
    background-color: rgba(15, 34, 60, 0.85);
    /* Deep technical blue */
    border: 1px solid #00f0ff;
    /* Holographic cyan edge */
    border-radius: 4px;
    padding: 20px 25px;
    margin: 30px 0;
    font-family: 'Consolas', 'Courier New', 'Roboto Mono', monospace;
    font-size: 16px;
    color: #4dd0e1;
    box-shadow: inset 0 0 20px rgba(0, 240, 255, 0.1), 0 0 15px rgba(0, 240, 255, 0.2);
    position: relative;
    overflow: hidden;
    line-height: 1.5;
}

/* Optional holographic scanline overlay effect */
.system-interface::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent 50%,
            rgba(0, 240, 255, 0.05) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1;
}

.system-interface p {
    margin: 8px 0 !important;
    text-indent: 0 !important;
    position: relative;
    z-index: 2;
    /* To sit above scanlines */
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
    }

    #mobile-menu-btn {
        display: block;
    }

    .reader-container {
        max-width: 100%;
    }

    #main-content {
        padding: 10px;
    }
}

/* Reading mode adjustments */
body.reading-mode .sidebar {
    display: none !important;
}

body.reading-mode .top-nav {
    display: none !important;
}

body.reading-mode .content {
    margin-left: 0 !important;
}