* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark-mode {
    color: #e0e0e0;
    background-color: #1a1a1a;
}

header {
    background: transparent;
    color: #333;
    padding: 0.5rem 1rem;
    position: relative;
    overflow: hidden;
}

header::before {
    display: none;
}

@keyframes drift {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(1deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(-1deg);
    }
}

body.dark-mode header {
    background: transparent;
}

body.dark-mode header::before {
    display: none;
}

/* Dynamic background image styles */
header[style*="background-image"] {
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
}

header[style*="background-image"]::before {
    display: none; /* Remove overlay when using Pexels image */
}

.header-content {
    max-width: 1200px;
    margin: 2rem auto 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 2rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

body.dark-mode .header-content {
    background: rgba(0, 0, 0, 0.85);
    color: white;
}

.header-logo {
    max-height: 80px;
    width: auto;
    display: block;
}

/* Logout Button */
.btn-logout {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-logout:hover {
    background: #d32f2f;
}

/* Login Link */
.btn-login-link {
    background: #667eea;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-login-link:hover {
    background: #764ba2;
}

.theme-toggle {
    background: rgba(102, 126, 234, 0.2);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.theme-toggle:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

body.dark-mode .sun-icon {
    display: none;
}

body:not(.dark-mode) .moon-icon {
    display: none;
}

.linkedin-link {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
}

.linkedin-link:hover {
    transform: translateY(-50%) scale(1.1);
}

.linkedin-link svg {
    width: 40px;
    height: 40px;
    fill: #0077B5;
}

body.dark-mode .linkedin-link svg {
    fill: #0a8bc2;
}


header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

main {
    max-width: 1200px;
    min-width: 320px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
    width: 100%;
}

#timeline-container {
    margin-top: 2rem;
    position: relative;
    z-index: 5;
    width: 100%;
}

.add-blog-button {
    text-align: center;
    margin-bottom: 2rem;
}

.btn-add-blog {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.btn-add-blog:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

body.dark-mode .btn-add-blog {
    background: #764ba2;
}

body.dark-mode .btn-add-blog:hover {
    background: #667eea;
}

.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: #ddd;
    z-index: 0;
}

body.dark-mode .timeline::before {
    background: #444;
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    width: calc(50% - 2rem);
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
    padding-right: 2rem;
}

.timeline-item:nth-child(even) {
    left: 50%;
    padding-left: 2rem;
}

.timeline-dot {
    position: absolute;
    top: 0;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    border: 3px solid #f4f4f4;
    box-shadow: 0 0 0 3px #ddd;
    z-index: 2;
}

body.dark-mode .timeline-dot {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px #444;
}

.timeline-item:nth-child(odd) .timeline-dot {
    position: absolute;
    right: -42px;
}

.timeline-item:nth-child(even) .timeline-dot {
    position: absolute;
    left: -10px;
}

.timeline-content {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

/* Delete button for blogs */
.delete-blog-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    line-height: 1;
}

.delete-blog-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.timeline-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    margin: 0 0 1rem 0;
}

body.dark-mode .timeline-content {
    background: #2d2d2d;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.timeline-content:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

body.dark-mode .timeline-content:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.timeline-content h3 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.timeline-content .date {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

body.dark-mode .timeline-content .date {
    color: #999;
}

.timeline-content .snippet {
    color: #555;
    line-height: 1.8;
    margin-bottom: 1rem;
}

body.dark-mode .timeline-content .snippet {
    color: #bbb;
}

.read-more {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: #764ba2;
}

/* Article Admin Controls */
.article-admin-controls {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.article-admin-controls .btn-edit,
.article-admin-controls .btn-delete {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.article-admin-controls .btn-edit {
    background: #667eea;
    color: white;
}

.article-admin-controls .btn-edit:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

.article-admin-controls .btn-delete {
    background: #f44336;
    color: white;
}

.article-admin-controls .btn-delete:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

#article-display {
    max-width: 1200px;
    min-width: 320px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100% !important;
    box-sizing: border-box;
}

#article-display .article-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

body.dark-mode #article-display .article-container {
    background: #2d2d2d;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

#back-to-timeline {
    background: #667eea;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

#back-to-timeline:hover {
    background: #764ba2;
}

#article-content {
    width: 100%;
}

/* Typography and spacing for all heading levels */
#article-content h1,
#article-content h2,
#article-content h3,
#article-content h4,
#article-content h5,
#article-content h6 {
    color: #333;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

#article-content h1 { font-size: 2.5rem; }
#article-content h2 { font-size: 2rem; }
#article-content h3 { font-size: 1.75rem; }
#article-content h4 { font-size: 1.5rem; }
#article-content h5 { font-size: 1.25rem; }
#article-content h6 { font-size: 1.1rem; }

/* Dark mode headings */
body.dark-mode #article-content h1,
body.dark-mode #article-content h2,
body.dark-mode #article-content h3,
body.dark-mode #article-content h4,
body.dark-mode #article-content h5,
body.dark-mode #article-content h6 {
    color: #e0e0e0;
}

/* Article metadata */
#article-content .article-date {
    color: #666;
    margin-bottom: 2rem;
    font-style: italic;
}

body.dark-mode #article-content .article-date {
    color: #999;
}

/* Paragraphs */
#article-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: #444;
    font-size: 1.05rem;
}

body.dark-mode #article-content p {
    color: #ccc;
}

/* Lists */
#article-content ul,
#article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

#article-content ul li,
#article-content ol li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
    color: #444;
}

body.dark-mode #article-content ul li,
body.dark-mode #article-content ol li {
    color: #ccc;
}

#article-content ul ul,
#article-content ul ol,
#article-content ol ul,
#article-content ol ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Code blocks */
#article-content pre {
    background: #f8f8f8;
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.6;
}

#article-content pre {
    border-left: 4px solid #667eea;
}

body.dark-mode #article-content pre {
    background: #1a1a1a;
    border-color: #444;
    border-left-color: #764ba2;
}

#article-content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: inherit;
    font-size: inherit;
}

/* Inline code */
#article-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    color: #d14;
}

body.dark-mode #article-content code {
    background: #3a3a3a;
    color: #f8b500;
}

/* Links */
#article-content a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

#article-content a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

body.dark-mode #article-content a {
    color: #a0aef0;
}

body.dark-mode #article-content a:hover {
    color: #c0cef0;
    border-bottom-color: #c0cef0;
}

/* Blockquotes */
#article-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #555;
}

body.dark-mode #article-content blockquote {
    border-left-color: #764ba2;
    color: #aaa;
}

/* Horizontal rules */
#article-content hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 2rem 0;
}

body.dark-mode #article-content hr {
    border-top-color: #444;
}

/* Strong and emphasis */
#article-content strong,
#article-content b {
    font-weight: 600;
    color: #333;
}

body.dark-mode #article-content strong,
body.dark-mode #article-content b {
    color: #e0e0e0;
}

#article-content em,
#article-content i {
    font-style: italic;
}

/* Images within articles */
#article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body.dark-mode #article-content img {
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* First element spacing */
#article-content > :first-child {
    margin-top: 0;
}

/* Last element spacing */
#article-content > :last-child {
    margin-bottom: 0;
}

/* Comments section */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
}

body.dark-mode .comments-section {
    border-top-color: #444;
}

.comments-section h3 {
    color: #667eea;
    margin-bottom: 1.5rem;
}

body.dark-mode .comments-section h3 {
    color: #a0aef0;
}

.comment-form {
    margin-bottom: 2rem;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

body.dark-mode .comment-form input,
body.dark-mode .comment-form textarea {
    background: #1a1a1a;
    border-color: #444;
    color: #e0e0e0;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.comment-form textarea {
    min-height: 100px;
    resize: vertical;
}

.comment-form button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.comment-form button:hover {
    background: #764ba2;
}

.comments-list {
    margin-top: 2rem;
}

.comment {
    background: #f8f8f8;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

body.dark-mode .comment {
    background: #1a1a1a;
}

.comment-author {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.5rem;
}

body.dark-mode .comment-author {
    color: #a0aef0;
}

.comment-date {
    font-size: 0.85rem;
    color: #666;
    margin-left: 1rem;
}

body.dark-mode .comment-date {
    color: #999;
}

.comment-text {
    margin-top: 0.5rem;
    line-height: 1.6;
}

.article-hero-image {
    max-width: 100%;
    max-height: 500px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Force consistent layout */
#timeline-container,
#article-display {
    min-height: 500px;
}

/* Prevent layout shift */
main > section {
    width: 100% !important;
}

.hidden {
    display: none;
}

/* Ensure main maintains consistent width */
main {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
}

/* Force body to full width */
html, body {
    width: 100%;
    min-width: 100%;
}

/* Ensure viewport is used */
body {
    width: 100vw;
    overflow-x: hidden;
}

/* Force article display to use full available width */
#article-display:not(.hidden) {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: block;
}


@media (max-width: 500px) {
    /* Mobile styles */
    .timeline::before {
        left: 30px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 60px !important;
        padding-right: 0 !important;
        text-align: left !important;
        left: 0 !important;
    }

    .timeline-dot {
        left: 20px !important;
        right: auto !important;
    }

    header h1 {
        font-size: 2rem;
    }
}