/* Sidebar styles */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f172a 100%);
    color: #fff;
    z-index: 2001;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
    transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px 24px 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.sidebar-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1.2px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
    color: #f472b6;
}

.sidebar-list {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    flex: 1;
}

.sidebar-list li {
    margin: 8px 20px;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar-list li:hover {
    transform: translateX(4px);
}

.sidebar-list a {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.sidebar-list a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            rgba(96, 165, 250, 0.1) 0%,
            rgba(167, 139, 250, 0.1) 50%,
            rgba(244, 114, 182, 0.1) 100%);
    transition: left 0.5s ease;
    z-index: -1;
}

.sidebar-list a:hover::before {
    left: 0;
}

.sidebar-list a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #60a5fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(96, 165, 250, 0.2);
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    margin-right: 16px;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.sidebar-list a:hover .sidebar-icon {
    transform: scale(1.1);
    stroke: #60a5fa;
}

.sidebar-text {
    font-weight: 500;
    letter-spacing: 0.3px;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-footer-text {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    opacity: 0.7;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 600px) {
    .sidebar {
        width: 85vw;
        min-width: 260px;
        max-width: 320px;
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.menu-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    font-size: 17px;
    cursor: pointer;
    padding: 5px 9px;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.navbar-title {
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-left: 18px;
    text-align: left;
    flex: 1;
}

.datetime {
    font-size: 13px;
    text-align: end;
    color: #0e005d;
    font-weight: bold;
}

/* Tag Filter Bar */
#tagBar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    padding: 10px 0 0 0;
}

.tag-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
}

.tag-btn:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Main Content */
.main-content {
    margin-top: 0px;
    padding: 20px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Post Grid */
.posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
    padding: 20px 0;
}

/* Post Card */
.post-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    scroll-margin-top: 100px;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.post-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
}

.post-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 6px;
    color: #333;
}

.post-description {
    color: #666;
    line-height: 1.5;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-date {
    color: #8d523b;
    font-size: 10px;
    margin-bottom: 15px;
}

.post-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 6px 13px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-download {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
}

.btn-link {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
}

.btn-more {
    background: linear-gradient(45deg, #FF9800, #F57C00);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    color: #fff;
    background: linear-gradient(135deg, #aa1900, #c03d00);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    position: fixed;
    top: 32px;
    right: 32px;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.close:hover {
    background: linear-gradient(135deg, #aa1900, #f15d19);
    color: #fff;
    transform: scale(1.08) rotate(90deg);
}

.modal-body {
    margin-top: 15px;
    line-height: 1.6;
}

.modal-body h1,
.modal-body h2,
.modal-body h3 {
    margin: 10px 0 5px 0;
    color: #000000;
    font-size: 16px;
}

.modal-body p {
    margin-bottom: 2px;
}

.modal-body code {
    background: #f5f5f5;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1;

}

.modal-body pre {
    background: #f5f5f5bf;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .posts-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .navbar {
        padding: 0 15px;
    }

    .navbar-title {
        font-size: 20px;
    }

    .datetime {
        font-size: 12px;
    }

    .main-content {
        padding: 15px;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }


}


/* Dark Mode Media Query */
@media (prefers-color-scheme: dark) {
    
    /* Navbar Dark Mode */
    .navbar {
        background: rgba(26, 26, 46, 0.95);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    }

    .navbar-title {
        background: linear-gradient(45deg, #60a5fa, #a78bfa);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .datetime {
        color: #94a3b8;
    }

    /* Tag Filter Bar Dark Mode */
    .tag-btn {
        background: rgba(51, 51, 51, 0.8);
        color: #e2e8f0;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .tag-btn:hover {
        background: rgba(71, 71, 71, 0.9);
        border-color: rgba(96, 165, 250, 0.3);
    }

    /* Post Card Dark Mode */
    .post-card {
        background: rgba(30, 30, 46, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    .post-card:hover {
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
        border-color: rgba(96, 165, 250, 0.2);
    }

    .post-image {
        background: linear-gradient(45deg, #2a2a3e, #1a1a2e);
    }

    .post-title {
        color: #e2e8f0;
    }

    .post-description {
        color: #94a3b8;
    }

    .post-date {
        color: #f59e0b;
    }

    /* Buttons Dark Mode */
    .btn-download {
        background: linear-gradient(45deg, #10b981, #059669);
    }

    .btn-link {
        background: linear-gradient(45deg, #3b82f6, #2563eb);
    }

    .btn-more {
        background: linear-gradient(45deg, #f59e0b, #d97706);
    }

    /* Loading Spinner Dark Mode */
    .spinner {
        border: 4px solid #333;
        border-top: 4px solid #60a5fa;
    }

    /* Modal Dark Mode */
    .modal {
        background-color: rgba(0, 0, 0, 0.9);
    }

    .modal-content {
        background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
        color: #e2e8f0;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .close {
        background: linear-gradient(135deg, #dc2626, #ef4444);
    }

    .close:hover {
        background: linear-gradient(135deg, #ef4444, #f87171);
    }

    .modal-body h1,
    .modal-body h2,
    .modal-body h3 {
        color: #f1f5f9;
    }

    .modal-body code {
        background: rgba(51, 51, 51, 0.6);
        color: #60a5fa;
    }

    .modal-body pre {
        background: rgba(20, 20, 30, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #e2e8f0;
    }

    /* Sidebar is already dark, but enhance for consistency */
    .sidebar {
        background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 50%, #0a0a15 100%);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar-overlay.active {
        background: rgba(0, 0, 0, 0.6);
    }
}

/* Optional: Manual dark mode toggle class */
/* Add this class to body element for manual dark mode control */
body.dark-mode {
    background: #0f172a;
    color: #e2e8f0;
}

body.dark-mode .navbar {
    background: rgba(26, 26, 46, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .navbar-title {
    background: linear-gradient(45deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .datetime {
    color: #94a3b8;
}

body.dark-mode .tag-btn {
    background: rgba(51, 51, 51, 0.8);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .tag-btn:hover {
    background: rgba(71, 71, 71, 0.9);
}

body.dark-mode .post-card {
    background: rgba(30, 30, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

body.dark-mode .post-description {
    color: #94a3b8;
}

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

body.dark-mode .modal-content {
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .modal-body h1,
body.dark-mode .modal-body h2,
body.dark-mode .modal-body h3 {
    color: #f1f5f9;
}

body.dark-mode .modal-body code {
    background: rgba(51, 51, 51, 0.6);
    color: #60a5fa;
}

body.dark-mode .modal-body pre {
    background: rgba(20, 20, 30, 0.8);
    color: #e2e8f0;
}