/* =========================================
   ОСНОВНИ НАСТРОЙКИ (Reset & Typography)
   ========================================= */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #e2e8f0;
    background: transparent; /* Фонът се държи от .cyber-background */
}

/* =========================================
   ГЛОБАЛЕН ЖИВ ФОН (Background Canvas)
   ========================================= */
.cyber-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;          
    overflow: hidden;
    pointer-events: none; 
    background-color: #030305;
}

.cyber-background svg {
    width: 100%;
    height: 100%;
}

/* =========================================
   GLASSMORPHISM ЕФЕКТИ (Матирано Стъкло)
   ========================================= */
header.glass-panel {
    background: rgba(10, 15, 25, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 242, 254, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.2rem 0;
    text-align: center;
}

/* =========================================
   НАВИГАЦИЯ
   ========================================= */
nav a {
    color: #e2e8f0;
    margin: 0 15px;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

nav a:hover {
    color: #00f2fe;
}

.lang-switch {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-left: 20px;
}

.lang-switch:hover {
    border-color: #00f2fe;
    background: rgba(0, 242, 254, 0.1);
    color: #fff;
}

/* =========================================
   ОСНОВНО СЪДЪРЖАНИЕ
   ========================================= */
main {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

/* =========================================
   ФУТЪР
   ========================================= */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 15px 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.2); /* Много дискретен, полупрозрачен цвят */
    z-index: 10;
    pointer-events: none; /* Гарантира, че няма да пречи на местенето на терминала */
    font-family: 'Courier New', Courier, monospace;
}

/* =========================================
   CYBER TERMINAL (Анимирана Конзола)
   ========================================= */
.cyber-terminal {
    background: rgba(5, 7, 12, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 242, 254, 0.15);
    border-radius: 10px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 242, 254, 0.05);
    overflow: hidden;
    font-family: 'Courier New', Courier, monospace;
    text-align: left;
}

/* По-широк терминал специално за проектите и логовете */
.terminal-wide {
    max-width: 850px !important;
}

.terminal-header {
    background: rgba(22, 27, 34, 0.6); 
    padding: 10px 15px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    display: flex;
    align-items: center;
    position: relative;
    cursor: grab;
}

.terminal-header:active {
    cursor: grabbing;
}

.terminal-buttons {
    display: flex;
    gap: 8px;
    z-index: 10;
}

.terminal-buttons span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* Червеният бутон вече е кликаем за затваряне/назад */
.btn-close { 
    background: #ff5f56; 
    cursor: pointer; 
    transition: transform 0.1s; 
}
.btn-close:hover { 
    transform: scale(1.2); 
}
.btn-min { background: #ffbd2e; }
.btn-max { background: #27c93f; }

.terminal-title {
    color: #8b949e;
    font-size: 0.85rem;
    position: absolute;
    width: 100%;
    text-align: center;
    left: 0;
    pointer-events: none;
}

.terminal-body {
    padding: 25px 30px;
    color: #a0aec0;
    font-size: 0.95rem;
    line-height: 1.9;
}

/* =========================================
   АНИМАЦИИ ЗА ЗАРЕЖДАНЕ (Ред по ред)
   ========================================= */
.line {
    margin: 0;
    opacity: 0;
    animation: renderLine 0.1s forwards;
}

 /* Тайминги */
.t-1 { animation-delay: 0.3s; color: #a18cd1; }
.t-2 { animation-delay: 0.8s; color: #8b949e; }
.t-3 { animation-delay: 1.2s; }
.t-4 { animation-delay: 1.6s; }
.t-5 { animation-delay: 2.0s; }
.t-6 { animation-delay: 2.4s; }
.t-7 { animation-delay: 2.8s; }
.t-8 { animation-delay: 3.2s; }
.t-9 { animation-delay: 3.6s; }
.t-10 { animation-delay: 4.5s; color: #f01a4e; text-shadow: 0 0 8px rgba(240, 26, 78, 0.6); font-weight: bold; }
.t-11 { animation-delay: 5.5s; }

.highlight-hi {
    color: #00f2fe;
    font-size: 1.4rem;
    font-weight: bold;
}

@keyframes renderLine {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Мигащ курсор */
.cursor {
    display: inline-block;
    width: 10px;
    background-color: #00f2fe;
    color: transparent;
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* =========================================
   ЦВЕТОВЕ НА ТЕРМИНАЛНИТЕ МОДУЛИ
   ========================================= */
.sys-header { color: #4facfe; font-weight: bold; }
.pid { color: #f6d365; }
.mod-name { color: #00f2fe; }
.mem-usage { color: #8b949e; font-size: 0.85rem; }
.status-ok { color: #00ff88; font-weight: bold; }
.status-term { color: #ff5f56; font-weight: bold; } /* Системно червено за TERMINATED */
.status-stop { color: #8b949e; font-weight: bold; } /* Сиво за STOPPED / ARCHIVED */
.status-active { color: #f6d365; font-weight: bold; }

/* =========================================
   ИНТЕРАКТИВНИ ТЕРМИНАЛНИ ВРЪЗКИ (Бутони)
   ========================================= */
.term-link {
    display: inline-block;
    color: #f6d365;
    text-decoration: none;
    border-bottom: 1px dashed rgba(246, 211, 101, 0.5);
    padding: 0 4px;
    margin: 0 2px;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.term-link:hover {
    background: rgba(246, 211, 101, 0.2);
    color: #00f2fe !important;
    border-bottom: 1px solid #00f2fe;
    border-radius: 3px;
}

/* =========================================
   ИЗОБРАЖЕНИЯ ВЪТРЕ В ТЕРМИНАЛА
   ========================================= */
.terminal-img-box {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 250px;
    margin: 15px 0;
    border: 1px solid rgba(0, 242, 254, 0.3);
    background: #030305;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: inset 0 0 15px rgba(0, 242, 254, 0.1);
}

.terminal-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    filter: contrast(1.1) brightness(0.9);
}

/* Холограмен скан-ефект върху снимката */
.terminal-img-box .scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,242,254,0) 0%, rgba(0,242,254,0.15) 50%, rgba(0,242,254,0) 100%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 2;
    animation: scanTerminal 4s linear infinite;
}

@keyframes scanTerminal {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Допълнителни тайминги за главното меню */
.t-10 { animation-delay: 5.2s; margin-top: 15px; }

/* =========================================
   ФОРМА ЗА КОНТАКТ В ТЕРМИНАЛА
   ========================================= */
.term-form {
    margin-top: 20px;
    background: rgba(3, 3, 5, 0.5);
    padding: 15px;
    border: 1px solid rgba(0, 242, 254, 0.1);
    border-radius: 4px;
}

.term-input, .term-textarea {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(0, 242, 254, 0.3);
    color: #00ff88;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    width: 100%;
    max-width: 100%;
    padding: 5px 0;
    margin-bottom: 15px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.term-input:focus, .term-textarea:focus {
    border-bottom: 1px solid #00f2fe;
    box-shadow: 0 5px 15px -10px rgba(0, 242, 254, 0.5);
}

.term-textarea {
    resize: vertical;
    min-height: 80px;
}

.term-input::placeholder, .term-textarea::placeholder {
    color: rgba(160, 174, 192, 0.3);
}

.btn-transmit {
    background: rgba(0, 242, 254, 0.1);
    color: #00f2fe;
    border: 1px solid #00f2fe;
    padding: 8px 15px;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-radius: 3px;
}

.btn-transmit:hover {
    background: #00f2fe;
    color: #030305;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.5);
}

/* =========================================
   МОБИЛНА ОПТИМИЗАЦИЯ (Responsive Design)
   ========================================= */
@media screen and (max-width: 768px) {
    
    /* Намаляваме шрифта и отстоянията на конзолата за телефони */
    .terminal-body {
        padding: 15px 20px;
        font-size: 0.85rem;
        line-height: 1.6;
    }
    
    .terminal-header {
        padding: 8px 12px;
    }

    .terminal-title {
        font-size: 0.75rem;
    }

    .highlight-hi {
        font-size: 1.1rem;
    }

    /* 1. Индекс страница: Скриваме точките, за да не чупят редовете */
    .line {
        word-wrap: break-word; /* Позволява дълги думи да се пренасят нормално */
    }
    .line span.mod-name + a.term-link {
        white-space: normal;
    }
    
    /* Премахваме физическите точки от HTML-а чрез CSS трик за мобилни */
    .line.t-3, .line.t-4, .line.t-5, .line.t-6, .line.t-7, .line.t-8, .line.t-9 {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Скриваме декоративните точки, за да има място */
    .line p, .line span {
        white-space: pre-wrap;
    }
    
    /* 2. Проекти: Скриваме колоната за категория/памет, за да се събере таблицата */
    .mem-usage {
        display: none !important;
    }
    
    .sys-header {
        font-size: 0.75rem;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    /* Намаляваме височината на снимките в проектите */
    .terminal-img-box {
        height: 150px;
    }

    .dots {
        display: none;
    }
}