@import url('https://fonts.googleapis.com/css2?family=Work+Sans:ital,wght@0,100..900;1,100..900&display=swap');

*{
    font-family: "Work Sans", serif;
}

:root{
    /* Text */
    --links: #3B3C4A;
    --search: #A1A1AA;
    --topics: #FFFFFF;
    --primary:#181A2A;
    --technology: #4B6BFB;
    --secondary:#97989F;
    --about: #696A75;

    /* Background */
    --search-bg: #52525b14;
    --blog-bg: #FFFFFF;
    --blog-tag: #4b6bfb10;
    --border-line-blog: #E8E8EA;
    --border-line-view: #696A75;
    --search-dropdown-bg: #fff;
}

.dark-mode{
    /* Text */
    --links: #FFFFFF;
    --search: #A1A1AA;
    --topics: #FFFFFF;
    --primary:#FFFFFF;
    --technology: #4B6BFB;
    --secondary:#97989F;
    --about: #696A75;

    /* Background */
    --search-bg: #242535;
    --blog-bg: #181A2A;
    --blog-tag: #4b6bfb10;
    --border-line-blog: #242535;
    --border-line-view: #696A75;
    --search-dropdown-bg: #242535;

    background-color: #181A2A;
}

body{
    padding:0;
    margin:0;
    box-sizing: border-box;
}

.container{
    max-width:1200px !important;
    margin:0 auto;
    padding:0px 15px;
}

.nav-bar {
    display: flex;
    justify-content: space-between; 
    gap: 2rem;
    padding-top: 30px;
    align-items: center;
    position: relative;
}

.brand-name{
    color:var(--primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-list {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-list li{
    list-style: none;
    font-size: 1rem;
}

.nav-list li a{
    text-decoration: none;
    color: var(--links);
    transition: 0.5s;
}

.nav-list li a:hover{
    color: var(--secondary);
}

.search-toggle {
    display: flex;
    align-items: center;
    gap:1.2rem;
}

.search{
    display:flex;
    align-items: center;
    background: var(--search-bg);
    padding:10px 15px;
    border-radius: 5px;
    position: relative;
}

.search-input{
    border:none;
    background: none;
    color: var(--primary);
    min-width: 100px;
    width: 100%;
    box-sizing: border-box;
}

.search-input:focus {
    border: none;
    outline: none;
    box-shadow: none; /* Ensures no additional focus effect */
}

.search-input::placeholder{
    color:var(--search);
}

.search-dropdown {
    position: absolute;
    left: 0;
    top: 110%; /* Pushes dropdown below the search bar */
    background: var(--search-dropdown-bg);
    color: var(--primary);
    border: none;
    border-radius: 14px;
    width: 400px;      /* Increase this value for more width */
    min-width: 300px;  /* Optional: set a minimum width */
    max-width: 100vw;  /* Prevents overflow on small screens */
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    padding: 0.5rem 0;
    display: none;
}

search-result {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result:hover {
    background: var(--blog-tag) !important;
}

.search-result img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
}

.search-result span {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 500;
}

.user-profile{
    background: var(--blog-bg);
    box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
}

.username{
    color:var(--primary);
}

.user-list{
    color:var(--primary);
    display:flex;
    flex-direction: column;
}

.admin-link{
    display:flex;
    align-items: center;
}

.list{
    display:flex;
    gap:0.3rem;
    padding-left:10px;
    cursor: pointer;
}

.list img{
    width:20px;
}

.border{
    border: 1px solid var(--secondary);
    width:100%;
    margin:0 auto;
}

.sign-out{
    display:flex;
    gap:0.3rem;
    padding-left:10px;
}

.sign-out img{
    width:20px;
}   

.sign-out a{
    color:var(--primary);
}

.dark-mode .sign-out img {
    filter:brightness(0) invert(1);
}

.dark-mode .list img{
    filter:brightness(0) invert(1);
}

.sign-in-btn{
    background: var(--search-bg);
    padding:10px 20px;
    border-radius: 5px;
    color: var(--search);
    cursor: pointer;
    transition: 0.5s;
    text-decoration: none;
}

.sign-in-btn:hover{
    background: var(--secondary);
    color: var(--primary);
}

input[type="text"]{
    outline: none;
}

.toggle-label {
    width: 50px;
    height: 25px;
    border-radius: 15px;
    background: #F3F3F3;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1) inset;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px;
}

.circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    position: absolute;
    left: 5px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sun, .moon {
    width: 14px;
    height: 14px;
    position: absolute;
    transition: opacity 0.3s;
}

.sun {
    opacity: 1;
}

.moon {
    opacity: 0;
}

input[type="checkbox"]:checked + .toggle-label .circle {
    left: 25px;
    background:var(--search);
}

input[type="checkbox"]:checked + .toggle-label .sun {
    opacity: 0;
}

input[type="checkbox"]:checked + .toggle-label .moon {
    opacity: 1;
}

input[type="checkbox"]:checked + .toggle-label {
    background:var(--search-bg);
}

input[type="checkbox"] {
    display: none;
}

.topics-search, .category, .sort-by{
    display:flex !important;
    align-items: center !important;
    background: var(--search-bg);
    padding:10px 15px !important;
    border-radius: 5px !important;
    color:var(--primary) !important;
}

.featured-topics{
    color:var(--primary);
}

.topics-container{
    margin-top:100px;
}

.blog{
    display:flex;
    flex-direction: column;
    gap:1rem;
    background: var(--blog-bg) !important;
    border: 1px solid var(--border-line-blog);
    max-width:100%;
    padding:16px;
    border-radius: 12px;
    cursor: pointer;
}

.blog img{
    max-width:100%;
    border-radius: 6px;
}

.blog-tag{
    background:var(--blog-tag);
    color:var(--technology);
    width: fit-content;
    padding:7px 10px;
    border-radius: 6px;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
}

.blog h2{
    max-width:100%;
    font-size: clamp(1.2rem, 1.4vw, 1.75rem);
    line-height: 1.1;
    font-weight: 600;
    color:var(--primary);
}

.blog-details{
    display:flex;
    gap:0.7rem;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
    color: var(--secondary);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-menu-toggle img {
    width: 30px;
    height: 30px;
}

.dark-mode .mobile-menu-toggle img{
    filter:brightness(0) invert(1);
}

.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 1rem;
    background: var(--blog-bg);
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow-y: auto;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-line-blog);
}

.mobile-menu-header span{
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-menu-close img {
    width: 30px;
    height: 30px;
}

.dark-mode .mobile-menu-close img{
    filter:brightness(0) invert(1);
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.mobile-nav-list li a {
    text-decoration: none;
    color: var(--links);
    font-size: 1.25rem;
    padding: 0.5rem 0;
    display: block;
}

.mobile-search-toggle {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem;
}

/* Show mobile menu when active */
.mobile-menu.active {
    display: flex;
}


@media(max-width:900px){
    .nav-list {
        display: none;
    }

    .search-toggle {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }
}

@media (max-width:768px) {
    .header-content h1 {
        font-size: clamp(1.5rem, 1vw, 2.5rem); /* Bigger on small screens */
    }
}

@media (max-width:480px) {
    .mobile-search-toggle{
        flex-direction: column;
    }
}