/* ========================================
   Terminal Portfolio - Styles v2
   ======================================== */

:root {
    /* Colors */
    --bg-dark: #0a0a0f;
    --bg-terminal: #0d1117;
    --bg-header: #161b22;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --accent-green: #39d353;
    --accent-cyan: #58a6ff;
    --accent-purple: #a371f7;
    --accent-pink: #f778ba;
    --accent-red: #f85149;
    --accent-yellow: #d29922;

    --monitor-frame: #1a1a1a;
    --monitor-bezel: #0f0f0f;
    --monitor-stand: #2a2a2a;

    --font-mono: 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-mono);
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0a0a0f 100%);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(57, 211, 83, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(57, 211, 83, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
}

/* Startup Screen */
.startup-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.startup-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.power-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: pulse-glow 2s ease-in-out infinite;
    cursor: pointer;
}

.power-icon {
    font-size: 80px;
    color: var(--accent-green);
    text-shadow: 0 0 10px rgba(57, 211, 83, 0.5);
    transition: all 0.3s ease;
}

.power-button:hover .power-icon {
    transform: scale(1.1);
    text-shadow: 0 0 30px rgba(57, 211, 83, 0.8);
}

.power-text {
    font-size: 18px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.startup-hint {
    position: absolute;
    bottom: 50px;
    font-size: 24px;
    color: var(--accent-green);
    text-align: center;
    width: 100%;
    padding: 0 20px;
}

@keyframes pulse-glow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Main Container */
.main-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.5s ease;
}

.main-container.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Monitor */
.monitor {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: power-on 1s ease-out;
    position: relative;
    z-index: 10;
}

@keyframes power-on {
    0% {
        transform: scale(0.8);
        opacity: 0;
        filter: brightness(3);
    }

    50% {
        filter: brightness(1.5);
    }

    100% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
}

.monitor-frame {
    background: var(--monitor-frame);
    border-radius: 20px;
    padding: 15px 15px 25px 15px;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.monitor-bezel {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.webcam {
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.5);
    position: relative;
}

.webcam::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-green);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    opacity: 0.5;
    animation: webcam-blink 3s infinite;
}

@keyframes webcam-blink {

    0%,
    90%,
    100% {
        opacity: 0.5;
    }

    95% {
        opacity: 0;
    }
}

.screen-container {
    position: relative;
    background: var(--bg-terminal);
    border-radius: 8px;
    overflow: hidden;
    width: 900px;
    height: 600px;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5), 0 0 1px rgba(57, 211, 83, 0.3);
}

.screen-glare {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 10;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.1) 0px, rgba(0, 0, 0, 0.1) 1px, transparent 1px, transparent 2px);
    pointer-events: none;
    z-index: 11;
    opacity: 0.3;
}

.monitor-stand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stand-neck {
    width: 60px;
    height: 50px;
    background: linear-gradient(90deg, #1a1a1a, #2a2a2a, #1a1a1a);
}

.stand-base {
    width: 200px;
    height: 15px;
    background: linear-gradient(180deg, #2a2a2a, #1a1a1a);
    border-radius: 0 0 100px 100px;
}

/* Terminal */
.terminal {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-terminal);
}

.terminal-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 20;
    position: relative;
}

.terminal-buttons {
    display: flex;
    gap: 8px;
}

.terminal-buttons span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.2s;
}

.terminal-buttons span:hover {
    opacity: 0.8;
}

.btn-close {
    background: #ff5f56;
}

.btn-minimize {
    background: #ffbd2e;
}

.btn-maximize {
    background: #27c93f;
}

.terminal-title {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.terminal-menu {
    display: flex;
    align-items: center;
}

.lang-switch {
    cursor: pointer;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-cyan);
    font-size: 12px;
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.lang-switch:hover {
    background: rgba(88, 166, 255, 0.1);
}

.terminal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 12;
}

.terminal-body::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

.terminal-output {
    flex: 1;
    margin-bottom: 10px;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prompt {
    font-size: 14px;
    white-space: nowrap;
}

.prompt .user {
    color: var(--accent-green);
}

.prompt .host {
    color: var(--accent-cyan);
}

.prompt .path {
    color: var(--accent-purple);
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    caret-color: var(--accent-green);
    min-width: 0;
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 18px;
    background: var(--accent-green);
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Output Content */
.output-line {
    margin-bottom: 5px;
    line-height: 1.6;
    word-break: break-word;
}

.output-command {
    color: var(--text-primary);
}

.output-response {
    padding-left: 0;
    margin-top: 5px;
    margin-bottom: 15px;
}

.output-error {
    color: var(--accent-red);
}

.output-success {
    color: var(--accent-green);
}

.output-warning {
    color: var(--accent-yellow);
}

.output-info {
    color: #58a6ff;
}

.output-highlight {
    color: var(--accent-pink);
    font-weight: 600;
}

.welcome-text {
    font-size: 16px;
    line-height: 1.5;
    margin-top: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.ascii-art {
    font-size: 10px;
    line-height: 1.2;
    color: var(--accent-green);
    white-space: pre;
    margin: 10px 0;
    overflow-x: hidden;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.skill-item {
    background: rgba(57, 211, 83, 0.1);
    border: 1px solid rgba(57, 211, 83, 0.3);
    border-radius: 5px;
    padding: 10px;
}

.skill-name {
    color: var(--accent-green);
    font-weight: 500;
    font-size: 13px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.contact-icon {
    font-size: 20px;
}

.contact-label {
    color: var(--text-secondary);
    min-width: 80px;
}

.contact-label a {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 4px;
    font-weight: bold;
}

.contact-label a:hover {
    color: var(--accent-green);
}

.contact-value a {
    color: #58a6ff;
    /* Lighter cyan/blue */
    text-decoration: none;
    text-shadow: 0 0 2px rgba(88, 166, 255, 0.4);
}

.contact-value a:hover {
    color: #79c0ff;
    text-decoration: underline;
}

/* Command List (Global) */
.help-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.cmd-tag {
    font-size: 13px;
    padding: 8px 12px;
    border: 1px solid rgba(57, 211, 83, 0.4);
    border-radius: 4px;
    color: var(--accent-green);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: inline-block;
    background: rgba(57, 211, 83, 0.05);
}

.cmd-tag:hover {
    background: rgba(57, 211, 83, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(57, 211, 83, 0.2);
}

.cmd-tag:active {
    transform: scale(0.95);
}

/* Footer */
.footer-credit {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-align: center;
    position: relative;
    z-index: 10;
}

.footer-credit .heart {
    color: var(--accent-red);
    animation: heart-beat 1.5s infinite;
    display: inline-block;
}

.footer-credit .coffee {
    color: #c49a6c;
}

@keyframes heart-beat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Typing */
.typing::after {
    content: '|';
    animation: typing-cursor 0.5s infinite;
}

@keyframes typing-cursor {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Glitch & Matrix & Hack overlay styles remain mostly same, simplified for brevity but functional */
.matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
    background-color: #000;
}

.matrix-canvas.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Enhanced Glitch Effects */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
    background: transparent;
    display: none;
    mix-blend-mode: hard-light;
}

.glitch-overlay.active {
    display: block;
}

.glitch-piece {
    position: absolute;
    background: var(--accent-green);
    opacity: 0.7;
    z-index: 2001;
}

/* Screen Shake and Color Split */
.chaos-mode {
    animation: chaos-shake 0.1s infinite;
}

@keyframes chaos-shake {
    0% {
        transform: translate(0, 0) skew(0deg);
        filter: hue-rotate(0deg);
    }

    20% {
        transform: translate(-10px, 5px) skew(5deg);
        filter: hue-rotate(90deg) invert(0.2);
    }

    40% {
        transform: translate(10px, -5px) skew(-5deg);
        filter: hue-rotate(180deg);
    }

    60% {
        transform: translate(-5px, 10px) skew(2deg);
        filter: hue-rotate(270deg) invert(0.5);
    }

    80% {
        transform: translate(5px, -10px) skew(-2deg);
        filter: hue-rotate(0deg);
    }

    100% {
        transform: translate(0, 0) skew(0deg);
    }
}

.glitch-text-effect {
    display: inline-block;
    position: relative;
    color: white;
    font-weight: bold;
    animation: text-flicker 0.1s infinite;
}

@keyframes text-flicker {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.1) translateX(2px);
        color: red;
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.hack-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px;
    font-size: 14px;
    color: #0f0;
    font-family: 'Courier New', monospace;
    font-family: 'Courier New', monospace;
    overflow: hidden;
}

.hack-overlay.hidden {
    display: none !important;
}

.hack-text {
    white-space: pre;
    width: 100%;
    height: 100%;
    overflow: hidden;
    text-shadow: 0 0 5px #0f0;
}

.hack-success {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4em;
    color: #0f0;
    border: 5px solid #0f0;
    padding: 20px;
    background: rgba(0, 50, 0, 0.9);
    text-align: center;
    box-shadow: 0 0 50px #0f0;
    animation: pulse-success 0.5s infinite alternate;
    display: none;
}

@keyframes pulse-success {
    from {
        transform: translate(-50%, -50%) scale(1);
        text-shadow: 0 0 10px #0f0;
    }

    to {
        transform: translate(-50%, -50%) scale(1.1);
        text-shadow: 0 0 30px #0f0;
    }
}

.hack-denied {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4em;
    color: #f00;
    border: 5px solid #f00;
    padding: 20px;
    background: rgba(50, 0, 0, 0.9);
    text-align: center;
    box-shadow: 0 0 50px #f00;
    animation: pulse-denied 0.5s infinite alternate;
    display: none;
    max-width: 90%;
    word-wrap: break-word;
}

@keyframes pulse-denied {
    from {
        transform: translate(-50%, -50%) scale(1);
        text-shadow: 0 0 10px #f00;
    }

    to {
        transform: translate(-50%, -50%) scale(1.1);
        text-shadow: 0 0 30px #f00;
    }
}

/* Mobile responsiveness for hack messages */
@media (max-width: 768px) {

    .hack-denied,
    .hack-success {
        font-size: 2em;
        padding: 15px;
        border-width: 3px;
    }
}

.bsod {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0078d7;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 50px;
    color: white;
    font-family: 'Segoe UI', sans-serif;
    text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .screen-container {
        width: 800px;
        height: 550px;
    }
}

@media (max-width: 820px) {
    .screen-container {
        width: calc(100vw - 40px);
        height: 60vh;
    }

    .startup-hint {
        font-size: 18px;
        bottom: 80px;
    }

    .power-icon {
        font-size: 100px;
    }
}

@media (max-width: 768px) {

    /* Mobile Full Screen Terminal */
    body {
        background: #0d1117;
        overflow: hidden;
        /* Prevent body scroll */
    }

    .main-container {
        padding: 0;
        height: 100dvh;
        /* Fixed viewport height */
        width: 100vw;
        display: flex;
        flex-direction: column;
    }

    .monitor,
    .monitor-frame,
    .screen-container {
        width: 100%;
        flex: 1;
        border-radius: 0;
        padding: 0;
        background: transparent;
        box-shadow: none;
        animation: none;
        /* Disable power-on animation on mobile for instant load */
        display: flex;
        flex-direction: column;
        overflow: hidden;
        /* Contain children */
    }

    .monitor-bezel,
    .monitor-stand,
    .webcam,
    .screen-glare,
    .scanlines {
        display: none !important;
    }

    .terminal {
        height: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .terminal-header {
        flex-shrink: 0;
        padding: 10px 15px;
        background: #161b22;
        border-bottom: 1px solid #30363d;
    }

    .terminal-body {
        flex: 1;
        overflow-y: auto;
        /* The ONLY scrollable area */
        -webkit-overflow-scrolling: touch;
        padding: 15px;
        display: flex;
        flex-direction: column;
    }

    .footer-credit {
        display: none;
        /* Hide footer on mobile to save space */
    }

    /* Adjust content for mobile */
    .ascii-art {
        font-size: 5px;
    }

    .welcome-text {
        font-size: 13px;
        margin-top: 5px;
    }

    .welcome-text {
        font-size: 13px;
        margin-top: 5px;
    }

    /* Make keyboard visible on mobile */
    .mobile-keyboard-container {
        display: block !important;
    }
}

/* Global Keyboard Styles (Hidden by default on Desktop) */
.mobile-keyboard-container {
    display: none;
    flex-shrink: 0;
    background: #161b22;
    border-top: 1px solid #30363d;
    padding: 5px;
    width: 100%;
    z-index: 100;
    user-select: none;
    position: relative;
    bottom: 0;
}

.kb-row {
    display: flex !important;
    flex-flow: row nowrap !important;
    justify-content: center;
    gap: 2px;
    margin-bottom: 3px;
    width: 100%;
}

.kb-key {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #21262d;
    color: #e6edf3;
    border: 1px solid rgba(240, 246, 252, 0.1);
    border-radius: 4px;
    height: 45px;
    /* Taller for easier touch */
    font-family: var(--font-mono);
    font-size: 18px;
    /* Larger font */
    flex: 1;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 0;
}

.kb-key:active,
.active-key {
    background: #39d353 !important;
    border-color: #39d353 !important;
    color: #0d1117 !important;
    transform: scale(0.95);
}

.kb-key.wide {
    flex: 1.5;
}

.kb-key.space {
    flex: 4;
}

.kb-key.action {
    background: #30363d;
    font-size: 14px;
}

.kb-key.enter {
    background: #238636;
    color: white;
    flex: 2;
    font-weight: bold;
}

.kb-key.disabled {
    opacity: 0.3;
    pointer-events: none;
    background: #1c2128;
    border-color: #30363d;
}

/* Hide KB on desktop explicitly (redundant but safe) */
@media (min-width: 769px) {
    .mobile-keyboard-container {
        display: none !important;
    }
}

/* Kernel Panic */
.kernel-panic {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    font-family: monospace;
    font-size: 14px;
    padding: 20px;
    z-index: 9999;
    overflow: hidden;
    line-height: 1.5;
}