/* Root Variables */
:root {
    /* Light Theme */
    --bg-color: #f4f6f8;
    --text-color: #333;
    --header-bg: #2c3e50;
    --header-text: white;
    --card-bg: white;
    --border-color: #e0e0e0;
    --border-color-focus: #3498db;
    --secondary-text-color: #7f8c8d;
    --meta-bg: #f0f0f0;
    --notes-bg: #fff9e6;
    --notes-text: #666;
    --summary-text: #444;
    --keyword-bg-color: #e8f4f8;
    --keyword-text-color: #2980b9;
    --score-text: #aaa;
    --book-title-color: #2c3e50;
    --book-author-color: #555;

    /* Section Colors */
    --section-bg-color: #bdc3c7;
    --section-theosophy: #f1c40f;
    --section-religion: #9b59b6;
    --section-science: #3498db;
    --section-health: #2ecc71;
    --section-occultism: #e74c3c;
    --section-yoga: #e67e22;
    --section-mysticism: #8e44ad;
    --section-psychology: #34495e;
}

body[data-theme="dark"],
@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Theme Overrides */
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --header-bg: #1f2937;
        --header-text: #f9fafb;
        --card-bg: #2d2d2d;
        --border-color: #444;
        --border-color-focus: #5fa8db;
        --secondary-text-color: #9ca3af;
        --meta-bg: #374151;
        --notes-bg: #4a3c20;
        --notes-text: #e0e0e0;
        --summary-text: #d1d5db;
        --keyword-bg-color: #1e3a8a;
        --keyword-text-color: #93c5fd;
        --score-text: #777;
        --book-title-color: #f9fafb;
        --book-author-color: #d1d5db;
    }
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header */
header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

@media screen and (min-width: 900px){
    header {
        flex-direction: row;
    }
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-content p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Main Layout */
main {
    max-width: 1800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Search Bar */
.search-container {
    background: var(--card-bg);
    padding: 0.2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    max-width: 600px;
    width: 100%;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.search-container > .input_wrapper{
    max-width: 600px;
    width: 100%;
}

@media screen and (min-width: 1380px){
    .search-container {
        flex-direction: row;
        max-width: 900px;
    }
}

#search-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    transition: border-color 0.3s;
}

#search-input:focus {
    outline: none;
    border-color: var(--border-color-focus);
}

#search-options {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    max-width: 800px;
    width: 100%;
    gap: 15px;
    justify-content: center;
    padding: 5px;
    color: var(--book-author-color);
}

#search-options label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

#search-stats {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    text-align: right;
}

/* Book List */
.book-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.book-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-left: 8px solid var(--section-bg-color); /* Default gray border */
    transition: transform 0.2s;
}

/*.book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}*/

/* Semantic Coloring based on Section */
/* .book-card.section-theosophy { border-left-color: var(--section-theosophy); } /* Yellow */
/* .book-card.section-religion { border-left-color: var(--section-religion); } /* Purple */
/* .book-card.section-science { border-left-color: var(--section-science); } /* Blue */
/* .book-card.section-health { border-left-color: var(--section-health); } /* Green */
/* .book-card.section-occultism { border-left-color: var(--section-occultism); } /* Red */
/* .book-card.section-yoga { border-left-color: var(--section-yoga); } /* Orange */
/* .book-card.section-mysticism { border-left-color: var(--section-mysticism); } /* Darker Purple */
/* .book-card.section-psychology { border-left-color: var(--section-psychology); } /* Dark Blue/Grey */

.book-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--book-title-color);
    margin-bottom: 0.25rem;
}

.book-author {
    font-size: 1rem;
    color: var(--book-author-color);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    margin-bottom: 0.75rem;
}

.meta-item {
    background: var(--meta-bg);
    padding: 2px 8px;
    border-radius: 4px;
}

.book-notes {
    font-size: 0.9rem;
    color: var(--notes-text);
    background-color: var(--notes-bg);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.book-summary {
    font-size: 0.9rem;
    color: var(--summary-text);
    margin-top: 0.75rem;
    border-top: 1px solid var(--meta-bg);
    padding-top: 0.75rem;
}

/* Keywords Chips */
.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.keyword-section{
    --keyword-border-color: #45238a;
    --keyword-bg-color: #f3e5f5;
    --keyword-text-color: #45238a;
}

.keyword-chip {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    border-color: var(--keyword-border-color);
    background-color: var(--keyword-bg-color);
    color: var(--keyword-text-color);
    font-weight: 500;
    cursor: pointer;
}

.match-score {
    float: right;
    font-size: 0.7rem;
    color: var(--score-text);
}