/* BASE_DIR/blog_app/static/blog_app/css/styles.css */

:root {
  --gray-900: #0D0D0D;
  --gray-800: #1A1A1A;
  --gray-700: #2E2E2E;
  --gray-600: #4D4D4D;
  --gray-500: #7A7A7A;
  --gray-400: #A6A6A6;
  --gray-300: #CCCCCC;
  --gray-200: #E6E6E6;
}

/* ---------- base.html ---------- */
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
    /* adapte la valeur à la hauteur de ta navbar */
    scroll-margin-top: 5rem;
}

ul, ol {
    padding-left: 1rem;
}

a {
    color: whitesmoke;
}

a:visited {
  color: lightgreen; /* quand le lien a été cliqué */
}

body{
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: monospace, sans-serif;
}

header {
    position: sticky;
    top: 0;
    z-index: 2000;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: static;
    background-color: #333;
    color: white;
    padding: 0.1rem;
}

svg {
    width: 4rem;
    height: 4rem;
    /* outline: 1px dashed lime; */
}

svg > path {
    fill: #fff;
}

.icons-container {
    display: flex;
}

#back-btn {
    display: none;
}

.menu {
    display: flex;
    align-items: center;
    flex-direction: column;
    /* gap: 1rem; */
    list-style: none;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #333;
    border-radius: 0 0 0.5rem 0.5rem;
    z-index: 1000;
    padding-left: 0;
}

/* start submenu-detail */
.submenu-detail {
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 0.1rem solid black;
    padding: 0.2rem;
    gap: 0.4rem;
    list-style: none;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #333;
    border-radius: 0 0 0.5rem 0.5rem;
    font-size: small;
    z-index: 900;
}

.submenu-detail > li {
    display: flex;
    justify-content: center;
    align-items: center;
}

.submenu-detail .icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.submenu-detail .icon {
    width: 2rem;
    height: 2rem;
}

/* end submenu-detail */

.hidden {
    display: none;
}

#logo-btn, #back-btn, .menu-toggle, .submenu-toggle, .icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    /* outline: 1px dashed red; */
    background: none;
    border: none;
    cursor: pointer;
    appearance: none;
    height: 100%;
}

.menu li {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 3rem;
    width: 100%;
    border-top: 0.1rem solid black;
}

.menu a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: x-large;
    font-weight: bold;
    min-height: 3rem;
}

.menu a.login-btn {
    color: #0D0D0D;
}

.menu a:hover{
    text-decoration: underline;
}

.select-lang {
    font-size: large;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* start user dropdown menu */

.login-btn {
    background-color: var(--gray-200);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.dropdown {
    position: relative;
    display: inline-block;
    z-index: 1000;
}

a.drop-btn {
    font-weight: normal;
    font-size: medium;
    background-color: #3498db;
    color: white;
    padding: 0.5rem 1rem;
    cursor: pointer;
    text-decoration: none;
    border-radius: 0.5rem;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    border-radius: 0 0 0.5rem 0.5rem;
    z-index: 1001;
}

.dropdown-content a {
  color: black;
  font-size: medium;
  padding: 0.5rem;
  text-decoration: none;
  display: block;
}

.drop-btn.active {
    border-radius: 0.5rem 0.5rem 0 0;
}

.dropdown-content a:hover {
  background-color: lightgray;
  border-radius: 0.5rem;
}

.dropdown-content.show {
  display: block;
}

/* end user dropdown menu */

main{
    flex: 1;
    background-color: var(--gray-800);
    display: flex;
    justify-content: center;
}

.container{
    padding: 0.5rem;
    width: 100%;
    background-color: var(--gray-900);
    color: white;
}

footer{
    background-color: #222;
    color: #ddd;
    text-align: center;
    padding: 1rem;
}

/* ---------- Home Page ---------- */
.hero-content {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.home-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-posts-container {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-radius: 0.5rem;
    justify-content: center;
}

#post-card-home {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background-color: var(--gray-800);
    border: 0.1rem solid white;
    border-radius: 0.5rem;
    width: 100%;
    height: 8rem;
}

/* ---------- post_list.html ---------- */

.post-list-container {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#search-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0 auto;
    width: 100%;
}

#search-input {
    width: 100%;
    font-size: 1rem;
}

.btn-row {
    display: flex;
    gap: 0.5rem;
}

.btn-row button {
    flex: 1;
    padding: 0.5rem;
    font-size: 1rem;
    background-color: lightblue;
    font-family: monospace;
    margin: 0;
}

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

.post-card > a{
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: white;
    text-decoration: none;
    border: 0.1rem solid whitesmoke;
    border-radius: 0.5rem;
    padding: 1rem;
    background-color: var(--gray-800);
}

/* ---------- post_detail.html ---------- */

.codehilite {
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

.detail-content{
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem;
    grid-column: 1 / 4;
}

.toc-sticky{
    display: none;
}

.toc-list {
    list-style: none;
}

table {
    display: block;
    text-align: left;
    overflow-x: auto;
    width: 100%;
    white-space: nowrap;
}

th {
    background-color: var(--gray-800);
}

th, td {
    padding: 0.2rem;
}

tr:nth-child(even) {
    background-color: var(--gray-700);
}

/* ---------- Category List ---------- */
.category-tag-container {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#category-list {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
}

#tag-list-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ---------- Category Detail ---------- */
.category-detail-container {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
}

/* ---------- course_list.html ---------- */
.course-list{
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
}

.course-card a{
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: white;
    font-weight: lighter;
    text-decoration: none;
}

/* ---------- course_detail.html ---------- */
.course-detail-container{
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ---------- login.html, register.html */

.form-title {
    margin-bottom: 1rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

form label {
    font-weight: bold;
    font-size: large;
}

form input, textarea {
    padding: 0.5rem;
    border-radius: 0.5rem;
}

form button {
    width: fit-content;
    font-size: large;
    font-weight: bold;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

@media (min-width: 768px) {

    .container{
        width: 90%;
    }

    /* Search box */
    #search-form {
        width: 75%;
        margin: 0;
    }
    
}

@media (min-width: 1200px) {

    /* ---------- Home ---------- */
    .recent-posts-container {
        flex-wrap: wrap;
        flex-direction: row;
        gap: 1rem;
    }

    #post-card-home {
        width: 32%;
    }

    /* ---------- Base ---------- */
    .container {
        width: 80%;
    }

    /* Desktop menu */
    .icon {
        display: none;
    }

    #submenu-detail {
        display: none;
    }

    .hidden {
        display: flex;
    }

    .menu{
        justify-content: center;
        flex-direction: row;
        position: relative;
        width: auto;
        gap: 1rem;
    }

    .menu li {
        width: fit-content;
        border: none;
    }

    .navbar {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        gap: 1rem;
    }

    /* Right side toc */
    .post-detail-container {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }

    .detail-content {
        grid-column: 1 / 4;
    }

    .title {
        grid-column: 1 / 4;
    }

    .toc-fix {
        grid-column: 1 / 4;
    }

    .toc-sticky {
        position: sticky;
        top: 10%;
        overflow-y: auto;
        height: fit-content;
        display: flex;
        flex-direction: column;
        align-items: center;
        grid-column: 4 / 5;
        margin: 0 auto;
        z-index: 10;
    }

    /* Search box */
    #search-form {
        width: 50%;
        margin: 0;
    }
}