/* Import modern fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;700&family=Lato:wght@400;700&display=swap');

/* Define a modern color palette using CSS variables */
:root {
    --primary-font: 'Montserrat', sans-serif;
    --secondary-font: 'Lato', sans-serif;
    --background-color: #f4f7f9;
    --card-background: #ffffff;
    --text-color: #2c3e50;
    --heading-color: #34495e;
    --accent-color: #3498db;
    --tag-bg-admin: #e9ecef;
    --tag-text-admin: #495057;
    --tag-bg-product: #e7f5fb;
    --tag-text-product: #3498db;
    --light-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* General Body Styling */
body {
    font-family: var(--secondary-font);
    line-height: 1.7;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Main Container */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header & Typography */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 2rem;
}

.page-header h1 {
    font-family: var(--primary-font);
    font-weight: 700;
    font-size: 2.8rem;
    color: var(--heading-color);
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    color: #7f8c8d;
    max-width: 600px;
    margin: 0 auto;
}

/* Section Styling */
.section {
    margin-bottom: 3.5rem;
}

.section h2 {
    font-family: var(--primary-font);
    font-size: 1.8rem;
    color: var(--heading-color);
    margin-bottom: 1.5rem;
}

/* Search Bar Styling */
.search-container {
    position: relative;
}

#url-search {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-family: var(--secondary-font);
    border: 1px solid #ced4da;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#url-search:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.suggestions-container {
    background: var(--card-background);
    border: 1px solid #ced4da;
    border-radius: 8px;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: var(--light-shadow);
}

.suggestion-item {
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    border-bottom: 1px solid #ecf0f1;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

.suggestion-item a {
    text-decoration: none;
    color: var(--text-color);
    display: block;
}

/* Book List - Card Layout */
.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.book-item-link {
    text-decoration: none;
    color: inherit;
    display: block;
    /* Make the link a block to contain the card */
}

.book-item {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--light-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
    /* Make cards in the same row equal height */
    box-sizing: border-box;
    /* Include padding in height/width calculation */
}

.book-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--hover-shadow);
}

.book-item h3 {
    font-family: var(--primary-font);
    font-weight: 500;
    font-size: 1.4rem;
    color: var(--accent-color);
    margin: 0 0 0.5rem 0;
}

.book-item .topic-type {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-item .tags {
    margin-top: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.tag.audience {
    background-color: var(--tag-bg-admin);
    color: var(--tag-text-admin);
}

.tag.product {
    background-color: var(--tag-bg-product);
    color: var(--tag-text-product);
}

/* Book Detail Page */
.book-container {
    background-color: var(--card-background);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--light-shadow);
}

.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    text-decoration: none;
    color: var(--accent-color);
    font-weight: bold;
}

.book-header {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.book-header h1 {
    font-size: 2.5rem;
}

.book-meta {
    margin-top: 1rem;
}

.book-meta p {
    color: #7f8c8d;
}

.book-meta p strong {
    color: var(--heading-color);
}

.book-content h1,
.book-content h2,
.book-content h3 {
    color: var(--heading-color);
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

.book-content code {
    background: #ecf0f1;
    padding: 0.2em 0.2em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.book-content pre {
    background: #ecf0f1;
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
}

.book-content table th,
.book-content table td {
    /* Aligns the content to the top of the cell instead of the default 'middle' */
    vertical-align: top;

    /* Let's add a bit more padding for better spacing */
    padding: 5px 5px;

    font-size: 0.8rem;
}

/* Optional: Add a border to the headers for better visual separation */
.book-content table th {
    border-bottom: 2px solid #dee2e6;
}

