/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Theme Variables */
:root {
    --bg-color: rgb(255, 255, 255);
    --text-color: black;
    --box-bg: #f0f0f0;
    --box-hover: #ddd;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0B1120;
        --text-color: rgb(255, 255, 255);
        --box-bg: #1e293b;
        --box-hover: #0cd4f3;
    }
}

/* Body Styling */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 10px;
    font-family: 'Josefin Sans', sans-serif;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Header Styling */
header {
    text-align: center;
    margin-bottom: 20px;
    justify-content: center;
    align-items: center;
}


header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.one {
    background-color: rgb(1, 0, 12);
    padding: 20px;
    border-radius: 15px;
}

header input {
    padding: 10px;
    width: 50%;
    max-width: 400px;
    border-radius: 8px;
    border: 1px solid #ccc;
}

.back-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 1rem;
    color: var(--text-color);
    text-decoration: none;
    position: absolute;
    left: 40px;
    top: 6%;
    transform: translateY(-50%);
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: color 0.2s, transform 0.3s;
    cursor: pointer;
}

.back-link::before {
    content: "← ";
    transition: margin-right 0.3s, color 0.2s;
    margin-right: 4px;
    color: #0cd4f3;
    font-size: 1.1em;
}

.back-link:hover {
    color: #0cd4f3;
    transform: translate(-10px, -50%);
    text-decoration: underline;
}

.back-link:hover::before {
    margin-right: 10px;
    color: #1e293b;
}

/* Grid Layout for Boxes */
main {
    display: grid;
    grid-template-columns: repeat(auto-fill, 220px);
    gap: 20px;
    justify-content: center;
    margin-bottom: 70px;
    flex : 1;
}

h2 {
    margin: 20px 0 10px;
    font-size: 1.4rem;
}

.tool-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, 220px);
    gap: 20px;
    justify-content: center;
}

.fixed-header input[type="text"] {
    border: 2px solid #0cd4f3;
    background: rgba(20, 30, 50, 0.85);
    color: #0cd4f3;
    font-size: 0.4em;
    border-radius: 10px;
    padding: 7px 12px;
    width: 55%;
    max-width: 320px;
    min-width: 300px;
    transition:
        box-shadow 0.35s cubic-bezier(.4, 2, .6, 1),
        border-color 0.3s,
        background 0.3s,
        color 0.3s,
        transform 0.2s;
    outline: none;
    box-shadow: 0 2px 12px rgba(12, 212, 243, 0.08);
    letter-spacing: 1px;
}

.fixed-header input[type="text"]:hover {
    border-color: #fff;
    background: rgba(12, 212, 243, 0.12);
    color: #fff;
    box-shadow: 0 0 0 3px #0cd4f3, 0 4px 24px #0cd4f3;
    transform: scale(1.03);
}

.fixed-header input[type="text"]:focus {
    border-color: #fff;
    background: rgba(12, 212, 243, 0.18);
    color: #fff;
    box-shadow: 0 0 0 4px #0cd4f3, 0 6px 32px #0cd4f3;
    transform: scale(1.05);
}

/* About Button (Desktop Default) */
.abt-link {
    position: absolute;
    right: 40px;
    color: white;
    top: 6%;
    transform: translateY(-50%);
    background: linear-gradient(90deg, #0cd4f3 0%, #1e293b 100%);
    padding: 10px 24px;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(12, 212, 243, 0.15);
    transition: background 0.3s, color 0.3s, box-shadow 0.3s, transform 0.2s;
    font-weight: 600;
    letter-spacing: 1px;
    border: none;
    outline: none;
    cursor: pointer;
    text-decoration: none;
    /* ⬅ FIX: Remove underline */
}

.abt-link:hover {
    background: linear-gradient(90deg, #1e293b 0%, #0cd4f3 100%);
    color: #fff;
    box-shadow: 0 4px 16px 0 #0cd4f3, 0 2px 8px rgba(12, 212, 243, 0.25);
    transform: scale(1.07);
    text-decoration: none;
    /* ⬅ Also ensure no underline on hover */
}

.hr-text {
    border: none;
    border-top: 1px solid #000;
    text-align: center;
    position: relative;
    margin: 20px 0;
}

.hr-text::before {
    content: attr(data-content);
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0 10px;
    color: #000;
    font-weight: bold;
}

/* Category page main section container */
.category-page .tool-section {
    background-color: var(--box-bg);
    /* same smooth mix as homepage */
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* Tool boxes inside each section */

.category-page .tool-box {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 20px !important;
    border-radius: 12px !important;
    background-color: rgba(20, 30, 50, 0.85) !important;
    color: #fff !important;
    font-weight: bold !important;
    font-size: 1rem !important;
    text-decoration: none !important;
    width: auto !important;
    height: auto !important;
    border: 1.5px solid rgba(12, 212, 243, 0.18) !important;
    box-shadow: 0 2px 5px rgba(12, 212, 243, 0.18) !important;
    transition: background-color 0.3s ease, box-shadow 0.3s ease !important;
}

.category-page .tool-box:hover {
    background: rgba(12, 212, 243, 0.12) !important;
    box-shadow: 0 8px 20px #0cd4f3 !important;
}

.lib {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Hover effect */
.category-page .tool-box:hover {
    background-color: var(--box-hover);
}

/* --- Structured Layout for Category Pages --- */
.category-page main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.category-section {
    display: inline-block;
    /* Take only the required width */
    margin: 0 0 30px 0;
    /* Add bottom spacing */
    padding: 0 5px;
}

/* Section heading styling */
.category-section h2 {
    font-size: 1.6rem;
    color: var(--text-color);
    margin-bottom: 15px;
    text-align: left;
    padding-left: 10px;
}

/* Tool list below headings */
.category-section .tool-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: flex-start;
}

/* Individual tool boxes */
.category-section .tool-box {
    width: 220px;
    height: auto;
    padding: 14px;
    background-color: var(--box-bg);
    border-radius: 8px;
    text-align: center;
    color: var(--text-color);
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.category-section .tool-box:hover {
    background-color: var(--box-hover);
}

footer {
    position: static;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: rgba(20, 30, 50, 0.95);
    color: #fff;
    text-align: center;
    padding: 15px 0;
    /* extra top padding for glow-line space */
    font-family: 'Josefin Sans', sans-serif;
    box-shadow: 0 -2px 12px #0cd4f3;
    z-index: 100;
    border-top: none;
    /* remove old border */
}

.glow-line {
    display: block;
    width: 100vw;
    max-width: 100vw;
    height: 6px;
    margin: 0 auto 0 auto;
    background: linear-gradient(90deg, #0cd4f3 0%, #ff00ff 100%);
    box-shadow: 0 0 20px #0cd4f3, 0 0 40px #ff00ff;
    border-radius: 3px;
    z-index: 101;
    pointer-events: none;
}

.footer-container p {
    margin: 0;
    font-size: 14px;
}

.scroll-text {
    overflow: hidden;
    /* hide outside text */
    white-space: nowrap;
    box-sizing: border-box;
}

.scroll-text span {
    display: inline-block;
    padding-left: 100%;
    /* start outside screen */
    animation: scroll 12s linear infinite;
    /* speed & infinite loop */
    font-size: 16px;
    color: #0cd4f3;
    /* neon cyan text */
}

@keyframes scroll {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Mobile Responsive Header */
@media (max-width: 768px) {

    /* Header Flex on Mobile */
    header nav {
        background: linear-gradient(90deg, rgba(12, 212, 243, 0.10) 0%, rgba(30, 41, 59, 0.92) 100%);
        backdrop-filter: blur(8px);
        border-bottom: 1.5px solid #0cd4f3;
        box-shadow: 0 2px 12px rgba(12, 212, 243, 0.08);

        /* Added for proper alignment */
        display: flex;
        justify-content: space-between;
        /* space between TECHY ZONE & About */
        align-items: center;
        /* vertically align center */
        padding: 6px 10px;
        /* adjust padding for better fit */
        gap: 8px;
        /* small gap for breathing space */
    }


    .fixed-header {
        margin-top: 10px;
        margin-bottom: 18px;
    }

    .one {
        background-color: rgb(1, 0, 12);
        padding: 16px 14px;
        height: 40px;
        /* more padding for better height */
        border-radius: 12px;
        /* smoother rounded corners */
        margin: 0 6px;
        /* give side spacing */
        display: flex;
        text-align: center;
        align-items: center;
        justify-content: center;
        width: calc(100% - 12px);
        /* make it wider but not touch screen edges */
        box-shadow: 0 2px 10px rgba(12, 212, 243, 0.2);
        /* soft glow effect */
    }

    footer {
        position: static !important;
        left: unset !important;
        right: unset !important;
        bottom: unset !important;
        width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 18px 0 12px 0 !important;
    }

    .glow-line {
        position: relative;
        width: 94vw;
        max-width: 100vw;
        height: 4px;
        margin: 0.2px 0 0 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(90deg, #0cd4f3 0%, #ff00ff 100%);
        box-shadow: 0 0 20px #0cd4f3, 0 0 40px #ff00ff;
        border-radius: 3px;
        z-index: 101;
        pointer-events: none;
    }

    /* TECHY ZONE Title */
    .site-title {
        font-size: 1.3rem;
        /* make title smaller */
        margin: 0;
        padding: 0;
    }

    /* About Button on Mobile */
    .abt-link {
        position: relative;
        /* remove absolute only on mobile */
        top: auto;
        right: auto;
        transform: none;
        font-size: 0.85rem;
        /* smaller button */
        padding: 6px 14px;
        /* less padding */
        border-radius: 20px;
        margin-left: auto;
    }

    .back-link {
        position: static;
        display: inline-block;
        margin: 12px 0 16px 0;
        padding: 8px 18px;
        font-size: 1rem;
        left: unset;
        top: unset;
        transform: none;
        background: rgba(12, 212, 243, 0.08);
        border-radius: 18px;
        color: #0cd4f3;
        font-weight: 600;
        box-shadow: 0 1px 6px rgba(12, 212, 243, 0.08);
        transition: background 0.2s, color 0.2s;
    }

    .back-link:hover {
        background: #0cd4f3;
        color: #1e293b;
        text-decoration: none;
    }

    /* Make Boxes Responsive */
    main {
        grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
        gap: 15px;
    }

    .category-box,
    .tool-box {
        width: 100% !important;
        min-width: 0;
        height: 90px !important;
        font-size: 1rem;
    }
}

@media (max-width: 1024px) {
    header {
        text-align: center;
        margin-bottom: 22px;
        justify-content: center;
        align-items: center;
    }

    .fixed-header {
        margin-top: 10px;
        margin-bottom: 18px;
    }

    .one {
        background-color: rgb(1, 0, 12);
        padding: 16px 14px;
        height: 40px;
        border-radius: 12px;
        margin: 0 6px;
        display: flex;
        text-align: center;
        align-items: center;
        justify-content: center;
        width: calc(100% - 12px);
        box-shadow: 0 2px 10px rgba(12, 212, 243, 0.2);
    }

    footer {
        position: static !important;
        left: unset !important;
        right: unset !important;
        bottom: unset !important;
        width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 18px 0 12px 0 !important;
        margin-top: auto;
    }

    .glow-line {
        position: relative;
        width: 94vw;
        max-width: 100vw;
        height: 5px;
        margin: 0 auto;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(90deg, #0cd4f3 0%, #ff00ff 100%);
        box-shadow: 0 0 20px #0cd4f3, 0 0 40px #ff00ff;
        border-radius: 3px;
        z-index: 101;
        pointer-events: none;
    }

    .site-title {
        font-size: 1.3rem;
        margin: 0;
        padding: 0;
    }

    .abt-link {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        font-size: 0.85rem;
        padding: 6px 14px;
        border-radius: 20px;
        margin-left: auto;
    }

    .back-link {
        position: static;
        display: inline-block;
        margin: 12px 0 16px 0;
        padding: 8px 18px;
        font-size: 1rem;
        left: unset;
        top: unset;
        transform: none;
        background: rgba(12, 212, 243, 0.08);
        border-radius: 18px;
        color: #0cd4f3;
        font-weight: 600;
        box-shadow: 0 1px 6px rgba(12, 212, 243, 0.08);
        transition: background 0.2s, color 0.2s;
    }

    .back-link:hover {
        background: #0cd4f3;
        color: #1e293b;
        text-decoration: none;
    }

    main {
        grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
        gap: 15px;
        flex: 1;
    }

    .category-box,
    .tool-box {
        width: 100% !important;
        min-width: 0;
        height: 90px !important;
        font-size: 1rem;
    }
}

/* Techy glassmorphism for category cards */
.category-box,
.tool-box {
    width: 220px;
    height: 220px;
    background: rgba(20, 30, 50, 0.85);
    /* semi-transparent dark glass */
    border: 1.5px solid rgba(12, 212, 243, 0.18);
    /* subtle neon border */
    box-shadow: 0 4px 24px rgba(12, 212, 243, 0.08), 0 1.5px 8px #0cd4f3;
    /* blue glow */
    backdrop-filter: blur(4px);
    /* glass blur effect */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    font-size: 1.1rem;
    transition:
        background 0.3s,
        box-shadow 0.3s,
        transform 0.25s;
    position: relative;
    overflow: hidden;
}

.category-box::after,
.tool-box::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
    box-shadow: 0 0 24px 4px #0cd4f3;
    /* extra glow on hover */
    opacity: 0;
    transition: opacity 0.3s;
}

.category-box:hover,
.tool-box:hover {
    background: rgba(12, 212, 243, 0.12);
    /* lighter blue on hover */
    box-shadow: 0 8px 32px #0cd4f3, 0 2px 12px #1e293b;
    /* stronger glow */
    transform: scale(1.045) rotate(-1deg);
    /* slight pop and tilt */
}

.category-box:hover::after,
.tool-box:hover::after {
    opacity: 0.25;
    /* show the glow */
}

/* === Force Dark Mode Even for Light Mode Users === */
@media (prefers-color-scheme: light) {

    /* Body */
    body {
        background-color: #0B1120 !important;
        /* dark navy background */
        color: #fff !important;
    }

    /* Headings */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        color: #fff !important;
    }

    /* Links */
    a {
        color: #0cd4f3 !important;
        /* neon cyan */
    }

    /* Site title (navbar) */
    header .site-title {
        background-color: #000 !important;
        /* pure black bar */
        color: #fff !important;
    }

    /* About button */
    .abt-link {
        background-color: #1e293b !important;
        color: #fff !important;
    }

    .abt-link:hover {
        background-color: #0cd4f3 !important;
        color: white !important;
    }

    /* Inputs, textareas, selects */
    input,
    textarea,
    select {
        background-color: rgba(20, 30, 50, 0.85) !important;
        color: #eee !important;
        border: 1.5px solid rgba(12, 212, 243, 0.18) !important;
    }

    /* === Homepage big boxes === */
    .categories .category-box,
    .categories .tool-box {
        width: 220px !important;
        height: 220px !important;
    }

    /* === Category page small boxes === */
    .category-page .tool-box {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 20px !important;
        border-radius: 8px !important;
        background-color: rgba(20, 30, 50, 0.85) !important;
        color: #fff !important;
        font-weight: bold !important;
        font-size: 1rem !important;
        text-decoration: none !important;
        width: auto !important;
        height: auto !important;
        border: 1.5px solid rgba(12, 212, 243, 0.18) !important;
        box-shadow: 0 2px 5px rgba(12, 212, 243, 0.18) !important;
        transition: background-color 0.3s ease, box-shadow 0.3s ease !important;
    }

    .category-page .tool-box:hover {
        background: rgba(12, 212, 243, 0.12) !important;
        box-shadow: 0 8px 20px #0cd4f3 !important;
    }

    /* === Shared dark styling for all boxes === */
    .category-box,
    .tool-box {
        background: rgba(20, 30, 50, 0.85) !important;
        border: 1.5px solid rgba(12, 212, 243, 0.18) !important;
        box-shadow: 0 4px 24px rgba(12, 212, 243, 0.08), 0 1.5px 8px #0cd4f3 !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        color: #fff !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        position: relative !important;
        transition: background 0.3s, box-shadow 0.3s, transform 0.25s !important;
        will-change: transform, box-shadow !important;
    }

    .category-box::after,
    .tool-box::after {
        content: '' !important;
        position: absolute !important;
        inset: 0 !important;
        border-radius: 12px !important;
        pointer-events: none !important;
        box-shadow: 0 0 24px 4px #0cd4f3 !important;
        opacity: 0 !important;
        transition: opacity 0.3s !important;
        will-change: opacity !important;
    }

    .category-box:hover,
    .tool-box:hover {
        background: rgba(12, 212, 243, 0.12) !important;
        box-shadow: 0 8px 32px #0cd4f3, 0 2px 12px #1e293b !important;
        transform: scale(1.045) rotate(-1deg) !important;
    }

    .category-box:hover::after,
    .tool-box:hover::after {
        opacity: 0.25 !important;
    }
}