/* Root variables - Dark Mode Theme */
:root {
    --primary-color: #696969;
    --secondary-color: #A9A9A9;
    --background-color: #1a1a1a;
    --surface-color: #2a2a2a;
    --text-color: #e0e0e0;
    --text-dim: #a0a0a0;
    --accent-color: #FFD700;
    --border-color: #404040;
    --white: #FFFFFF;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Demon Mode - Purple Black Theme */
body.demon-mode {
    --background-color: #12091a;
    --surface-color: #1e0f2e;
    --text-color: #e8d5ff;
    --text-dim: #a188c0;
    --accent-color: #b794f6;
    --border-color: #3d2254;
}

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

body {
    font-family: var(--font-family);
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
}

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

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background-color: rgba(26, 26, 26, 0.95);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
    margin: 0;
}

.logo .tagline {
    font-size: 14px;
    color: var(--text-dim);
    margin-left: 15px;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    color: var(--text-color);
}

.theme-toggle:hover {
    background: var(--primary-color);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.theme-icon {
    font-size: 18px;
    line-height: 1;
}

.theme-text {
    font-size: 14px;
    font-weight: 600;
}

/* Main Content */
main {
    padding-top: 120px;
    padding-bottom: 60px;
}

.intro {
    text-align: center;
    margin-bottom: 60px;
}

.intro h2 {
    font-size: 36px;
    margin-bottom: 20px;
    color: var(--white);
}

.intro p {
    font-size: 18px;
    color: var(--text-dim);
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.book-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    position: relative;
    transition: all 0.3s ease;
}

.book-card.free:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.1);
    border-color: var(--accent-color);
}

.book-card.paywalled {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(255, 105, 180, 0.1) 100%);
    border-color: rgba(220, 53, 69, 0.3);
}

.book-card.paywalled:hover {
    border-color: rgba(220, 53, 69, 0.5);
}

.book-card.whale {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 193, 7, 0.1) 100%);
    border: 2px solid rgba(255, 215, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.book-card.whale::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 215, 0, 0.1) 50%,
        transparent 70%
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.book-card.whale:hover {
    border-color: rgba(255, 215, 0, 0.7);
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3);
}

.book-card.preview {
    position: relative;
}

.book-card.preview:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(169, 169, 169, 0.1);
    border-color: var(--secondary-color);
}

.status-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.free {
    background: var(--accent-color);
    color: #1a1a1a;
}

.status-badge.paywalled {
    background: linear-gradient(135deg, #dc3545 0%, #ff69b4 100%);
    color: #ffffff;
}

.status-badge.whale {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.status-badge.preview {
    background: var(--secondary-color);
    color: #1a1a1a;
}

.preview-indicator {
    position: absolute;
    top: 50px;
    right: 15px;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-color);
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-card h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--white);
}

.book-card .description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dim);
    margin-bottom: 25px;
}

.book-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Buttons - The Cool AF Ones */
.btn {
    position: relative;
    display: inline-block;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
}

.btn-primary {
    color: var(--white);
    background-color: var(--primary-color);
}

.btn-secondary {
    color: var(--white);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
}

.btn-small {
    padding: 10px 20px;
    font-size: 14px;
}

.btn-disabled {
    background-color: var(--border-color);
    color: var(--text-dim);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Animated gradient border effect */
.btn-primary::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        #FFFFFF 0%,
        #FFFFFF 20%,
        var(--accent-color) 40%,
        var(--accent-color) 60%,
        #FFFFFF 80%,
        #FFFFFF 100%
    );
    border-radius: 50px;
    z-index: -1;
    background-size: 300% 300%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background-color: var(--primary-color);
    border-radius: 48px;
    z-index: -1;
}

.btn:hover:not(.btn-disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.btn:active:not(.btn-disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.2);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
}

/* Modal Base */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.85) 100%
    );
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 2001;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content.reader {
    max-width: 800px;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 36px;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--white);
}

/* Reader Modal */
.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-right: 50px;
}

.reader-header h2 {
    font-size: 28px;
    color: var(--white);
    margin: 0;
}

.markdown-content {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-color);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    color: var(--white);
    margin-top: 30px;
    margin-bottom: 15px;
}

.markdown-content h1 { font-size: 32px; }
.markdown-content h2 { font-size: 26px; }
.markdown-content h3 { font-size: 20px; }

.markdown-content p {
    margin-bottom: 20px;
}

.markdown-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-dim);
}

.markdown-content em {
    font-style: italic;
    color: var(--accent-color);
}

.markdown-content strong {
    font-weight: 700;
    color: var(--white);
}

/* Download Modal */
.download-info {
    text-align: left;
}

.download-info h3 {
    font-size: 24px;
    color: var(--white);
    margin-bottom: 20px;
}

.file-info {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
    font-size: 16px;
}

.instructions {
    margin-bottom: 30px;
}

.instructions h4 {
    font-size: 18px;
    color: var(--white);
    margin-bottom: 15px;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
}

.instructions li:last-child {
    border-bottom: none;
}

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

.instructions a:hover {
    text-decoration: underline;
}

.tip {
    background: var(--background-color);
    border-left: 4px solid var(--accent-color);
    padding: 15px;
    margin-top: 20px;
    border-radius: 4px;
    font-size: 15px;
}

#confirm-download-btn {
    width: 100%;
    margin-top: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: 1fr;
    }

    .intro h2 {
        font-size: 28px;
    }

    .modal-content {
        width: 95%;
        padding: 25px;
        max-height: 90vh;
    }

    .reader-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .book-actions {
        flex-direction: column;
    }

    .book-actions .btn {
        width: 100%;
    }
}

/* FAQ Section */
.faq {
    margin-top: 80px;
    padding-top: 60px;
    border-top: 1px solid var(--border-color);
}

.faq h2 {
    text-align: center;
    font-size: 32px;
    color: var(--white);
    margin-bottom: 40px;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.faq-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.faq-item h3 {
    font-size: 18px;
    color: var(--accent-color);
    margin-bottom: 12px;
}

.faq-item p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
}

.faq-item a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.faq-item a:hover {
    text-decoration: underline;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}
