/*
 * Frontend styles for Attendere Lexikon.
 */

/* Container that wraps content and sidebar for lexikon entries */
/*
 * Layout wrapper for single lexikon entries.
 *
 * The default flex layout here previously had a fixed gap and bottom
 * margin. That worked in isolation but could interfere with themes
 * using floats or absolute positioning (for example, newsletter
 * overlays). To better integrate the lexikon layout with a wide
 * variety of WordPress themes, the wrapper is now given a full
 * width and box sizing so it occupies the expected space in the
 * document flow. A larger bottom margin ensures any fixed footers
 * or overlays won’t overlap the content.
 */
.attendere-lexikon-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 2rem;
}

/* Main content area */
/*
 * Main lexikon content grows to fill available space. The flex shorthand
 * ensures it can shrink below its basis if space is tight without
 * overflowing its container. A `min-width: 0` allows the content to
 * shrink on smaller screens instead of forcing horizontal scroll.
 */
.attendere-lexikon-main-content {
    flex: 1 1 0;
    min-width: 0;
}

/* Sidebar area */
/*
 * Sidebar wrapper defaults to a fixed basis on desktop and wraps to
 * full width on narrow screens (handled in the media query below).
 */
.attendere-lexikon-sidebar-wrapper {
    flex: 0 0 260px;
    max-width: 100%;
}

/*
 * On narrow screens, stack the sidebar below the main content and
 * ensure both take up full width. This prevents the layout from
 * squeezing the main text too much and avoids overly small sidebars.
 */
@media (max-width: 768px) {
    .attendere-lexikon-main-content,
    .attendere-lexikon-sidebar-wrapper {
        flex: 1 1 100%;
    }
}

/* Styling for the sidebar card */
.attendere-lexikon-sidebar {
    background: #f7f7f7;
    padding: 1.25rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.attendere-lexikon-sidebar h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
}

.attendere-lexikon-sidebar h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.attendere-lexikon-sidebar ul {
    list-style: disc inside;
    margin: 0 0 1rem;
    padding: 0;
}

.attendere-lexikon-sidebar a {
    text-decoration: none;
    color: inherit;
    border-bottom: 1px dashed #888;
}

.attendere-lexikon-sidebar a:hover {
    border-color: #333;
}

/* Back link styling */
.attendere-lexikon-back-link {
    font-size: 0.9rem;
}
.attendere-lexikon-back-link a {
    text-decoration: none;
    color: #0073aa;
}
.attendere-lexikon-back-link a:hover {
    color: #005177;
}

/* Tooltip styles for automatic internal linking */
.attendere-lexikon-term-link {
    position: relative;
    text-decoration: underline;
    cursor: pointer;
    border-bottom: 1px dashed currentColor;
}
.attendere-lexikon-term-link .attendere-term-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0.75rem;
    width: 260px;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    line-height: 1.4;
}
.attendere-lexikon-term-link:hover .attendere-term-tooltip {
    display: block;
}
.attendere-term-tooltip a {
    color: #0073aa;
    text-decoration: none;
    border-bottom: 1px dashed #0073aa;
}
.attendere-term-tooltip a:hover {
    color: #005177;
}

/* Related terms section */
.attendere-lexikon-related-terms {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}
.attendere-lexikon-related-terms h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}
.attendere-lexikon-related-terms ul {
    margin: 0;
    padding-left: 1.2em;
    list-style: disc;
}
.attendere-lexikon-related-terms li {
    margin-bottom: 0.25rem;
}
.attendere-lexikon-related-terms a {
    text-decoration: none;
    border-bottom: 1px dashed #888;
    color: inherit;
}
.attendere-lexikon-related-terms a:hover {
    border-color: #333;
}

/*
 * Styling for the lexikon archive container. This was previously inline
 * on the <main> element but is now placed here so themes can override
 * or modify it via CSS without editing the template. The container
 * centres the archive and provides consistent padding.
 */
.attendere-lexikon-archive {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Styles for the search and category filter on the lexikon archive */
.attendere-lexikon-archive input[type="search"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
}
.lexikon-category-button {
    display: inline-block;
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #333;
    background: #f1f1f1;
}
.lexikon-category-button.active {
    background: #5a2d81;
    color: #ffffff;
}
.lexikon-category-button.reset {
    background: #dddddd;
    color: #333333;
}
.lexikon-entry-title a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}
.lexikon-entry-title a:hover {
    border-bottom-color: #555;
}

/*
 * Glossary A-Z navigation styling for the archive page.
 * Presents the list of initial letters as a set of rounded buttons for
 * better visibility and spacing. Hover state darkens the background
 * slightly to indicate interactivity.
 */
.lexikon-letter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.lexikon-letter-nav a {
    display: inline-block;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
}

.lexikon-letter-nav a:hover {
    background-color: #e5e5e5;
    border-color: #ccc;
}

/*
 * Highlight the currently selected letter in the navigation.
 */
.lexikon-letter-link.active {
    background-color: #5a2d81;
    border-color: #5a2d81;
    color: #ffffff;
}

/* Highlight the active letter in the A-Z navigation */
.lexikon-letter-nav a.active {
    background-color: #5a2d81;
    border-color: #5a2d81;
    color: #ffffff;
}

/*
 * Styling for the letter headings inside the glossary list. Adds a
 * border and spacing to separate each group of terms clearly.
 */
.lexikon-letter-heading {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.25rem;
}

/*
 * Improve readability of entries in the lexikon letter groups.
 */
.lexikon-letter-group article {
    margin-bottom: 1rem;
}

/*
 * Styling for the glossary archive page title. We leave font size and
 * weight unset so that it inherits from the theme’s default H1 style,
 * but ensure consistent spacing around it.
 */
.attendere-lexikon-title {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* Suggestion dropdown for autocomplete */
.attendere-lexikon-suggestions {
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9rem;
    z-index: 10000;
}
.attendere-lexikon-suggestions li {
    padding: 0.3rem 0.6rem;
    cursor: pointer;
}
.attendere-lexikon-suggestions li:hover {
    background: #f1f1f1;
}