/* =================================
    TAG CLOUD PAGE

    Deliberately mirrors taglist.php's actual patterns (the page these
    tags link out to) rather than introducing new ones: no card/box
    around the content, plain header-container/description-container/
    dotted-line structure, plain search input. Variable values below
    are copied from taglist.css's own :root block so this page's
    background is guaranteed to match the rest of the site, not just
    coincide with it.
    ================================= */

:root {
    --body-background: #f8f8f8;
    --main-text-color: #333;
    --sidebar-input-border: #ddd;
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) {
        --body-background: #1a1a1a;
        --main-text-color: #e0e0e0;
        --sidebar-input-border: #555;
    }
}

body[data-theme="dark"] {
    --body-background: #1a1a1a;
    --main-text-color: #e0e0e0;
    --sidebar-input-border: #555;
}

body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--body-background);
    color: var(--main-text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

.main-content-wrapper {
    display: block;
    min-height: 100vh;
    padding: 120px 20px 40px;
    box-sizing: border-box;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 10px;
}

.header-container h1 {
    font-size: 2em;
    margin: 0;
}

.description-container {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    margin-bottom: 0;
    line-height: 1.6;
    color: var(--main-text-color);
    padding-bottom: 0;
}

.error-text {
    color: #e74c3c;
}

.dotted-line {
    border-bottom: 2px dotted #ccc;
    margin-top: 5px;
    margin-bottom: 20px;
}

/* --- Search bar --- */
.button-group-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.main-search-form {
    display: flex;
    margin: 0;
}

#tagCloudSearch {
    width: 280px;
    padding: 8px 15px;
    border: 1px solid var(--sidebar-input-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--main-text-color);
    background-color: #ffffff;
    transition: all 0.3s ease;
    margin: 0;
}

#tagCloudSearch:focus {
    border-color: #007bff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1), 0 0 5px rgba(0,123,255,0.5);
    outline: none;
}

.tagcloud-search-count {
    font-size: 14px;
    color: var(--main-text-color);
    opacity: 0.75;
}

/* --- Section headings --- */
.tagcloud-count {
    font-weight: normal;
    font-size: 0.75em;
    opacity: 0.75;
}

/* --- Context tabs (Group/Title switcher) ---
   Copied from tags.css's existing .context-tabs component. Adapted in
   one place only: tags.css's active-tab background matches the card
   it sits above (--media-column-bg); this page has no card, so the
   active tab instead matches the page background (--body-background)
   it sits above, keeping the same "seamless merge" effect. */
.context-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--sidebar-input-border);
}
.context-tabs a {
    padding: 10px 15px;
    text-decoration: none;
    color: var(--main-text-color);
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 5px 5px 0 0;
    font-weight: bold;
}
.context-tabs a.active {
    background-color: var(--body-background);
    border-color: var(--sidebar-input-border);
    border-bottom: 2px solid var(--body-background);
}
.context-tabs a:hover:not(.active) {
    background-color: rgba(0, 0, 0, 0.05);
}
@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) .context-tabs a:hover:not(.active) {
        background-color: rgba(255, 255, 255, 0.1);
    }
}
body[data-theme="dark"] .context-tabs a:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.1);
}

.tagcloud-empty {
    color: var(--main-text-color);
    opacity: 0.75;
    font-style: italic;
}

/* --- The word cloud canvas --- */
.tagcloud-canvas-wrap {
    position: relative;
    width: 100%;
}

.tagcloud-canvas-wrap canvas {
    display: block;
    width: 100%;
}

.tagcloud-no-matches {
    padding: 20px 0;
}

/* --- Small screens --- */
@media (max-width: 600px) {
    .main-content-wrapper {
        padding: 100px 15px 30px;
    }
    #tagCloudSearch {
        width: 100%;
    }
}