/* Layout */

.app {
    display: flex;
    min-height: 100vh;
    background: #f7f8fa;
}

form {
    display: flex;
    width: 100%;
}

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


.sidebar {
    width: 350px;
    background: #fff;
    border-right: 1px solid #e5e5e5;
    padding: 24px 16px;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.content-section{
    flex: 1;
    padding: 0.5rem 1rem;
}


/* Sidebar elements */
.post-image-wrapper {
    display: block;
    width: 100%;
    height: 20rem;
    margin: 0 auto;
    object-fit: cover;
    background: #fafafa;
    cursor: var(--cursor-pointer);
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    color: #333;
    margin-top: 8px;
    transition: background 0.2s, border-color 0.2s;
}

.post-image-wrapper:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    border: 1px solid #adb5bd;
}

.post-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.status .btn {
    width: 90px;
}

.tags {
    min-height: 38px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fafbfc;
    padding: 8px;
    font-size: 1.4rem;
    outline: none;
    transition: border-color 0.2s;
}

.tags:focus {
    border-color: #007bff;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    background: #e9ecef;
    color: #495057;
    border-radius: 16px;
    padding: 4px 10px 4px 12px;
    margin: 0 6px 6px 0;
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.5;
    transition: background 0.2s;
}

.tag-item:hover {
    background: #dee2e6;
}

.tag-text {
    margin-right: 6px;
}

.tag-remove {
    cursor: pointer;
    color: #888;
    font-size: 1.1em;
    margin-left: 2px;
    transition: color 0.2s;
    user-select: none;
}

.tag-remove:hover {
    color: #dc3545;
}
.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}
.attachment-item:last-child {
    border-bottom: none;
}
.attachment-name {
    flex: 1;
    font-size: 1.2rem;
    font-weight: 500;
    color: #333;
    width: 80px;
    text-overflow: ellipsis;
    overflow: hidden;
}
.attachment-type {
    color: #888;
    font-size: 0.95em;
}
.attachment-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}
.attachment-remove:hover {
    background: #f8d7da;
}
input[name="title"] {
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.post__status-container {
    display: flex;
    gap: 1rem;
}

/* Content area */
.post-content {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 0;
    background: #fff;
    margin-bottom: 1rem;
}

#toolbar {
    border-bottom: 1px solid #e5e5e5;
    border-radius: 6px 6px 0 0;
    background: #f8f9fa;
    padding: 8px;
}

#editor {
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fafbfc;
    min-height: 220px;
    padding: 16px;
    transition: border-color 0.2s;
}

#editor:focus-within {
    border-color: #007bff;
    background: #fff;
}

.btn-group-wrapper {
   display: flex;
   gap: 8px;
}

.btn-primary {
    background: #007bff;
    border: none;
    color: #fff;
    padding: 8px 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #0056b3;
}

.form-label{
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.6rem;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fafbfc;
    color: #222;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    outline: none;
    margin-bottom: 0.5rem;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.08);
    background: #fff;
}


.btn.btn-outline-success,
.btn.btn-outline-danger {
    border: 1px solid #ced4da;
    background: #fff;
    color: #222;
    border-radius: 4px;
    padding: 6px 18px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

input[type="radio"].btn-check:checked+.btn.btn-outline-success {
    background: #d1e7dd;
    color: #198754;
    border-color: #198754;
}

input[type="radio"].btn-check:checked+.btn.btn-outline-danger {
    background: #f8d7da;
    color: #dc3545;
    border-color: #dc3545;
}

.btn.btn-outline-success:hover,
.btn.btn-outline-danger:hover {
    background: #f1f3f5;
    border-color: #007bff;
    color: #007bff;
}

/* Style the tags input */
#tags.form-control {
    min-height: 38px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fafbfc;
    padding: 8px;
    outline: none;
    transition: border-color 0.2s;
}

#tags.form-control:focus {
    border-color: #007bff;
}

/* Get post detail style */

.post-container{
    font-size: 1.6rem;
    display: flex;
    align-items: stretch;
    max-width: 1200px;
    margin: 20px auto;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border-radius: 8px;
    overflow: visible; 
}

.main-content {
    flex: 3;
    padding: 20px;
    min-width: 0;
}

.cover-image {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 24px;
}
.title {
    font-size: 2.5rem;
    margin-bottom: 12px;
    font-weight: bold;
}
.meta {
    color: #888;
    font-size: 1.6rem;
    margin-bottom: 8px;
}
.tags {
    margin-bottom: 18px;
}
.tag {
    display: inline-block;
    background: #e3e8ef;
    color: #3b4252;
    border-radius: 12px;
    padding: 4px 12px;
    font-size: 1.4rem;
    margin-right: 8px;
    margin-bottom: 4px;
}
.description {
    font-size: 1.8rem;
    margin-bottom: 24px;
    text-align: center;
    padding: 0.5rem;
    background-color: #f1f3f5;
    color: #222;
}
.content {
    font-size: 1.6rem;
    line-height: 1.7;
    color: #222;
    height: fit-content !important;
}

.toc{
    border-left: 1px solid #e0e0e0;
    min-width: 220px;
    max-width: 300px;
}
.toc-wrapper {
    padding: 1rem 0.5rem;
    overflow-y: auto;
    max-height: 90vh;
}

.toc h3 {
    font-size: 1.6rem;
    margin-bottom: 16px;
    color: #333;
}
.toc ul {
    list-style: none;
    margin: 1rem;
}
.toc li {
    margin-bottom: 10px;
}
.toc a {
    color: #1976d2;
    text-decoration: none;
    font-size: 1.6rem;
}
.toc a:hover {
    text-decoration: underline;
}

.top-link {
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 1000;
}
/* CSS for posts page */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background: linear-gradient(135deg, #f8fafc 0%, var(--light-green-bg) 100%);
    color: #333;
}

.container {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 15px;
    padding-right: 15px;
}

/* Basic media queries for mobile and tablet */
@media (max-width: 768px) {

    .sidebar {
        padding: 16px 8px;
    }
    .main-content {
        padding: 0 0.5rem;
    }
    .toc-wrapper {
        padding: 0 0.5rem;
    }
    .post-container {
        margin: 16px 0;
        border-radius: 0;
    }
    .cover-image {
        max-height: 180px;
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    .app,
    form {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
        box-shadow: none;
    }
    .main-content{
        font-size: 1.6rem;
        padding: 0 0.5rem;
    }
    .title {
        font-size: 2.2rem;
    }
    .description{
        font-size: 1.6rem;
    }
    .content {
        padding: 0.5rem;
    }

    .content img{
        max-width: 100% !important;
        height: auto !important;
        margin: 1.5rem 0;
        border: 0;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }
    .content-section{
        padding: 0.5rem 0.4rem;
    }
    .form-section:last-of-type{
        margin-bottom: 4rem;
    }

    .post-container {
        flex-direction: column;
        flex-flow: column-reverse;
    }
    .toc {
        border-left: none;
        border-top: 1px solid #e0e0e0;
        min-width: unset;
        max-width: unset;
    }
    .toc-wrapper{
        padding: 0.5rem;
    }
    .filter-select {
        min-width: 120px;
    }
    .toc a {
        font-size: 1.4rem;
    }
}