/* styles/article-detail.css */

.article-detail-container {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-top: 2rem;
}

.article-detail-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    position: static;
}

.article-detail-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-top: 1rem;
}

.dark-mode .article-detail-header h1 {
    color: #a5d6a7;
}

.article-meta-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.author-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.table-of-contents {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 2rem;
    transition: all 0.3s ease-in-out;
}

#toc-toggle-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

#toc-toggle-btn i {
    transition: transform 0.3s ease;
}

#toc-toggle-btn.open i {
    transform: rotate(180deg);
}

#toc-list {
    list-style: none;
    padding: 0 1rem; /* Removed vertical padding */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

#toc-list li:first-child a {
    padding-top: 1rem;
}

#toc-list li:last-child a {
    padding-bottom: 1rem;
}


#toc-list li a {
    display: block;
    padding: 0.5rem;
    text-decoration: none;
    color: var(--accent-color);
    border-radius: 5px;
}

#toc-list li a:hover {
    background-color: var(--card-bg);
}

.article-body h2 {
    color: var(--secondary-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.dark-mode .article-body h2 {
    color: #8db8a2;
}

.article-body p {
    line-height: 1.7;
    margin-bottom: 1rem;
}

.jump-to-toc-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.jump-to-toc-btn.visible {
    opacity: 1;
    visibility: visible;
}

.jump-to-toc-btn:hover {
    background-color: var(--accent-color);
    color: white;
    transform: translateY(-2px);
}

.also-read-section {
    margin-top: 3rem;
    padding-top: 2rem;
    margin-bottom: 3rem; /* Added space before footer */
}

.also-read-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--secondary-color);
}

.dark-mode .also-read-section h2 {
    color: #a5d6a7;
}

.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.comments-section h2 {
    margin-bottom: 1.5rem;
}

.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    resize: vertical;
    background-color: var(--bg-color); /* Adapts to theme */
    color: var(--text-color); /* Adapts to theme */
}

.comment-form textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
    outline: none;
}

.comment-form .btn {
    float: right;
}

.comment-list {
    margin-top: 3rem;
}

.comment {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.comment img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Hide "Try it Yourself" button on this page */
.article-detail-container .try-btn,
.also-read-section .try-btn {
    display: none !important;
}
