/* ======================== */
/* Post Detail Page Styles  */
/* ======================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-detail-page {
    /* Add padding to clear the fixed header */
    padding-top: 150px;
    padding-bottom: 80px;
    animation: fadeInUp 0.6s ease-out;
}

.post-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 30px;
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.03) 0%, rgba(131, 56, 236, 0.03) 100%);
    border-radius: var(--border-radius);
    border: 1px solid rgba(58, 134, 255, 0.1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.dark-mode .post-header {
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.08) 0%, rgba(131, 56, 236, 0.08) 100%);
    border-color: rgba(131, 56, 236, 0.2);
}

.post-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: slideRight 2s infinite;
}

@keyframes slideRight {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleInSmooth {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes highlightGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(58, 134, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(58, 134, 255, 0.6);
    }
}

@keyframes smoothBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.post-header .btn-back {
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 6px;
}

.post-header .btn-back:hover {
    background: rgba(58, 134, 255, 0.1);
    transform: translateX(-3px);
}

.post-header .btn-back i {
    margin-right: 8px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.post-header .btn-back:hover i {
    transform: translateX(-5px);
}

.post-header h1 {
    font-size: 3rem;
    color: var(--dark-color);
    margin-bottom: 15px;
    line-height: 1.2;
    animation: fadeInUp 0.8s ease-out 0.1s both;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.dark-mode .post-header h1 {
    color: var(--dark-color);
}

.post-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px 25px;
    color: var(--dark-color);
    font-size: 0.9rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
    font-weight: 500;
}

.dark-mode .post-meta {
    color: var(--gray-color);
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s ease;
}

.post-meta span:hover {
    transform: translateY(-2px);
}

.post-meta span i {
    color: var(--primary-color);
    font-size: 1rem;
}

.dark-mode .post-meta span i {
    color: var(--primary-color);
}

.post-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin: 40px 0;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.8s ease-out 0.3s both;
    transition: all 0.3s ease;
    cursor: pointer;
}

.post-image:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 50px rgba(58, 134, 255, 0.2);
}

.post-body {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--dark-color);
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.dark-mode .post-body {
    color: #ffffff;
}

.post-body p {
    color: var(--dark-color);
}

.dark-mode .post-body p {
    color: #ffffff;
}

.post-body li {
    color: var(--dark-color);
}

.dark-mode .post-body li {
    color: #ffffff;
}

/* Styles for your actual content */
.post-body h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 40px 0 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    transition: all 0.3s ease;
    animation: slideInFromLeft 0.6s ease-out;
    position: relative;
}

.post-body h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--primary-color), transparent);
    transition: width 0.6s ease;
}

.post-body h2:hover::after {
    width: 100%;
}

.dark-mode .post-body h2 {
    color: #4dabf7;
    border-bottom-color: #4dabf7;
}

.post-body h2:hover {
    padding-left: 10px;
    transform: translateX(5px);
}

.post-body h3 {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin: 30px 0 15px;
    position: relative;
    padding-left: 15px;
    animation: slideInFromLeft 0.5s ease-out;
    transition: all 0.3s ease;
}

.post-body h3:hover {
    padding-left: 20px;
}

.post-body h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

.dark-mode .post-body h3 {
    color: #e0e0e0;
}

.post-body p {
    margin-bottom: 25px;
    transition: transform 0.3s ease;
}

.post-body p strong {
    color: var(--primary-color);
    font-weight: 700;
}

.post-body ul,
.post-body ol {
    margin-bottom: 25px;
    padding-left: 30px;
}

.post-body li {
    margin-bottom: 15px;
    transition: all 0.3s ease;
    line-height: 1.8;
    animation: fadeInUp 0.6s ease-out backwards;
}

.post-body li:nth-child(1) { animation-delay: 0.1s; }
.post-body li:nth-child(2) { animation-delay: 0.2s; }
.post-body li:nth-child(3) { animation-delay: 0.3s; }
.post-body li:nth-child(4) { animation-delay: 0.4s; }
.post-body li:nth-child(5) { animation-delay: 0.5s; }
.post-body li:nth-child(6) { animation-delay: 0.6s; }
.post-body li:nth-child(n+7) { animation-delay: 0.7s; }

.post-body li:hover {
    transform: translateX(8px);
    color: var(--primary-color);
}

.post-body ul li::marker {
    color: var(--primary-color);
    font-weight: 700;
}

.post-body blockquote {
    margin: 30px 0;
    padding: 25px 30px;
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.05) 0%, rgba(131, 56, 236, 0.05) 100%);
    border-left: 5px solid var(--primary-color);
    border-radius: 6px;
    font-style: italic;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    position: relative;
    transition: all 0.3s ease;
    color: var(--dark-color);
    animation: scaleInSmooth 0.6s ease-out;
}

.dark-mode .post-body blockquote {
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.1) 0%, rgba(131, 56, 236, 0.1) 100%);
    color: #ffffff;
}

.post-body blockquote:hover {
    transform: translateX(5px);
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.1) 0%, rgba(131, 56, 236, 0.1) 100%);
    box-shadow: 0 8px 25px rgba(58, 134, 255, 0.2);
}

.dark-mode .post-body blockquote {
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.1) 0%, rgba(131, 56, 236, 0.1) 100%);
    color: var(--dark-color);
}

.post-body code {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
    color: #d63031;
    font-weight: 600;
    transition: all 0.3s ease;
}

.post-body code:hover {
    background: #d63031;
    color: white;
}

.dark-mode .post-body code {
    background: #2c2c3a;
    color: #ff7f50;
}

.dark-mode .post-body code:hover {
    background: #ff7f50;
    color: #2c2c3a;
}

/* Responsive */
@media (max-width: 768px) {
    .post-detail-page {
        padding-top: 120px;
    }
    
    .post-header h1 {
        font-size: 2.2rem;
    }
    
    .post-body {
        font-size: 1rem;
    }
    
    .post-meta {
        gap: 10px 15px;
        font-size: 0.85rem;
    }
    
    .post-image {
        margin: 30px 0;
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .post-header h1 {
        font-size: 1.8rem;
    }
    
    .post-body h2 {
        font-size: 1.5rem;
    }
    
    .post-body h3 {
        font-size: 1.2rem;
    }
    
    .post-header {
        padding: 25px 20px;
    }
    
    .post-header .btn-back {
        align-self: flex-start;
        margin-bottom: 15px;
    }
}

/* ======================== */
/* Table of Contents Styles */
/* ======================== */

.table-of-contents {
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.05) 0%, rgba(131, 56, 236, 0.05) 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px 25px;
    margin: 30px 0;
    font-size: 0.95rem;
}

.dark-mode .table-of-contents {
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.1) 0%, rgba(131, 56, 236, 0.1) 100%);
}

.table-of-contents h4 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin: 8px 0;
    color: var(--dark-color);
}

.dark-mode .table-of-contents li {
    color: #ffffff;
}

.table-of-contents a {
    color: var(--dark-color);
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
    padding: 5px 0;
}

.dark-mode .table-of-contents a {
    color: #ffffff;
}

.table-of-contents a:hover {
    color: var(--primary-color);
    padding-left: 8px;
}

.table-of-contents .toc-level-2 {
    padding-left: 20px;
    opacity: 0.8;
}

/* ======================== */
/* Share Buttons Styles     */
/* ======================== */

.share-buttons {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.dark-mode .share-buttons {
    border-top-color: #444;
}

.share-buttons h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--dark-color);
    white-space: nowrap;
}

.dark-mode .share-buttons h4 {
    color: #ffffff;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(58, 134, 255, 0.2);
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(58, 134, 255, 0.3);
    background: var(--secondary-color);
}

.share-btn i {
    font-size: 1.1rem;
}

/* ======================== */
/* Copy Code Button Styles  */
/* ======================== */

.copy-code-btn {
    transition: all 0.3s ease !important;
}

.copy-code-btn:hover {
    background: var(--secondary-color) !important;
    transform: scale(1.05);
}

/* ======================== */
/* Viewer Modal Responsive  */
/* ======================== */
.viewer-modal-content {
    width: auto;
    max-width: 90vw;
    height: auto;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
    padding: 0;
    box-shadow: none;
    pointer-events: none;
}

#viewerContent img,
#viewerContent iframe {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    display: block;
    border: none;
    border-radius: var(--border-radius);
    object-fit: contain;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    pointer-events: auto;
}

.viewer-modal-close {
    position: fixed;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    color: #ffffff;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 11001;
    transition: transform 0.3s ease, color 0.3s ease;
}

.viewer-modal-close:hover {
    transform: scale(1.2) rotate(90deg);
    color: #ffffff;
}

/* ======================== */
/* Gallery Styles           */
/* ======================== */

.post-gallery {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 2px solid rgba(58, 134, 255, 0.2);
}

.post-gallery h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2rem;
}

.dark-mode .post-gallery h2 {
    color: #4dabf7;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--light-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 4/3;
}

.dark-mode .gallery-item {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(58, 134, 255, 0.3);
}

.dark-mode .gallery-item:hover {
    box-shadow: 0 8px 25px rgba(77, 171, 247, 0.2);
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-img {
    transform: scale(1.05);
}

.gallery-item figcaption {
    padding: 15px;
    background: var(--light-color);
    color: var(--dark-color);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.4;
}

.dark-mode .gallery-item figcaption {
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
}

/* ======================== */
/* Complete Dark Mode Text  */
/* ======================== */

.dark-mode .post-body strong {
    color: #4dabf7;
}

.dark-mode .post-body ul li::marker {
    color: #4dabf7;
}

.dark-mode .post-body li:hover {
    color: #4dabf7;
}

.dark-mode .post-body em {
    color: #b197fc;
}

.dark-mode .post-body {
    color: #ffffff;
}

.dark-mode .post-body p,
.dark-mode .post-body li {
    color: #ffffff;
}

.dark-mode .post-body h1,
.dark-mode .post-body h2,
.dark-mode .post-body h3,
.dark-mode .post-body h4,
.dark-mode .post-body h5,
.dark-mode .post-body h6 {
    color: #ffffff;
}

/* ======================== */
/* Navigation Buttons       */
/* ======================== */

.navigation-buttons {
    display: flex;
    gap: 15px;
    margin: 50px 0 30px 0;
    flex-wrap: wrap;
}

.navigation-buttons .btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
    animation: slideInUp 0.8s ease-out 0.4s backwards;
}

.navigation-buttons .btn-back:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(131, 56, 236, 0.4);
    border-color: var(--secondary-color);
}

.navigation-buttons .btn-back:active {
    transform: translateY(-1px);
}

.navigation-buttons .btn-back i {
    font-size: 1.1rem;
}

.dark-mode .navigation-buttons .btn-back {
    background: linear-gradient(135deg, rgba(131, 56, 236, 0.8), rgba(58, 134, 255, 0.8));
    box-shadow: 0 4px 15px rgba(131, 56, 236, 0.3);
}

.dark-mode .navigation-buttons .btn-back:hover {
    box-shadow: 0 6px 25px rgba(131, 56, 236, 0.5);
}
/* Responsive Design */
@media (max-width: 992px) {
    .post-detail-page {
        padding-top: 140px;
    }
    
    .post-header {
        padding: 35px 25px;
        margin-bottom: 35px;
    }
    
    .post-header h1 {
        font-size: 2rem;
    }
    
    .post-meta {
        gap: 20px;
        font-size: 0.9rem;
    }
    
    .post-body {
        max-width: 100%;
    }
    
    .post-body h2 {
        font-size: 1.6rem;
        margin-top: 30px;
        margin-bottom: 20px;
    }
    
    .post-body h3 {
        font-size: 1.3rem;
    }
    
    .post-body p {
        font-size: 1rem;
    }
    
    .post-body ul,
    .post-body ol {
        font-size: 1rem;
        margin-left: 30px;
    }
}

@media (max-width: 768px) {
    .post-detail-page {
        padding-top: 130px;
        padding-bottom: 60px;
    }
    
    .post-header {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
    
    .post-header h1 {
        font-size: 1.6rem;
        margin-bottom: 15px;
    }
    
    .post-meta {
        flex-wrap: wrap;
        gap: 12px;
        font-size: 0.85rem;
    }
    
    .post-meta span {
        display: flex;
        align-items: center;
    }
    
    .post-meta span i {
        margin-right: 5px;
    }
    
    .post-body {
        max-width: 100%;
        padding: 0;
    }
    
    .post-body h2 {
        font-size: 1.4rem;
        margin-top: 25px;
        margin-bottom: 15px;
    }
    
    .post-body h3 {
        font-size: 1.15rem;
        margin-top: 20px;
        margin-bottom: 12px;
    }
    
    .post-body p {
        font-size: 0.95rem;
        margin-bottom: 15px;
        line-height: 1.6;
    }
    
    .post-body ul,
    .post-body ol {
        font-size: 0.95rem;
        margin-left: 25px;
        margin-bottom: 15px;
    }
    
    .post-body li {
        margin-bottom: 8px;
    }
    
    .post-body blockquote {
        padding: 15px 20px;
        font-size: 0.95rem;
    }
    
    .post-body code {
        font-size: 0.85rem;
    }
    
    .post-body pre {
        padding: 15px;
        font-size: 0.85rem;
        overflow-x: auto;
    }
    
    .navigation-buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 40px;
    }
    
    .navigation-buttons .btn-back {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .post-detail-page {
        padding-top: 120px;
        padding-bottom: 50px;
    }
    
    .post-header {
        padding: 20px 15px;
        margin-bottom: 25px;
        border-radius: 8px;
    }
    
    .post-header .btn-back {
        padding: 6px 12px;
        font-size: 0.8rem;
        margin-bottom: 15px;
    }
    
    .post-header h1 {
        font-size: 1.3rem;
        margin-bottom: 12px;
        line-height: 1.4;
    }
    
    .post-meta {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 0.8rem;
    }
    
    .post-body {
        padding: 0;
    }
    
    .post-body h2 {
        font-size: 1.2rem;
        margin-top: 20px;
        margin-bottom: 12px;
    }
    
    .post-body h3 {
        font-size: 1rem;
        margin-top: 15px;
        margin-bottom: 10px;
    }
    
    .post-body p {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }
    
    .post-body ul,
    .post-body ol {
        font-size: 0.9rem;
        margin-left: 20px;
        margin-bottom: 12px;
    }
    
    .post-body li {
        margin-bottom: 6px;
    }
    
    .post-body blockquote {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .post-body code {
        font-size: 0.8rem;
    }
    
    .post-body pre {
        padding: 12px;
        font-size: 0.8rem;
    }
    
    .navigation-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 30px;
    }
    
    .navigation-buttons .btn-back,
    .navigation-buttons .btn {
        width: 100%;
        justify-content: center;
        padding: 10px 15px;
        font-size: 0.85rem;
    }
}

@media (max-width: 320px) {
    .post-detail-page {
        padding-top: 110px;
        padding-bottom: 40px;
    }
    
    .post-header {
        padding: 15px 12px;
        margin-bottom: 20px;
        border-radius: 6px;
    }
    
    .post-header .btn-back {
        padding: 5px 10px;
        font-size: 0.75rem;
        margin-bottom: 12px;
    }
    
    .post-header h1 {
        font-size: 1.1rem;
        margin-bottom: 10px;
        line-height: 1.3;
    }
    
    .post-meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.75rem;
    }
    
    .post-meta span {
        word-break: break-word;
    }
    
    .post-body {
        padding: 0;
    }
    
    .post-body h2 {
        font-size: 1rem;
        margin-top: 15px;
        margin-bottom: 10px;
    }
    
    .post-body h3 {
        font-size: 0.95rem;
        margin-top: 12px;
        margin-bottom: 8px;
    }
    
    .post-body p {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .post-body ul,
    .post-body ol {
        font-size: 0.85rem;
        margin-left: 15px;
        margin-bottom: 10px;
    }
    
    .post-body li {
        margin-bottom: 5px;
    }
    
    .post-body blockquote {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .post-body code {
        font-size: 0.75rem;
    }
    
    .post-body pre {
        padding: 10px;
        font-size: 0.75rem;
    }
    
    .navigation-buttons {
        flex-direction: column;
        gap: 6px;
        margin-top: 25px;
    }
    
    .navigation-buttons .btn-back,
    .navigation-buttons .btn {
        width: 100%;
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    /* Gallery Responsive */
    .post-gallery {
        margin-top: 40px;
        padding-top: 30px;
        border-top: 1px solid rgba(58, 134, 255, 0.2);
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-item {
        aspect-ratio: auto;
    }

    .gallery-item figcaption {
        font-size: 0.85rem;
        padding: 8px;
    }
}