/* Language Switch Classes */
.lang-vi-only { display: none; }
body.lang-vi .lang-en-only { display: none; }
body.lang-vi span.lang-vi-only, body.lang-vi b.lang-vi-only, body.lang-vi strong.lang-vi-only { display: inline; }
body.lang-vi div.lang-vi-only, body.lang-vi p.lang-vi-only { display: block; }
body.lang-vi li.lang-vi-only { display: list-item; }

:root {
    --bg-color: #2e3436;
    --term-bg: #000000;
    --text-main: #eeeeec;
    --accent-blue: #729fcf;
    --accent-green: #8ae234;
    --accent-orange: #fce94f;
    --accent-cyan: #34e2e2;
    --term-border: #555753;
    --header-bg: rgba(0, 0, 0, 0.9);
    --section-bg: rgba(0, 0, 0, 0.85);
    --shadow-color: rgba(114, 159, 207, 0.15);
    --section-shadow: 0 8px 24px rgba(0,0,0,0.6);
    --popover-shadow: 0 10px 30px rgba(0,0,0,0.8);
}
body.light-mode {
    --bg-color: #f0f2f5;
    --term-bg: #ffffff;
    --text-main: #2e3436;
    --accent-blue: #204a87;
    --accent-green: #4e9a06;
    --accent-orange: #ce5c00;
    --accent-cyan: #06989a;
    --term-border: #babdb6;
    --header-bg: rgba(255, 255, 255, 0.95);
    --section-bg: rgba(255, 255, 255, 0.9);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --section-shadow: 0 4px 12px rgba(0,0,0,0.1);
    --popover-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
body {
    font-family: 'Roboto Mono', 'Consolas', 'Courier New', monospace;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--term-border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue); }

#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    opacity: 0.4;
    pointer-events: none;
}
body.light-mode #matrix-bg { opacity: 0.35; }
header {
    background: var(--header-bg);
    padding: 50px 20px 30px;
    text-align: center;
    border-bottom: 1px solid var(--accent-blue);
    box-shadow: 0 0 20px var(--shadow-color);
    position: relative;
}
header h1 { margin: 0; font-size: clamp(1.5em, 5vw + 1rem, 2.8em); color: var(--accent-blue); text-shadow: 0 0 8px rgba(114, 159, 207, 0.4); letter-spacing: 2px; max-width: 100%; }
body.light-mode header h1 { text-shadow: none; }
header p { margin: 10px 0 0; font-size: 1.2em; color: var(--accent-green); }
.container { max-width: 850px; margin: auto; padding: 40px 20px; position: relative; }
section {
    background: var(--section-bg);
    backdrop-filter: blur(4px);
    padding: 0;
    margin-bottom: 35px;
    border-radius: 8px;
    border: 1px solid var(--term-border);
    box-shadow: var(--section-shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
    min-width: 250px;
    min-height: 100px;
    box-sizing: border-box;
}

/* Window Controls */
.window-titlebar {
    width: 100%;
    height: 36px;
    min-height: 36px;
    background: #2d2d2d;
    color: #babdb6;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 13px;
    font-weight: bold;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--term-border);
    box-sizing: border-box;
    padding: 0 15px;
    user-select: none;
    z-index: 10;
    cursor: grab;
}
body.light-mode .window-titlebar {
    background: #e8e8e8;
    color: #2e3436;
}

.window-titlebar:active {
    cursor: grabbing;
}

.window-title-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.window-controls {
    margin-left: auto;
    display: flex;
    gap: 4px;
}
.win-btn {
    background: transparent;
    border: none;
    color: #babdb6;
    font-family: sans-serif;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: 0.2s;
    outline: none;
}
body.light-mode .win-btn {
    color: #2e3436;
}
.win-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-main); }
body.light-mode .win-btn:hover { background: rgba(0, 0, 0, 0.1); }
.win-btn.close:hover { background: #ff5f56; color: #fff; }

.section-content {
    padding: 14px 30px 30px;
    overflow-x: auto;
    flex: 1;
    box-sizing: border-box;
    min-height: 0;
    min-width: 0;
}

/* Window States */
section.section-minimized {
    height: 36px !important;
    min-height: 36px !important;
}
section.section-minimized .section-content {
    display: none;
}

.fullscreen-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
}
.fullscreen-overlay.active {
    display: block;
}

section.section-fullscreen {
    position: fixed !important;
    top: 3vh !important;
    left: 3vw !important;
    width: 94vw !important;
    height: 94vh !important;
    z-index: 1000 !important;
    transform: none !important;
    margin: 0 !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8) !important;
    border-radius: 8px !important;
    border: 1px solid var(--term-border) !important;
}
section.section-fullscreen .section-content {
    overflow-y: auto;
}

/* Custom Window Resizers */
.resizer { position: absolute; z-index: 20; }
.resizer-t { top: 0; left: 0; width: 100%; height: 6px; cursor: n-resize; }
.resizer-r { top: 0; right: 0; width: 6px; height: 100%; cursor: e-resize; }
.resizer-b { bottom: 0; left: 0; width: 100%; height: 6px; cursor: s-resize; }
.resizer-l { top: 0; left: 0; width: 6px; height: 100%; cursor: w-resize; }
.resizer-tl { top: 0; left: 0; width: 12px; height: 12px; cursor: nw-resize; z-index: 21; }
.resizer-tr { top: 0; right: 0; width: 12px; height: 12px; cursor: ne-resize; z-index: 21; }
.resizer-bl { bottom: 0; left: 0; width: 12px; height: 12px; cursor: sw-resize; z-index: 21; }
.resizer-br { bottom: 0; right: 0; width: 12px; height: 12px; cursor: se-resize; z-index: 21; }

section.section-fullscreen .resizer, section.section-minimized .resizer { display: none; }

/* OS Dock */
.os-dock {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: var(--header-bg);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--term-border);
    box-shadow: var(--popover-shadow);
    z-index: 1001;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.os-dock:empty {
    opacity: 0;
    pointer-events: none;
    bottom: -50px;
}
.dock-icon {
    background: var(--term-bg);
    color: var(--text-main);
    border: 1px solid var(--term-border);
    border-radius: 8px;
    padding: 8px 15px;
    cursor: pointer;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9em;
    font-weight: bold;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.dock-icon:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(50, 108, 229, 0.3);
}

/* Clear Z-index separation to prevent popovers from being overlapped by Sections below */
#about { z-index: 11; }
#pipeline { z-index: 10; }
#skills { z-index: 9; }
#certifications { z-index: 8; }
#languages { z-index: 7; }
#contact { z-index: 6; }
h2 { color: var(--accent-blue); border-bottom: 1px dashed var(--term-border); padding-bottom: 15px; margin-top: 5px; font-size: 1.4em; font-weight: normal; }
h2::before { content: "$ "; color: var(--accent-green); font-weight: bold; }
.item { margin-bottom: 25px; }
.item:last-child { margin-bottom: 0; }
.item h3 { margin: 0 0 8px 0; color: var(--accent-orange); font-size: 1.15em; font-weight: normal; }
.item h3::before { content: "▸ "; color: var(--accent-cyan); }
.date { font-size: 0.85em; color: #babdb6; margin-bottom: 12px; display: inline-block; background: var(--bg-color); padding: 4px 10px; border-radius: 3px; border: 1px solid var(--term-border); }
ul { list-style-type: none; padding-left: 0; }
ul li { margin-bottom: 8px; }
ul li::before { content: "» "; color: var(--accent-cyan); font-weight: bold; margin-right: 5px; }
.skills-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.skills-list li {
    background: var(--bg-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid var(--term-border);
    transition: all 0.3s ease;
}
.skills-list li::before { content: ""; margin: 0; }
.skills-list li:hover { border-color: var(--accent-cyan); box-shadow: 0 0 10px rgba(137, 221, 255, 0.3); color: #fff; transform: translateY(-2px); }
.skills-list li:nth-child(1) { border-color: #ff9900; color: #ff9900; } /* AWS */
.skills-list li:nth-child(2) { border-color: #326ce5; color: #326ce5; } /* K8s */
.skills-list li:nth-child(3) { border-color: #fc6d26; color: #fc6d26; } /* GitLab */
.skills-list li:nth-child(4) { border-color: #844fba; color: #844fba; } /* Terraform */
.skills-list li:nth-child(5) { border-color: #00bc8c; color: #00bc8c; } /* Linux */
.skills-list li:nth-child(6) { border-color: #fca311; color: #fca311; } /* Bash/Python */

/* GitLab Horizontal Pipeline Styles */
.gitlab-pipeline { display: flex; align-items: flex-start; gap: 40px; padding: 20px 0; position: relative; overflow-x: auto; }
.gl-stage { display: flex; flex-direction: column; align-items: center; min-width: 150px; position: relative; z-index: 1; gap: 15px; }
.gl-stage:hover { z-index: 10; }
.gl-stage-name { font-size: 0.85em; color: var(--accent-blue); background-color: var(--term-bg); border: 1px dashed var(--accent-blue); padding: 4px 16px; border-radius: 15px; margin-bottom: 5px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 2; position: relative; }
.gl-job { background: var(--term-bg); border: 1px solid var(--term-border); border-radius: 20px; padding: 6px 15px; color: var(--text-main); font-size: 0.9em; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); width: 100%; box-sizing: border-box; z-index: 1; }
.gl-job:hover { border-color: var(--text-main); box-shadow: 0 4px 8px rgba(0,0,0,0.4); z-index: 10; }
.gl-job.active { border-color: var(--text-main); box-shadow: 0 4px 8px rgba(0,0,0,0.4); z-index: 20; }
.gl-job.passed { border-color: var(--accent-green); }
.gl-job.passed .status-icon { color: var(--accent-green); font-weight: bold; }
.gl-job.running { border-color: var(--accent-cyan); animation: gl-pulse 2s infinite; }
.gl-job.running .status-icon { color: var(--accent-cyan); display: inline-block; animation: gl-spin 1.5s linear infinite; font-weight: bold; }
@keyframes gl-pulse { 0% { box-shadow: 0 0 0 0 rgba(137, 221, 255, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(137, 221, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(137, 221, 255, 0); } }
@keyframes gl-spin { 100% { transform: rotate(360deg); } }
/* Connectors */
.gl-stage:not(:last-child) .gl-job::after { content: ''; position: absolute; top: 50%; right: -42px; width: 41px; height: 2px; background: var(--term-border); z-index: -1; }
/* Popover Details */
.gl-popover { position: absolute; top: 0; left: 0; width: 340px; background: var(--bg-color); border: 1px solid var(--term-border); border-radius: 6px; padding: 15px; box-shadow: var(--popover-shadow); cursor: default; z-index: 9999; text-align: left; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.2s ease, margin-top 0.2s ease; margin-top: 15px; }
.gl-popover.gl-pop-visible { opacity: 1; visibility: visible; pointer-events: auto; margin-top: 0; }
.gl-popover::before { content: ''; position: absolute; top: -6px; left: var(--arrow-pos, 50%); transform: translateX(-50%) rotate(45deg); width: 10px; height: 10px; background: var(--bg-color); border-top: 1px solid var(--term-border); border-left: 1px solid var(--term-border); }
.job-header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; border-bottom: 1px dashed var(--term-border); padding-bottom: 10px; font-size: 0.9em; }
.job-name { color: var(--accent-orange); font-weight: bold; font-size: 1.1em; }
.job-stage { color: var(--accent-blue); }
.job-time { color: #babdb6; font-size: 0.9em; }
.job-logs { margin: 0; padding-left: 0; list-style: none; }
.job-logs li { margin-bottom: 6px; font-size: 0.85em; color: var(--text-main); line-height: 1.4; }
.job-logs li::before { content: "> "; color: var(--accent-green); font-weight: bold; margin-right: 5px; }
a { color: var(--accent-cyan); text-decoration: none; border-bottom: 1px dotted var(--accent-cyan); transition: 0.2s;}
a:hover { color: #fff; border-bottom: 1px solid #fff; text-shadow: 0 0 8px rgba(255,255,255,0.4); }
body.light-mode a:hover { color: var(--accent-blue); text-shadow: none; border-bottom: 1px solid var(--accent-blue); }
footer { text-align: center; padding: 30px; color: var(--term-border); font-size: 0.9em; position: relative; }

/* Download Button */
.btn-download {
    display: inline-block;
    margin-top: 25px;
    padding: 10px 24px;
    background-color: var(--term-bg);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: 0.3s;
}
.btn-download:hover { background-color: var(--accent-green); color: var(--term-bg); box-shadow: 0 0 15px rgba(138, 226, 52, 0.4); border-bottom: 1px solid var(--term-bg); }
.btn-download::before { content: "$ wget "; color: var(--text-main); transition: 0.3s; }
.btn-download:hover::before { color: var(--term-bg); }

/* Typing Cursor */
.typing-cursor::after {
    content: '█';
    display: inline-block;
    margin-left: 5px;
    animation: blink 1s step-end infinite;
    color: var(--accent-green);
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Top Controls */
.top-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}
.btn-ctrl {
    background: var(--term-bg);
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}
.btn-ctrl:hover { background: var(--accent-orange); color: var(--term-bg); box-shadow: 0 0 10px rgba(252, 233, 79, 0.4); }

/* Scroll to Top Button */
.btn-scroll-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    font-size: 1.2em;
    border: none;
    outline: none;
    background-color: var(--accent-orange);
    color: var(--term-bg);
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: 0.3s;
}
.btn-scroll-top:hover { background-color: var(--accent-green); box-shadow: 0 0 15px rgba(138, 226, 52, 0.6); }

/* Contact Form */
.contact-form {
    margin-top: 30px;
    border-top: 1px dashed var(--term-border);
    padding-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-group label {
    color: var(--accent-green);
    font-weight: bold;
}
.form-group input, .form-group textarea {
    background-color: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--term-border);
    border-radius: 4px;
    padding: 10px 15px;
    font-family: inherit;
    transition: 0.3s;
    font-size: 0.95em;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(52, 226, 226, 0.3);
}
.btn-submit {
    align-self: flex-start;
    margin-top: 5px;
}
.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.form-status {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: bold;
    display: none;
    font-size: 0.9em;
    word-break: break-word;
}
.status-success { border: 1px solid var(--accent-green); color: var(--accent-green); background: rgba(138, 226, 52, 0.1); }
.status-error { border: 1px solid #ff5f56; color: #ff5f56; background: rgba(255, 95, 86, 0.1); }