:root {
    --bg-color: #f9f9f9;
    --text-color: #111;
    --button-bg: #ffffff;
    --button-border: #ddd;
    --button-hover: #f0f0f0;
}

/* ====== BOOT STATE (no flash on load) ====== */
html.boot #category-listing,
html.boot #secondary-category-listing,
html.boot #toolContainer,
html.boot #categories-header,
html.boot #categoryBox {
    display: none !important;
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(to bottom right, #d7e2fa, #d7e2fa);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
    justify-content: space-between;
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    max-width: 550px;
    width: 100%;
    margin: auto;
}

.logo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    margin-bottom: -8px;
}

.name {
    font-size: 1.9rem;
    font-weight: bold;
    margin-top: 0px;
    margin-bottom: 100px;
    text-align: center;
}

.slogan {
    font-size: 1.4rem;
    margin-bottom: 10px;
    height: 2em;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    visibility: hidden;
}

.slogan.typing {
    visibility: visible;
}

.slogan::after {
    content: '|';
    font-size: 1.8rem;
    animation: blink-cursor 1s infinite;
}

@keyframes blink-cursor {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.search-container {
    width: 100%;
    max-width: 400px;
    margin: 10px auto 5px;
    position: relative;
    margin-bottom: 25px;
}

.search-container input {
    width: 100%;
    padding: 15px 15px;
    border: none;
    border-radius: 30px;
    font-size: 1em;
    background: linear-gradient(135deg, #ffffff, #ffffff);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    outline: none;
}

.search-results {
    position: absolute;
    top: 50px;
    width: 100%;
    background-color: #fff;
    border: 3px solid #d7e2fa;
    border-radius: 20px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    color: #000;
    font-size: 1em;
}

.search-results div {
    padding: 7px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.search-results div:hover {
    background-color: #d7e2fa;
}

#backHomeBtn {
    display: none;
    margin: 20px auto 0;
    margin-bottom: 10px;
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid #aaa;
    background: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s;
}

#backHomeBtn:hover {
    background: var(--button-hover);
}

#backParentBtn {
    display: none;
    margin: 1px auto 0;
    margin-bottom: 10px;
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid #aaa;
    background: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s;
}

#backParentBtn:hover {
    background: var(--button-hover);
}

#categories-header {
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1.1em;
}

#scrollTopBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    display: none;
    background-color: #ffffff;
    border: 1px solid #aaa;
    border-radius: 50px;
    padding: 10px 16px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: opacity 0.3s, visibility 0.3s;
}

#scrollTopBtn:hover {
    background-color: #f0f0f0;
}

.pagination-button {
    padding: 10px 20px;
    margin: 6px 6px;
    font-size: 0.95rem;
    border: 1px solid var(--button-border);
    background-color: var(--button-bg);
    color: var(--text-color);
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.3s, box-shadow 0.3s;
}

.pagination-button:hover:not(:disabled) {
    background-color: var(--button-hover);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.pagination-button.active {
    background-color: #acb5c8;
    color: #000;
    font-weight: 500;
    cursor: default;
    box-shadow: inset 0 0 0 2px #ccc;
}

.pagination-button:disabled {
    opacity: 0.6;
    cursor: default;
}

#pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.tool-listing {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 10px;
}

.tool-item {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.tool-item a {
    padding: 12px 18px;
    background: var(--button-bg);
    border: 1px solid var(--button-border);
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 400;
    transition: background 0.3s;
    display: block;
    max-width: 100%;
    word-break: break-word;
}

.tool-item a:hover {
    background: var(--button-hover);
}

.tool-item .tooltip {
    visibility: hidden;
    background-color: #222;
    color: #fff;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 200px;
    font-size: 0.85em;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tool-item:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.tool-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px;
}

.tool-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.tool-card h3 {
    margin: 0 0 10px;
}

.tool-card p {
    margin: 0;
    color: #444;
}

.category-box {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 25px;
    margin: 10px 0 30px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    max-width: 800px;
    text-align: center;
    display: none;
}

.category-box .category-name {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.category-box .category-description {
    font-size: 1rem;
    color: #444;
}

footer {
    padding: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: #777;
}

footer a {
    color: #555;
    text-decoration: none;
    margin: 0 10px;
}

footer a:hover {
    text-decoration: underline;
}