:root {
    --bg-color: #f4f6f8;
    --surface-color: #ffffff;
    --text-main: #2d3748;
    --text-muted: #718096;
    --primary: #4299e1;
    --border-radius: 16px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

/* Navigation */
.top-nav {
    background: var(--surface-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    margin-bottom: 2rem;
}

.top-nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.top-nav a:hover { color: var(--primary); }
.logo { font-size: 1.25rem; font-weight: 600; color: var(--text-main) !important; }

/* Grid Systems */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.blog-masonry {
    column-count: 1;
    column-gap: 1.5rem;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) { .blog-masonry { column-count: 2; } }
@media (min-width: 1024px) { .blog-masonry { column-count: 3; } }

/* Soft Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    break-inside: avoid; /* Essential for Masonry */
    margin-bottom: 1.5rem;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.card h3 { margin-bottom: 0.5rem; font-weight: 600; }
.card p { color: var(--text-muted); font-size: 0.9rem; }

/* Tags */
/* Update your existing .tag class to have a default transparent border */
.tag {
    display: inline-block;
    background: #edf2f7;
    color: var(--text-muted);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    margin-top: 1rem;
    border: 1px solid transparent; /* Added */
}

/* Add the static color cycle classes */
.tag-c0 { border-color: #ef4444; background: #fef2f2; color: #b91c1c; } /* Red */
.tag-c1 { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; } /* Blue */
.tag-c2 { border-color: #10b981; background: #ecfdf5; color: #047857; } /* Green */
.tag-c3 { border-color: #f59e0b; background: #fffbeb; color: #b45309; } /* Orange */
.tag-c4 { border-color: #8b5cf6; background: #f5f3ff; color: #6d28d9; } /* Purple */
.tag-c5 { border-color: #ec4899; background: #fdf2f8; color: #be185d; } /* Pink */

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    background: #f8fafc;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
    background: #ffffff;
}

.btn {
    display: inline-block;
    font-family: inherit;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn:hover {
    background: #3182ce;
}

/* Scrollable Checklist */
.scrollable-checklist {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem;
    background: #f8fafc;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Native HTML Dropdown (for filtering) */
.dropdown-filter {
    position: relative;
}

.dropdown-filter summary {
    list-style: none; /* Hides the default arrow */
    cursor: pointer;
    user-select: none;
}

.dropdown-filter summary::-webkit-details-marker {
    display: none;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    width: 200px;
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 10;
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

/* Comment Tree Styles */
.comment-thread { margin-top: 2rem; }
.comment {
    position: relative;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 1rem;
}
.comment-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.comment-avatar {
    width: 24px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Depths */
.comment-depth-2 { margin-left: 2rem; border-left: 3px solid var(--primary); border-top-left-radius: 4px; border-bottom-left-radius: 4px;}
.comment-depth-3 { margin-left: 4rem; border-left: 3px solid #cbd5e0; border-top-left-radius: 4px; border-bottom-left-radius: 4px;}

/* Blog Card Additions */
.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Inline Reply Form Styles */
.reply-btn {
    background: none; border: none; padding: 0;
    color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 0.25rem;
    margin-top: 0.5rem; transition: color 0.2s;
}
.reply-btn:hover { color: var(--primary); }
.reply-form-container {
    display: none; margin-top: 1rem; gap: 0.5rem;
}

/* Interactive Pin Button */
/* --- Pin Button Styles --- */
.pin-btn {
    background: transparent;
    border: none;
    color: var(--text-muted); /* Default gray outline */
    cursor: pointer;
    transition: color 0.2s ease, transform 0.1s ease;
}

/* Hover effect so they know it's clickable */
.pin-btn:hover {
    color: var(--primary); 
    transform: scale(1.1);
}

/* The active, pinned state: Solid Blue! */
.pin-btn.pinned {
    color: var(--primary); /* Uses your main blue theme color */
}
.pin-btn.pinned:hover { color: #3182ce; }

/* Prevent buttons from wrapping to two lines */
.btn {
    white-space: nowrap; 
}

/* Rich Text Editor Styles */
.editor-content {
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    cursor: text;
}
.editor-content:empty:before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}
.editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Style for the expandable history entries */
.history-item {
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 0;
}

.history-item:last-child {
    border-bottom: none;
}

.history-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-main);
    list-style: none; /* Hide default arrow */
}

.history-summary::-webkit-details-marker {
    display: none;
}

.history-summary:hover {
    color: var(--primary);
}

.history-content-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: #ffffff;
    border: 1px dashed #cbd5e0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.history-badge {
    font-size: 0.7rem;
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Attachment Styles */
.attachment-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s;
}

.attachment-item:hover {
    border-color: var(--primary);
    background: #eff6ff;
    transform: translateY(-1px);
}

.attachment-info {
    display: flex;
    flex-direction: column;
}

.attachment-size {
    font-size: 0.7rem;
    color: var(--text-muted);
}