/* style.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f1f2f3;
    color: #232629;
    line-height: 1.5;
}

/* Header SO Style */
.top-bar {
    /* background-color: #f48024;
     */
     background-color: #2477f4;
    border-top: 3px solid #bc5e15;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-content {
    max-width: 1264px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.logo h1 {
    font-size: 20px;
    font-weight: 400;
    margin: 0;
}

.logo-icon {
    font-size: 24px;
}

.search-bar-fake {
    flex-grow: 1;
    background: white;
    padding: 8px 12px;
    border-radius: 3px;
    color: #838c95;
    font-size: 13px;
    border: 1px solid #e3e6e8;
}

/* Layout Container */
.container {
    display: flex;
    max-width: 1350px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
}

/* Sidebar */
.sidebar {
    width: 200px;
    flex-shrink: 0;
    padding-top: 20px;
}

.sidebar h3 {
    font-size:px;
    color: #525960;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin-bottom: 10px;
}

.sidebar a {
    text-decoration: none;
    color: #525960;
    font-size: 13px;
    padding: 8px;
    display: block;
    border-right: 3px solid transparent;
}

.sidebar a:hover {
    color: #0c0d0e;
}

.sidebar a.active {
    font-weight: bold;
    color: #0c0d0e;
    background: #f1f2f3;
    border-right: 3px solid #f48024;
}

/* Main Content */
.content {
    flex-grow: 1;
    background: white;
    padding: 24px;
    border-radius: 5px;
    border: 1px solid #e3e6e8;
    min-width: 0;
}

.question-header {
    border-bottom: 1px solid #e3e6e8;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.question-header h2 {
    font-size: 27px;
    color: #3b4045;
    margin: 0 0 10px 0;
    font-weight: normal;
}

.post-meta {
    font-size: 13px;
    color: #6a737c;
    display: flex;
    gap: 15px;
}

/* Post Layout (Vote + Body) */
.post-cell {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.vote-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
    flex-shrink: 0;
}

.vote-up,
.vote-down {
    background: none;
    border: none;
    font-size: 20px;
    color: #babfc4;
    cursor: pointer;
}

.vote-up:hover,
.vote-down:hover {
    color: #f48024;
}

.vote-count {
    font-size: 21px;
    color: #6a737c;
    margin: 5px 0;
}

.accepted-check {
    font-size: 30px;
    color: #2e7d32;
    font-weight: bold;
    margin-top: 10px;
}

.post-body {
    flex-grow: 1;
    min-width: 0;
}

.text-content p {
    margin-top: 0;
}

.tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.tag {
    background-color: #e1ecf4;
    color: #39739d;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
}

/* Answer Section */
.answer-section {
    margin-top: 20px;
}

.answer-header {
    border-bottom: 1px solid #e3e6e8;
    margin-bottom: 15px;
    padding-bottom: 5px;
}

.answer-header h3 {
    font-size: 19px;
    font-weight: normal;
    margin: 0;
}

/* Code Blocks Auto-Generated */
.file-block {
    margin-top: 25px;
    border: 1px solid #e3e6e8;
    border-radius: 5px;
    overflow: hidden;
}

.file-header {
    background-color: #f8f9f9;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e3e6e8;
}

.file-name {
    font-weight: bold;
    color: #3b4045;
    font-size: 14px;
}

.copy-btn {
    background-color: #e1ecf4;
    color: #39739d;
    border: 1px solid #7aa7c7;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
}

.copy-btn:hover {
    background-color: #b3d3ea;
}

pre {
    margin: 0;
    padding: 15px;
    background-color: #f6f6f6;
    overflow-x: auto;
    font-size: 13px;
    font-family: ui-monospace, "Cascadia Mono", monospace;
}

.user-signature {
    margin-top: 30px;
    background-color: #d1e5f1;
    padding: 8px 12px;
    border-radius: 3px;
    width: fit-content;
    font-size: 13px;
    color: #39739d;
}

/* --- Acordeon Meniu Lateral --- */
.accordion-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-group {
    margin-bottom: 5px;
}

.nav-group-title {
    font-size: 13px;
    font-weight: bold;
    color: #3b4045;
    padding: 8px 10px;
    cursor: pointer;
    background-color: #e3e6e8;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.nav-group-title:hover {
    background-color: #d6d9dc;
}

/* Săgeata pentru deschidere/închidere */
.nav-group-title::after {
    content: "▼";
    font-size: 10px;
    color: #6a737c;
    transition: transform 0.2s ease;
}

/* Ascundem elementele subordonate implicit */
.nav-items {
    list-style: none;
    padding-left: 15px;
    margin-top: 5px;
    display: none;
}

/* Când grupul e activ, arătăm lista și întoarcem săgeata */
.nav-group.active .nav-items {
    display: block;
}

.nav-group.active .nav-group-title::after {
    transform: rotate(180deg);
}

.nav-items li a {
    font-size: 13px;
    padding: 6px 10px;
    display: block;
    color: #525960;
    text-decoration: none;
    border-left: 2px solid transparent;
}

.nav-items li a:hover {
    color: #0c0d0e;
    background-color: #f1f2f3;
}

.nav-items li a.active {
    font-weight: bold;
    color: #f48024;
    border-left: 2px solid #f48024;
    background-color: #fdf7f2;
}

.loading-message {
    text-align: center;
    padding: 50px 20px;
    color: #6a737c;
}

.loading-message h2 {
    font-weight: normal;
    margin-bottom: 10px;
}

/* --- CSS pentru Ascunderea/Expandarea Codului --- */
.code-wrapper {
    position: relative;
    max-height: 300px; /* Înălțimea vizibilă inițială. Poți modifica valoarea. */
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Când primește clasa 'expanded' din JS, arată tot codul */
.code-wrapper.expanded {
    max-height: none;
}

/* Efectul de Fade-out (gradient) la baza codului când este restrâns */
.code-wrapper:not(.expanded)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, rgba(246, 246, 246, 0), rgba(246, 246, 246, 1));
    pointer-events: none; /* Lasă click-ul să treacă prin gradient */
}

/* Butonul de expandare generat din JS */
.expand-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #f8f9f9;
    border: none;
    border-top: 1px solid #e3e6e8;
    color: #39739d;
    font-size: 13px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    border-radius: 0 0 5px 5px;
    transition: background-color 0.2s;
}

.expand-btn:hover {
    background-color: #e1ecf4;
}

/* --- CSS pentru Bara de Căutare --- */
.search-container {
    position: relative;
    flex-grow: 1;
    max-width: 650px;
}

#search-input {
    width: 100%;
    padding: 8px 12px 8px 30px;
    border-radius: 3px;
    border: 1px solid #e3e6e8;
    background-color: white;
    color: #3b4045;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    /* Imagine mică de lupă setată direct în CSS prin background */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' width='18' height='18' fill='%23838c95'%3E%3Cpath d='M18 16.5l-5.14-5.18h-.35a7 7 0 10-1.19 1.19v.35L16.5 18l1.5-1.5zM12 7A5 5 0 112 7a5 5 0 0110 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 8px center;
}

#search-input:focus {
    border-color: #39739d;
    box-shadow: 0 0 0 4px rgba(0, 149, 255, 0.15);
}

/* --- Dropdown-ul cu rezultate --- */
.search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e3e6e8;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
}

.search-dropdown li {
    border-bottom: 1px solid #f1f2f3;
}

.search-dropdown li:last-child {
    border-bottom: none;
}

.search-dropdown li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #3b4045;
    font-size: 13px;
}

.search-dropdown li a:hover {
    background-color: #f1f2f3;
    color: #0c0d0e;
}

/* Badge-ul care indică din ce laborator face parte rezultatul */
.search-dropdown .lab-badge {
    background-color: #e1ecf4;
    color: #39739d;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 8px;
    font-weight: bold;
}

.search-dropdown .no-results {
    padding: 15px;
    color: #6a737c;
    font-size: 13px;
    text-align: center;
}

/* --- CSS pentru Ecranul de Autentificare --- */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #f1f2f3;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    background: white;
    padding: 30px 40px;
    border-radius: 7px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.05), 0 4px 10px rgba(0,0,0,0.03);
    width: 100%;
    max-width: 320px;
    border: 1px solid #e3e6e8;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #f48024;
    margin-bottom: 20px;
}

.login-header h1 {
    font-size: 24px;
    margin: 0;
    font-weight: normal;
}

.login-box h2 {
    text-align: center;
    font-size: 19px;
    margin-bottom: 25px;
    color: #3b4045;
    font-weight: normal;
}

.login-error {
    color: #c02d2e;
    background-color: #fdf2f2;
    padding: 10px;
    border-radius: 3px;
    font-size: 13px;
    margin-bottom: 15px;
    display: none;
    border: 1px solid #f9d2d3;
    text-align: center;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #0c0d0e;
    margin-bottom: 5px;
}

.input-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #babfc4;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: #39739d;
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 149, 255, 0.15);
}

.login-btn {
    width: 100%;
    background-color: #0a95ff;
    color: white;
    border: 1px solid transparent;
    padding: 10px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.login-btn:hover {
    background-color: #0074cc;
}

/* --- Buton Scroll to Top --- */
#scrollToTopBtn {
    position: fixed;
    bottom: 30px;
    left: 50px; /* Plasat în stânga jos */
    z-index: 999;
    background-color: #f48024; /* Portocaliul temei StackOverflow */
    color: white;
    border: none;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%; /* Face butonul rotund */
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    
    /* Animații pentru apariție și hover */
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
    opacity: 0;
    visibility: hidden;
    
    /* Centrarea iconiței în interior */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Clasa pe care o va adăuga JavaScript-ul când facem scroll */
#scrollToTopBtn.show {
    opacity: 1;
    visibility: visible;
}

#scrollToTopBtn:hover {
    background-color: #bc5e15;
    transform: scale(1.1); /* Se mărește puțin la hover */
}

/* ========================================== */
/* DESIGN MOBILE RESPONSIVE (Telefoane & Tablete) */
/* ========================================== */

@media screen and (max-width: 768px) {
    /* Schimbăm structura din orizontală în verticală */
    .container {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }

    /* Meniul lateral (Sidebar) trece deasupra conținutului */
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e3e6e8;
        padding-bottom: 15px;
        padding-top: 10px;
    }

    /* Ajustăm bara de sus (Header-ul) */
    .top-bar-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-container {
        max-width: 100%;
    }

    /* Reducem marginile ferestrei principale cu probleme */
    .content {
        padding: 15px;
        min-width: 100%;
        box-sizing: border-box;
    }

    .question-header h2 {
        font-size: 22px; /* Font mai mic pe mobil */
    }

    /* Ajustăm zona cu butoanele de vot și textul */
    .post-cell {
        gap: 10px;
    }

    .vote-cell {
        width: 30px; /* Mai îngust pentru a face loc textului */
    }

    /* Ajustăm blocurile de cod */
    .file-header {
        flex-direction: column; /* Punem butonul "Copiază" sub numele fișierului */
        align-items: flex-start;
        gap: 10px;
    }

    .copy-btn {
        width: 100%; /* Butonul devine mare pentru a fi ușor de apăsat cu degetul */
        padding: 8px;
    }

    /* Fereastra de autentificare (Login) */
    .login-box {
        width: 90%;
        padding: 20px;
    }
}

/* ========================================== */
/* STILURI PENTRU MARKDOWN (Chatbot)          */
/* ========================================== */
.chat-markdown {
    font-size: 14px;
    line-height: 1.5;
    color: #3b4045;
    margin-top: 5px;
}

.chat-markdown p {
    margin-top: 0;
    margin-bottom: 10px;
}

.chat-markdown p:last-child {
    margin-bottom: 0;
}

.chat-markdown ul, .chat-markdown ol {
    margin-left: 20px;
    margin-bottom: 10px;
    padding-left: 5px;
}

.chat-markdown li {
    margin-bottom: 5px;
}

.chat-markdown strong {
    color: #0c0d0e;
}

/* Dacă AI-ul îți dă bucăți de cod, să arate ca în StackOverflow */
.chat-markdown code {
    font-family: ui-monospace, "Cascadia Mono", monospace;
    background-color: #e3e6e8;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
}

.chat-markdown pre {
    background-color: #232629;
    color: #f8f8f2;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 10px;
}

.chat-markdown pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}