@import url('https://fonts.googleapis.com/css2?family=Zain:ital,wght@0,200;0,300;0,400;0,700;0,800;0,900;1,300;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Lexend+Mega&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    scrollbar-color: var(--light-blue) var(--body-bg);
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--body-bg);
}

/* Utility class to hide and show elements */
.hidden {
    visibility: hidden;
    opacity: 0;
}

/* Smooth transition for content */
#content {
    transition: opacity 0.1s ease-out, transform 0.1s ease-out;
}

.username-select {
    font-size: 1.5rem;
    color: var(--content-grey);
    margin-right: 5px;
    font-family: "Zain";
    cursor: pointer;
}

.username-select:hover {
    color: var(--light-blue);
}

/****************Enable-JS Warning***************/
.noscript-warning {
    background-color: var(--noscript-bg);
    color: var(--grey-mr);
    padding: 15px;
    margin: 15px;
    text-align: center;
    line-height: 1.5;
    border: 0px;
    border-radius: 8px;
}

.noscript-link {
    color: var(--noscript-red);
    text-decoration: underline;
}

/***********************************************
******************** POSTS *********************
************************************************/
.main-content {
    padding: 2rem;
}

.post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border: 1px solid var(--border-grey);
    border-radius: 12px;
    padding: 20px 30px 20px 30px;
    margin: 1rem auto;
    margin-bottom: 30px;
    max-width: 900px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    width: 95%;
}

#postTitle {
    text-align: left;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-white);
    margin-bottom: 20px;
    font-family: 'Roboto', 'verdana', 'Arial Narrow Bold', sans-serif;
    font-weight: 470;
    font-size: 1.4rem;
    overflow-wrap: anywhere;
    color: var(--filter-title);
}

.post-card:hover {
    box-shadow: 0px 3px 3px var(--post-card-shadow);
}

.post-card .post-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1rem;
    border: 2px solid var(--border-white);
}

.post-card .user-info {
    font-size: 1rem;
    color: var(--grey-mr);
}

.post-card .user-info .username {
    font-weight: bold;
}

.time-ago {
    color: var(--light-grey);
    font-size: 0.8rem;
    font-weight: 300;
}

.post-card .post-content {
    font-size: 1.1rem;
    color: var(--content-grey);
    margin-bottom: 1rem;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.4;
    font-family: 'Roboto';
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .post-card {
        padding: 1rem;
        margin: 0.5rem auto;
        margin-bottom: 40px;
    }
}

@media (max-width: 500px) {
    .main-content {
        padding: 0.8rem;
    }
}

@media (max-width: 380px) {
    .post-content h3 {
        font-size: 1.1rem;
        line-height: 1.4;
        margin-bottom: 20px;
    }

    #postTitle {
        font-size: 1.1rem;
    }

    .post-card .post-content {
        font-size: 0.9rem;
    }

    .post-card .user-avatar {
        width: 50px;
        height: 50px;
    }

    .post-card .user-info {
        font-size: 0.9rem;
        margin-right: 0.5rem;
    }

    .post-card .user-info .username {
        font-weight: bold;
        margin-bottom: 0.3rem;
    }

    #tagFilterSection {
        margin-bottom: 40px;
    }

    #tagFilterSection h3 {
        font-size: 1.1rem !important;
    }

    .tag-filter-input::placeholder {
        font-size: 0.9rem;
    }
}

/****************** Post Tags ******************/
/* The container that holds tags + avatar + username */
.post-header {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

/* Absolutely position tags in top-right corner */
.post-tags-container {
    position: absolute;
    top: 5px;
    right: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-tags {
    display: inline-flex;
    align-items: center;
    background-color: var(--body-bg2);
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--filter-title);
}

.tag-icon {
    width: 14px;
    height: 14px;
    margin-right: 4px;
}

@media (max-width: 900px) {
    .post-header {
        position: static;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
    }

    .post-tags-container {
        position: static;
        order: -1;
        margin-bottom: 1rem;
        right: auto;
        top: auto;
        width: 100%;
        justify-content: left !important;
        max-width: 100% !important;
    }
}


/********************************************************
                    TAG FILTER SECTION
********************************************************/
#tagFilterSection {
    width: 90%;
    margin: auto;
    margin-top: 200px;
    margin-bottom: 60px;
    text-align: center;
    max-width: 400px;
    font-family: Arial, sans-serif;
    color: var(--dark-grey);
    display: none;
}

#tagFilterSection h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--filter-title);
}

#tagFilterContainer {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    border: 1px solid var(--border-grey);
    padding: 7px;
    border-radius: 10px;
    background-color: var(--white);
}

/* Selected Tags */
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

/* Input Field */
.tag-filter-input {
    border: none;
    outline: none;
    font-size: 1rem;
    background: none;
    padding: 6px;
    color: var(--filter-title);
    width: 100%;
}

.tag-filter-input::placeholder {
    color: var(--light-grey);
}

/* Suggestions Dropdown */
.tag-suggestions {
    position: absolute;
    /* Float dropdown relative to #tagFilterContainer */
    top: calc(100% + 6px);
    /* Appear just below the container */
    left: 0;
    width: 100%;
    background-color: var(--white);
    border: 1px solid var(--border-white);
    border-radius: 8px;
    z-index: 100;
    font-size: 0.9rem;
    max-height: 180px;
    overflow-y: auto;
}

.tag-suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    text-align: center;
}

.tag-suggestion-item:hover {
    background-color: var(--light-blue);
}

/* Tag “Pill” Style */
.tag-pill {
    display: inline-flex;
    align-items: center;
}

.remove-tag-btn {
    margin-left: 8px;
    background: none;
    border: none;
    color: var(--tagclose-btn);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    padding: 0;
    transition: color 0.2s;
}

.remove-tag-btn:hover {
    color: var(--grey-mr);
}

/**********************************
           Comment counts             
***********************************/
#comment-icon {
    width: 30px;
    height: 30px;
}

.comments-count {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tagclose-btn);
}

#comments-counts {
    margin-top: -20px;
    max-width: 70%;
}

/******************** Remove Links Behaviour From Post Title *********************/
.post-header-link {
    text-decoration: none;
    color: var(--title-color);
    display: block;
    /* To fill the container */
}

.post-header-link:hover {
    color: var(--title-color-hvr);
}

/*****************************************************/
/************** Welcome Pop Up Message ***************/
/*****************************************************/

/* Welcome Popup */
.welcome-popup {
    position: fixed;
    top: 1%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    color: rgba(45, 153, 255, 0.92);
    padding: 2rem 2.5rem;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 7px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    text-align: center;
    max-width: 85%;
    width: auto;
    transition: opacity 1.5s ease;
    opacity: 1;
    /* Start fully visible */
}

/* Close Button */
.close-popup {
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    font-size: 1.4rem;
    color: #333;
}

/* Fade-out effect */
.fade-out {
    opacity: 0;
}

@media (max-width: 500px) {
    .welcome-popup strong {
        font-weight: bold;
    }

    .welcome-popup {
        padding: 1.5rem 2rem;
        font-size: 1.2rem;
        font-weight: normal;
        border-radius: 5px;
    }

    .close-popup {
        font-size: 1.3rem;
    }
}

/*****************************************************/
/**************      Upload image      ***************/
/*****************************************************/
#singlePostImage {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    /* Centers it */
}

#singlePostImage img {
    width: 100%;
    height: auto;
    max-height: 600px;
    /* Prevents oversized images */
    border-radius: 10px;
    object-fit: contain;
}

/* List View: Fixed Size Without Distortion */
.post-image-wrapper {
    display: block;
    margin-top: 1rem;
    text-align: center;
    /* ensures it doesn't ex-
    ceed the post-card width */
    max-width: 100%;
}

/* The actual image */
.post-image-centered {
    display: inline-block;
    /* keep it inline-block so text-align: center works in wrapper */
    max-width: 100%;
    /* no horizontal overflow */
    max-height: 300px;
    /* limit tall images to 300px height */
    object-fit: contain;
    /* so it shrinks to fit within max-height */
    border-radius: 10px;
}

/*************************** Login github/google ***************************/
/* Social Login Buttons */
.social-login {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 350px;
    margin: 20px auto;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: left;
    width: 100%;
    padding: 12px;
    border-radius: 50px;
    font-size: 15px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: opacity 0.3s;
}

.social-icon {
    width: 24px;
    height: 24px;
    margin-right: 40px;
}

.google-btn,
.github-btn {
    background-color: #ffffff;
    border: 1px solid #bbb;
    color: #5f6368;
}

.google-btn:hover,
.github-btn:hover {
    background-color: #f1f3f4;
}

/* Separator */
.separator {
    display: flex;
    align-items: center;
    margin: 15px 0;
}

.separator span {
    font-size: 14px;
    color: #777;
    padding: 0 10px;
}

.separator::before,
.separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #ddd;
}

/* ======= Tab Bar ======= */
.tab-bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: var(--white);
    margin-top: 50px;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 15px;
    box-shadow: 0 4px 10px var(--navBar-shadow);
    z-index: 999;
}

/* ======= Tab Buttons ======= */
.tab-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    color: var(--content-grey);
    transition: all 0.3s ease;
}

.tab-txt {
    font-family: "Zain";
    font-size: 18px;
}

.tab-btn img {
    width: 20px;
    margin-bottom: 5px;
    filter: invert(53%) sepia(50%) saturate(1500%) hue-rotate(175deg);
    transition: filter 0.3s ease;
}

/* Active Button */
.tab-btn.active {
    background: var(--action-btn);
    border-radius: 12px;
    padding: 5px 20px;
    color: var(--content-grey);
}

.tab-btn.active img {
    filter: invert(50%) brightness(50%);
}

/* ======= Dark Mode Support ======= */
:root.dark-mode .tab-btn {
    color: var(--light-grey);
}

:root.dark-mode .tab-btn.active {
    background: var(--action-btn);
    color: var(--white);
}

/* ======= Cooldown opage ======= */
#cooldown-container {
    font-family: Arial, sans-serif;
    text-align: center;
    padding: 50px;
    color: #bdf;
    background-color: #102030;
}

#countdown {
    font-size: 24px;
    font-weight: bold;
    color: #66e0ff;
}

@media (max-width: 750px) {
    #cooldown-container {
        margin-top: 50px;
    }
}

/* ======= Empty messages tab ======= */
#emptyTabimg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    /* Space between image and text */
    width: 100%;
    height: 100%;
    min-height: 200px;
    /* Adjust based on layout */
    color: var(--content-grey);
    /* Use theme color */
    font-size: 1rem;
    margin-top: 80px;
}

#emptyTabimg img {
    width: 200px;
    max-width: 80%;
    opacity: 0.8;
}

#emptyTabimg p {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--light-grey);
}

.logo-link {
    cursor: pointer;
}