* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #F2F2F2;
    color: #1a1a1a;
    line-height: 1.5;
}

/* Top Header */
.top-header {
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.logo a {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: #1a1a1a;
}

.menu {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.menu a {
    text-decoration: none;
    color: #1a1a1a;
    font-weight: 500;
}

.menu a:hover {
    color: #0066cc;
}

.searchbar {
    display: flex;
    gap: 0.5rem;
}

.searchbar input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.searchbar button {
    background: none;
    border: 1px solid #0066cc;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: #0066cc;
}

/* Global button outline (used in hero and elsewhere) */
.btn-outline {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: 1px solid #0066cc;
    border-radius: 4px;
    text-decoration: none;
    color: #0066cc;
    font-weight: bold;
}

.btn-outline:hover {
    background: #0066cc;
    color: white;
}

/* Timeline layout (used in logged‑in view) */
.timeline-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.main-feed {
    flex: 3;
    min-width: 250px;
}

.right-sidebar {
    flex: 1;
    min-width: 200px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Tabs (global for logged‑in feed) */
.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
}

.tab-btn.active {
    color: #0066cc;
    border-bottom: 2px solid #0066cc;
    margin-bottom: -2px;
}

/* Post Card (used in AJAX feed and post/view) */
.post-card {
    background: white;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.post-card h2 {
    margin: 0.5rem 0;
    font-size: 1.25rem;
}

.post-card h2 a {
    text-decoration: none;
    color: #1a1a1a;
}

.post-card h2 a:hover {
    color: #0066cc;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.tag {
    background: #f0f0f0;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #333;
}

.vote-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    color: #878a8c;
    font-weight: 700;
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}
.vote-btn:hover  { background: #ededed; }
.vote-btn:active { opacity: 0.7; }
.vote-arrow {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #878a8c;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.vote-btn.vote-up .vote-arrow {
    clip-path: polygon(50% 0%, 100% 45%, 68% 45%, 68% 80%, 32% 80%, 32% 45%, 0% 45%);
}
.vote-btn.vote-down .vote-arrow {
    clip-path: polygon(50% 100%, 100% 55%, 68% 55%, 68% 20%, 32% 20%, 32% 55%, 0% 55%);
}
.vote-btn.vote-up:hover .vote-arrow,
.vote-btn.vote-up.voted .vote-arrow { background: #FF4500; }
.vote-btn.vote-up:hover,
.vote-btn.vote-up.voted { background: rgba(255, 69, 0, 0.08); color: #FF4500; }
.vote-btn.vote-down:hover .vote-arrow,
.vote-btn.vote-down.voted .vote-arrow { background: #7193FF; }
.vote-btn.vote-down:hover,
.vote-btn.vote-down.voted { background: rgba(113, 147, 255, 0.08); color: #7193FF; }
.vote-btn:active .vote-arrow { transform: scale(1.25); }

.vote-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #878a8c;
    font-size: 14px;
    text-decoration: none;
}
.vote-meta i.ti-eye { font-size: 18px; }
.vote-meta i.fa-comment { font-size: 16px; }
.vote-meta:hover { color: #878a8c; text-decoration: none; }

/* Load More button */
.btn-load {
    background: none;
    border: 1px solid #0066cc;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    color: #0066cc;
    cursor: pointer;
    font-size: 1rem;
}

.btn-load:hover {
    background: #0066cc;
    color: white;
}

/* Auth forms */
.auth-container {
    max-width: 400px;
    margin: 3rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-container input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.auth-container button {
    width: 100%;
    padding: 0.75rem;
    background: white;
    border: 1px solid #0066cc;
    color: #0066cc;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

.error {
    color: red;
    margin-bottom: 1rem;
}

.article-tag {
    background-color: #F8F8F7;
    color: #6c757d;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
    margin-right: 4px;
    font-weight: 500;
    transition: all 0.2s;
}
.article-tag:hover {
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
}

/* Footer */
footer {
    margin-top: 3rem;
}

.footer-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem;
    background: #F2F2F2;
}

.footer-menu-columns {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
}

.footer-menu-columns ul {
    list-style: none;
}

.footer-menu-columns a {
    text-decoration: none;
    color: #333;
}

.social-icons a {
    margin-right: 1rem;
    text-decoration: none;
    color: #333;
}

.footer-bottom {
    text-align: center;
    padding: 1rem;
    background: #e0e0e0;
    font-size: 0.8rem;
}

/* Single post view */
.post-header {
    background: white;
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.post-content {
    max-width: 800px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    line-height: 1.8;
}

.comments-section {
    max-width: 800px;
    margin: 2rem auto;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
}

.comment {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

/* Sidebar widget (global) */
.sidebar-widget {
    margin-bottom: 1.5rem;
}

.sidebar-widget h3 {
    margin-bottom: 0.5rem;
}

.sidebar-widget ul {
    list-style: none;
}

.sidebar-widget li {
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .top-header {
        flex-direction: column;
        align-items: stretch;
    }
    .timeline-container {
        flex-direction: column;
    }
    .main-feed, .right-sidebar {
        flex: auto;
        width: 100%;
    }
    .footer-top {
        flex-direction: column;
    }
}
/* Additional custom styles not covered by Bootstrap */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background-color: #f8f9fc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
/* Override any Bootstrap quirks */
.card {
    border: none;
}
.navbar .btn-outline-light {
    border-color: rgba(255,255,255,0.5);
    color: white;
}
.navbar .btn-outline-light:hover {
    background: white;
    color: #1a2980;
}
/* Keep footer links */
footer a {
    text-decoration: none;
}
footer a:hover {
    text-decoration: underline;
}

/* Custom Follow Buttons */
.custom-follow-btn {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: #F8F9FC;
    color: #333;
    font-weight: 500;
    transition: background-color 0.2s;
}
.custom-follow-btn:hover, .custom-follow-btn:focus, .custom-follow-btn:active {
    background-color: #E9ECEF;
    color: #111;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Global Post Meta Layout (Matching Mobile Layout) */
.post-meta-wrapper {
    gap: 12px;
    flex-wrap: wrap !important;
}
.post-meta-text {
    display: contents !important;
}
.post-author-line {
    display: flex !important;
    align-items: center !important;
    flex: 1 !important;
}
.post-meta-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.post-author-line .user-link, .post-author-line .text-dark {
    font-size: 1.05rem;
}
.post-badges-line {
    font-size: 0.9rem;
    font-weight: 700;
    width: 100% !important;
    margin-top: 8px !important;
    margin-left: 0 !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    overflow-x: auto !important;
    padding-bottom: 2px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.post-badges-line::-webkit-scrollbar {
    display: none;
}
.post-badges-line a.category-link, .post-badges-line span {
    font-weight: 700;
}

@media (max-width: 768px) {
    /* Mobile Timeline layout changes for author info */
    .sidebar-post-list .post-badges-line {
        font-size: 0.85rem !important; /* Increase a bit on mobile since it has its own line */
    }

    /* Increase size of interaction badges and distance on mobile */
    .vote-bar {
        gap: 0 !important;
        justify-content: space-between !important;
        padding: 12px 4px !important;
        width: 100% !important;
    }
    .vote-bar > * {
        margin: 0 !important;
    }
    .vote-btn, .views, .comments-count, .sidebar-card-more-btn {
        font-size: 1.1rem !important;
        padding: 6px 8px !important;
        gap: 6px !important;
    }
    .vote-btn i, .views i, .comments-count i, .sidebar-card-more-btn i {
        font-size: 1.35rem !important;
    }
    .vote-arrow {
        width: 24px !important;
        height: 24px !important;
    }
    .vote-meta {
        font-size: 16px;
        gap: 6px;
        padding: 6px 12px;
    }
    .vote-meta i.ti-eye { font-size: 20px; }
    .vote-meta i.fa-comment { font-size: 18px; }
    
    /* Increase post badges size on mobile */
    .post-badges-line {
        font-size: 0.95rem;
    }
    .post-badges-line .badge {
        font-size: 0.85rem !important;
        padding: 4px 10px !important;
    }
}

/* ── Sidebar Post Card Tweaks ── */
.sidebar-post-list .article-card {
    margin-bottom: 12px;
}
.sidebar-post-list .article-card .card-body {
    padding: 2px 12px 8px;
}
.sidebar-post-list .article-card .card-title {
    margin-bottom: 8px !important;
}
.sidebar-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

/* ── Three-dots action menu for sidebar cards ── */
.sidebar-card-more-wrap {
    position: relative;
    display: flex;
    justify-content: flex-end;
}
.sidebar-card-more-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink3, #878a8c);
    font-size: 20px;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
/* Optical alignment adjustment for the dots icon */
.sidebar-card-more-btn i {
    transform: translateY(5px);
}
.sidebar-card-more-btn:hover {
    color: var(--ink1, #1a1a1a);
}
.sidebar-card-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    background: var(--surface, #fff);
    border: 1px solid var(--line, #e9ecef);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    min-width: 150px;
    z-index: 50;
    overflow: hidden;
    animation: sidebarDropIn 0.15s ease-out;
}
@keyframes sidebarDropIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.sidebar-card-dropdown.show {
    display: block;
}
.sidebar-card-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--ink1, #1a1a1a);
    white-space: nowrap;
    transition: background 0.15s;
}
.sidebar-card-dropdown-item:hover {
    background: var(--line, #f0f2f5);
}
.sidebar-card-dropdown-item i {
    font-size: 16px;
    width: 18px;
    text-align: center;
    color: var(--ink3, #878a8c);
}