/* Dark theme for user pages */

:root {
    --bg-color: #121212;        /* Dark background */
    --text-color: #e0e0e0;      /* Light text */
    --nav-bg: #1e1e1e;
    --accent: #bb86fc;
    --brass-color: #b89830;
}

body {
    font-family: 'Lora', serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;

    /* The Magic Lines for Light-on-Dark Serif readability: */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Responsive Navigation */
.main-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: inherit;
}

.nav-links a.active {
    color: var(--brass-color, #b89830); /* Use your brass variable or a gold fallback */
    font-weight: bold;
    border-bottom: 1px solid var(--brass-color, #b89830);
    padding-bottom: 2px; /* Gives the underline a little breathing room */
}

.nav-links a:not(.active) {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.admin-menu, .user-menu {
    position: relative;
    display: inline-block;
}

/* Reset dropdown triggers to look like standard nav links */
.admin-btn, .user-btn {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit; /* Keeps it matching the "Catalogue" link weight */
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    appearance: none; /* Removes default mobile browser styling */
}

/* Optional: add the same hover effect as your other nav links */
.admin-btn:hover, .user-btn:hover {
    opacity: 0.7;
}

.admin-dropdown, .user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem; /* Adds a little breathing room under the button */
    background: #fff;
    border: 1px solid #ddd;
    padding: 1rem;
    min-width: 150px;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.admin-dropdown a, 
.user-dropdown a {
    display: block;          /* This stacks them vertically */
    margin-bottom: 0.5rem;   /* Spacing between links */
    color: #333;             /* Dark text because your dropdown background is #fff */
    text-decoration: none;   /* Removes default underline */
}

/*General Layout (The "Tidy" Rules) */
.profile-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 30px;
    border-radius: 8px; /* Defined once here */
}

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

.form-control {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    
    /* THE FIX: Force dark text on light background */
    background-color: #ffffff !important; 
    color: #212529 !important; 
}

/*Dark-Theme Overrides (Specific to the profile) */
.dark-profile-form {
    background-color: #1a1a1a;
    color: #f0f0f0;
    padding: 2rem;
    border: 1px solid #333; /* Dark border instead of light */
}

.dark-profile-form .form-control {
    background-color: #ffffff; /* Force the box to stay white */
    color: #1a1a1a;            /* Force the text to stay dark charcoal */
    border: 1px solid #ccc;    /* Keep the border subtle but visible */
}

/* Container for the label and the "(?)" icon */
.label-group {
    display: flex;
    align-items: center; /* Aligns label text and the button vertically */
    gap: 8px;            /* Adds that nice, reasonable whitespace you prefer */
}

/* Make sure the help button stays small and circular */
.help-btn {
    cursor: pointer;
    background: none;
    border: 1px solid #777;
    border-radius: 50%;
    color: #aaa;
    width: 20px;
    height: 20px;
    font-size: 12px;
    padding: 0;
    line-height: 1; /* Centers the '?' inside the button */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark Theme modal boxes */
.dark-theme-dialog {
    background: #1a1a1a;
    color: #f0f0f0;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 20px;
    
    /* Layout constraints  */
    width: 75%;
    max-width: 600px;
}

.dark-theme-dialog a {
    color: #4da6ff; /* A clean, readable blue for dark backgrounds */
    text-decoration: none; /* Removes the ugly default underline */
    border-bottom: 1px solid #4da6ff; /* Optional: adds a subtle line instead of a thick link */
    transition: color 0.2s ease;
}

.dark-theme-dialog a:hover {
    color: #80c1ff; /* Slightly lighter blue on hover for visual feedback */
    border-bottom-color: #80c1ff;
}

/* This styles the greyed-out background overlay */
.dark-theme-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

/*Secondary navigation for catalogue pages  */

.sub-nav {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    background-color: #151515; /* A shade darker or lighter than your primary nav */
    border-bottom: 1px solid #333;
}
.sub-nav a {
    color: #888; /* Muted color */
    text-decoration: none;
    font-size: 0.9rem; /* Slightly smaller than primary nav */
    transition: color 0.2s ease;
}

/* The style for the current view */
.sub-nav a.active-view {
    color: #fff;
    font-weight: bold; /* Embolden currently selected view */
    border-bottom: 1px solid #4da6ff; /* Underline currently selected view */
}

.sub-nav a small {
    font-size: 0.75rem;     /* Force a smaller size */
    margin-left: 3px;       /* Add a tiny bit of breathing room */
    font-weight: normal;    /* Ensure it doesn't inherit bold from the parent */
}

/* Book catalogue styling */
.gallery-grid {
    display: flex;
    flex-wrap: wrap;        /* Allows items to move to the next line */
    justify-content: center; /* This is the magic line for orphans */
    gap: 25px;
    padding: 20px;
}

.book-card {
    /* Adjust '220px' to match your preferred book width */
    flex: 0 1 180px; 
    display: flex;
    flex-direction: column;
}

/* Remove all default link styles globally for cards */
.book-card a {
    text-decoration: none;
    color: inherit;
}

/* Specific styling for the Author link */
.book-author a {
    color: #a0a0a0; /* Subtle grey to maintain hierarchy */
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.book-author a:hover {
    color: #4da6ff; /* Your accent blue */
    text-decoration: underline; /* Visual feedback on hover only */
}

.book-card:hover {
    transform: none;

    /* Use a light grey glow instead of a dark shadow */
    box-shadow: 0 0 15px rgba(97, 97, 97, 0.4);
    
    /* Lighten the border to make the card "pop" */
    border-color: #979797;
    
    /* Optional: slightly lighten the card background */
    background-color: #2a2a2a;
}

.book-thumb {
    width: 100%;
    aspect-ratio: 2 / 3; /* Standard book cover ratio */
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.book-title {
    font-size: 0.9rem;
    font-weight: bold;
    margin-top: 10px;
    color: #f0f0f0;
}

.book-author {
    font-size: 0.8rem;
    color: #888;
    margin: 0;
}

/* Book detail styling */
.detail-layout {
    display: flex;
    gap: 50px;
    padding: 40px;
    max-width: 1200px; /* Slightly wider to accommodate long descriptions */
    margin: 0 auto;
    align-items: flex-start;
}

.detail-cover {
    flex: 0 0 350px; /* Do not grow, do not shrink, stay 350px wide */
}

.detail-cover img {
    width: 100%; 
    height: auto;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.detail-info {
    flex: 1;
    min-width: 0; /* Prevents text from pushing the layout wider than the screen */
}

.detail-info h1 {
    margin-top: 0;
    font-size: 2.5rem;
}

.detail-info .author-link {
    color: #4da6ff;
    font-weight: normal;
}

/* Tighten the gap between metadata and description */
.separator {
    margin: 10px 0; /* Reduced from default (usually 20px-30px) */
    border: 0;
    border-top: 1px solid #eee; /* Light color for your "airy" theme */
}

.description-text {
    margin-top: 5px; /* Pulls the text closer to the line */
    /* keep your existing line-height: 1.6 */
}

.actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

.author-link a {
    color: #4da6ff; /* Your accent blue */
    text-decoration: none;
}

.author-link a:hover {
    text-decoration: underline;
}

.edit-book-link {
    color: #4da6ff; /* Your accent blue */
    text-decoration: none;
}

.edit-book-link:hover {
    text-decoration: underline;
}

/*Pagination controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 40px 0;
    margin-top: 20px;
    border-top: 1px solid #eee; /* Subtle separator from the grid */
}

.page-link {
    text-decoration: none;
    color: #4da6ff;
    font-weight: 500;
}

.page-link.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 0.9rem;
    color: #666;
}

/*Author details page styling */
.author-header {
    padding: 10px 0;
    text-align: center;
}

.author-header h1 {
    font-size: 2.5rem;
    color: #ffffff;
    margin-bottom: 10px;
}

.stats-text {
    color: #a0a0a0;
    font-style: italic;
    font-size: 1.1rem;
}

.separator {
    border: 0;
    border-top: 1px solid #333;
    margin-bottom: 40px;
}

.author-footer {
    margin-top: 30px; /* Generous whitespace */
    padding-bottom: 80px;
    text-align: center;
}

.back-link {
    display: inline-block;
    padding: 5px 30px;
    color: #a0a0a0;
    border: 1px solid #333;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.back-link:hover {
    color: #4da6ff; /* Your accent blue */
    border-color: #4da6ff;
    background-color: rgba(77, 166, 255, 0.05); /* Very faint blue tint */
}

.flash-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid;
}

/* The "Success" Green */
.flash-success {
    background-color: #e6fffa;
    border-color: #38b2ac;
    color: #234e52;
}

/* The "Error" Red */
.flash-error, .flash-danger {
    background-color: #fff5f5;
    border-color: #feb2b2;
    color: #9b2c2c;
}

/* Media Query for responsiveness */
@media (max-width: 600px) {
    .navbar { flex-direction: column; }
    .nav-links { margin-top: 1rem; }
}

/*Collections list  page styling */
/* Styling for the Collection cards in the public view */
.collection-plaque {
    background: rgba(255, 255, 255, 0.03); /* Very subtle lift from the background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    height: 240px; /* Roughly the height of a book cover thumbnail */
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    transition: background 0.3s ease;
}

.collection-plaque:hover {
    background: rgba(255, 255, 255, 0.08);
}

.collection-plaque h2 {
    font-family: serif;
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.collection-plaque .metadata {
    font-style: italic;
    font-size: 0.9rem;
    opacity: 0.7;
}

.collection-plaque .description-text {
    margin-top: 15px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #bbb;
}