/* ================= Base Page Setup ================= */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #e8fdf5;
    color: white;
    min-height: 100vh;
}

/* ================= Header / Navbar Styling ================= */
header {
    background-color: #0b1a30;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-dot {
    width: 24px;
    height: 24px;
    background-color: #5ce1b6;
    border-radius: 50%;
}

.logo-text {
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    color: white;
}

nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

nav a {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 16px;
    transition: color 0.2s ease, background-color 0.2s ease;
    border-radius: 6px;
}

nav a:hover, nav a.active {
    color: #5ce1b6;
    background-color: rgba(92, 225, 182, 0.08);
}

.auth-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-icon {
    width: 38px;
    height: 38px;
    background-color: #cbd5e1;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.profile-icon:hover {
    background-color: #5ce1b6;
}

.profile-icon svg {
    width: 22px;
    height: 22px;
    fill: #475569;
}

.sign-in-btn {
    background-color: #4a7c74;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.sign-in-btn:hover {
    background-color: #5ce1b6;
    color: #0b1a30;
}

/* ================= Two-Column Forum Grid ================= */
.forum-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

/* Sidebar Styling */
.forum-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.new-post-btn {
    background-color: #5ce1b6;
    color: #0b1528;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-post-btn:hover {
    background-color: #4fe0a5;
}

.category-card {
    background-color: #ffffff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.category-card h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: #94a3b8;
    border-bottom: 2px dashed #1e293b;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #000000;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s, color 0.2s;
}

.category-list li:hover, .category-list li.active {
    background-color: rgba(0,0,255,0.9);
    color: #ffffff;
}

/* Main Stream Column */
.forum-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.forum-search-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 30px;
    padding: 4px 6px;
    gap: 6px;
    width: 100%;
}

#forum-search-input {
    flex: 2;
    border: none;
    outline: none;
    padding: 0 16px;
    height: 40px;
    font-size: 0.95rem;
}

.search-dropdown {
    flex: 1;
    height: 40px;
    border: none;
    outline: none;
    background-color: #f8fafc;
    border-left: 1px solid #e2e8f0;
    padding: 0 10px;
    font-size: 0.88rem;
    color: #475569;
    cursor: pointer;
    border-radius: 0;
}

.search-dropdown:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.forum-search-box .search-btn {
    background-color: #5ce1b6;
    color: #0b1a30;
    border: none;
    border-radius: 20px;
    height: 40px;
    padding: 0 20px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

/* Thread Item Styling */
.thread-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.thread-item {
    background-color: #ffffff;
    padding: 24px;
    border-radius: 16px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}

.thread-item:hover {
    border-color: #4a7c74;
    transform: translateY(-2px);
}

.thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.thread-tag {
    font-size: 0.8rem;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 20px;
}

.tag-programming { background-color: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.tag-network { background-color: rgba(239, 68, 68, 0.2); color: #ef4444; }
.tag-general { background-color: rgba(168, 85, 247, 0.2); color: #a855f7; }

.thread-time {
    font-size: 0.8rem;
    color: #64748b;
}

.thread-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: black;
}

.thread-excerpt {
    color: #94a3b8;
    line-height: 1.5;
    margin: 0 0 15px 0;
    font-size: 0.95rem;
}

.thread-footer {
    display: flex;
    font-size: 0.85rem;
    color: #64748b;
}

/* ================= Modal Backdrop System ================= */
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 26, 48, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: #ffffff;
    color: #0b1528;
    padding: 35px 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 35px rgba(0,0,0,0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 26px;
    font-weight: bold;
    color: #94a3b8;
    cursor: pointer;
}

.close-btn:hover {
    color: #0b1a30;
}

/* Forms inside modal */
.modal h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #0b1a30;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: bold;
    font-size: 0.9rem;
    color: #475569;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    font-size: 0.95rem;
}

.form-group textarea {
    resize: none;
    font-family: Arial, sans-serif;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #5ce1b6;
}

.modal-submit-btn {
    width: 100%;
    padding: 14px;
    background-color: #4a7c74;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-submit-btn:hover {
    background-color: #5ce1b6;
    color: #0b1528;
}

.modal-footer-link {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #64748b;
}

.modal-footer-link a {
    color: #5ce1b6;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

.modal-footer-link a:hover {
    text-decoration: underline;
}

/* ================= Detail Thread replies view inside modal ================= */
.thread-modal-content {
    max-width: 700px;
}

.detail-title {
    color: #0b1528 !important;
    text-align: left !important;
    margin-top: 10px !important;
}

.detail-body {
    line-height: 1.6;
    font-size: 1.05rem;
    color: #334155;
    margin: 15px 0 25px 0;
}

.divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 20px 0;
}

.replies-stream {
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 10px;
}

.reply-item {
    background-color: #f8fafc;
    border-left: 4px solid #5ce1b6;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.reply-meta {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 6px;
}

.reply-text {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Submit reply form */
.reply-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reply-form textarea {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    resize: none;
    outline: none;
}

.reply-form textarea:focus {
    border-color: #5ce1b6;
}

.reply-submit-btn {
    align-self: flex-end;
    background-color: #4a7c74;
    color: white;
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reply-submit-btn:hover {
    background-color: #5ce1b6;
    color: #0b1528;
}

/* ================= Responsive Adjustment ================= */
@media (max-width: 850px) {
    .forum-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .forum-search-box {
        flex-direction: column;
        border-radius: 12px;
        background: transparent;
        border: none;
        padding: 0;
    }
    #forum-search-input, .search-dropdown, .forum-search-box .search-btn {
        width: 100%;
        border-radius: 8px !important;
        border: 1px solid #cbd5e1;
        background: #ffffff;
    }
}

/* ================= High Contrast Text Colors ================= */
/* Darkened topic description text from faint gray to legible dark slate */
.forum-preview, 
.thread-excerpt,
.topic-view-details {
    color: #334155 !important;
    font-weight: 500;
}

/* Darkened metadata (author names, timestamps, comment counts) */
.post-meta, 
.thread-time,
.card-footer,
.reply-meta {
    color: #475569 !important;
    font-weight: 600;
}

/* Darkened section headers & search inputs */
.sidebar-title,
.category-card h3 {
    color: #1e293b !important;
    font-weight: 700;
}

.search-input, 
.search-select {
    color: #0f172a !important;
}

.search-input::placeholder {
    color: #64748b !important;
}

/* ================= Responsive Layout (Phone & Laptop) ================= */
@media (max-width: 768px) {
    /* Responsive Header & Navigation */
    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        text-align: center;
    }

    nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 12px;
    }

    nav a {
        margin: 0;
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .auth-container {
        width: 100%;
        justify-content: center;
    }

    /* Single-Column Stack for Mobile Screens */
    .forum-grid, 
    .forum-container {
        grid-template-columns: 1fr !important;
        gap: 20px;
        margin: 20px auto;
        padding: 0 15px;
    }

    /* Stack Search Controls on Mobile Devices */
    .search-container, 
    .forum-search-box {
        flex-direction: column;
        border-radius: 16px;
        padding: 12px;
        gap: 10px;
    }

    .search-input, 
    .search-select, 
    .btn-search {
        width: 100%;
        border-left: none !important;
        border-radius: 10px !important;
        box-sizing: border-box;
    }

    .btn-search {
        justify-content: center;
    }
    
}

/* --- Footer Styles --- */
footer {
    background-color: #0b1a30; 
    color: #ffffff;
    padding: 40px 20px 20px;
    margin-top: 50px;
}
.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    gap: 30px;
}
.footer-brand p { color: #94a3b8; font-size: 0.95rem; }
.footer-links h4 { color: #ffffff; margin-bottom: 15px; }
.footer-links a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    margin-bottom: 10px;
    transition: color 0.2s;
}
.footer-links a:hover { color: #64efbc; }
.footer-bottom {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #1e293b;
    color: #64748b;
    font-size: 0.9rem;
}

/* ================= Forum Reply Avatar Fix ================= */
/* forum.php's inline .rdt-avatar is only 22px, making profile pictures
   and initials hard to see. Sized up here without touching forum.php's layout. */
.rdt-avatar {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.9rem !important;
}