* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00ff41;
    --secondary: #00ffff;
    --danger: #ff0040;
    --warning: #ffff00;
    --bg-dark: #0a0e27;
    --bg-darker: #050714;
    --glow: rgba(0, 255, 65, 0.5);
    --pl: #d0ff00; /* Programming Languages color */
}

body {
    font-family: 'Courier New', monospace;
    background: var(--bg-darker);
    color: var(--primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Matrix Rain Background */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.15;
}

/* Scanline Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Terminal */
.terminal-header {
    background: rgba(10, 14, 39, 0.9);
    border: 2px solid var(--primary);
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 0 20px var(--glow);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.terminal-title {
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--glow);
    animation: glitch 3s infinite;
}

@keyframes glitch {
    0%, 90%, 100% { transform: translate(0); }
    92% { transform: translate(-2px, 2px); }
    94% { transform: translate(2px, -2px); }
    96% { transform: translate(-2px, -2px); }
}

.terminal-subtitle {
    text-align: center;
    color: var(--secondary);
    font-size: 1.2em;
}

.prompt {
    color: var(--warning);
    margin-right: 10px;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.nav-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 12px 30px;
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary);
    transition: left 0.3s;
    z-index: -1;
}

.nav-btn:hover {
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--glow);
}

.nav-btn:hover::before {
    left: 0;
}

.nav-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--glow);
}

/* Home Section Special */
.home-content {
    text-align: center;
    padding: 40px 20px;
}

.home-ascii {
    font-size: 0.6em;
    color: var(--primary);
    white-space: pre;
    line-height: 1;
    margin: 30px 0;
    text-shadow: 0 0 10px var(--glow);
}

.home-description {
    font-size: 1.2em;
    color: #aaffaa;
    max-width: 800px;
    margin: 30px auto;
    line-height: 1.8;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.stat-card {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid var(--secondary);
    padding: 20px;
    border-radius: 5px;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.stat-number {
    font-size: 2.5em;
    color: var(--warning);
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

.stat-label {
    color: var(--secondary);
    margin-top: 10px;
}

/* Content Sections */
.content-section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.content-section.active {
    display: block;
}

/* Project Cards */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.project-card {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid var(--primary);
    border-radius: 5px;
    padding: 0;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, rgba(0, 255, 0, 0.3), #000);
    border-radius: 5px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--glow);
}

.project-card:hover::before {
    opacity: 0.6;
    animation: borderGlow 1s linear;
}

@keyframes borderGlow {
    0% { opacity: 0; }
    100% { opacity: 0.6; }
}

.project-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 20px 20px 0 20px;
}

.project-icon {
    font-size: 1.5em;
    color: var(--secondary);
}

.project-title {
    font-size: 1.4em;
    color: var(--primary);
    text-shadow: 0 0 5px var(--glow);
}

.project-preview {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
    background: #000;
}

.project-preview img,
.project-preview iframe,
.project-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.project-card:hover .project-preview img,
.project-card:hover .project-preview iframe,
.project-card:hover .project-preview video {
    transform: scale(1.1);
}

.project-preview::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(10, 14, 39, 1), transparent);
    pointer-events: none;
}

.project-content {
    padding: 20px;
}

.project-description {
    color: #aaffaa;
    line-height: 1.6;
    margin-bottom: 15px;
}

.project-tags,
.project-languages {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--primary);
    padding: 4px 12px;
    font-size: 0.85em;
    border-radius: 3px;
}

.pl {
    color: var(--pl);
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--pl);
    padding: 4px 12px;
    font-size: 0.85em;
    border-radius: 3px;
}

.project-links {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.link-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--secondary);
    color: var(--secondary);
    padding: 8px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
    display: block;
}

.link-btn:hover {
    background: var(--secondary);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
}

.loading::after {
    content: '|';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Footer */
.terminal-footer {
    margin-top: 50px;
    text-align: center;
    color: var(--secondary);
    padding: 20px;
    border-top: 1px solid var(--primary);
}

/* Warning Popup */
.warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(3px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.warning-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #0a0e27;
    border: 2px solid var(--warning);
    border-radius: 10px;
    padding: 25px;
    max-width: 510px;  /* 510 invece di 500 perché entra meglio il testo XD */
    width: 90%;
    color: var(--warning);
    box-shadow: 0 0 20px rgba(255,255,0,0.5);
    animation: fadeIn 0.4s ease-out;
}

.warning-box h2 {
    margin-bottom: 15px;
    color: var(--warning);
}

.warning-box p {
    color: #fffaaa;
    margin-bottom: 20px;
    line-height: 1.6;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--primary);
}

#proceed-btn {
    background: transparent;
    border: 2px solid var(--warning);
    border-radius: 5px;
    color: var(--warning);
    padding: 10px 20px;
    cursor: pointer;
    transition: 0.3s;
}

#proceed-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* Responsive */
@media (max-width: 1000px) {
    .terminal-title {
        font-size: 2em;
    }

    .terminal-subtitle {
        font-size: 1em;
    }

    .termninal-footer {
        font-size: 0.9em;
    }

    .project-icon {
        font-size: 1.3em;
    }

    .project-title {
        font-size: 1.2em;
    }

    .project-preview {
        height: 200px;
    }

    .project-description {
        font-size: 0.95em;
    }

    .project-tags .tag,
    .project-languages .pl {
        font-size: 0.8em;
    }

    .warning-box {
        padding: 20px;
    }

    .warning-box h2 {
        font-size: 1.5em;
    }

    .warning-box p,
    .warning-box label,
    .warning-box button {
        font-size: 0.9em;
    }
}

@media (max-width: 900px) {
    .project-preview {
        height: 150px;
    }
}

@media (max-width: 850px) {
    .terminal-title {
        font-size: 1.5em;
    }

    .terminal-subtitle {
        font-size: 0.9em;
    }

    .terminal-footer {
        font-size: 0.85em;
    }

    .project-icon {
        font-size: 1.2em;
    }

    .project-title {
        font-size: 1.1em;
    }

    .project-description {
        font-size: 0.9em;
    }

    .project-tags .tag,
    .project-languages .pl {
        font-size: 0.75em;
    }

    .warning-box {
        padding: 18px;
    }

    .warning-box h2 {
        font-size: 1.3em;
    }

    .warning-box p,
    .warning-box label,
    .warning-box button {
        font-size: 0.85em;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        align-items: stretch;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-card {
        padding: 15px;
        scale: 0.9;
    }

    .project-preview {
        height: 300px;
    }

    .warning-box {
        padding: 15px;
        max-width: 400px;
    }

    .warning-box h2 {
        font-size: 1.2em;
    }

    .warning-box p,
    .warning-box label,
    .warning-box button {
        font-size: 0.8em;
    }
}

@media (max-width: 650px) {
    .terminal-title {
        font-size: 1em;
    }

    .terminal-subtitle {
        font-size: 0.8em;
    }

    .terminal-footer {
        font-size: 0.8em;
    }

    .home-description {
        font-size: 0.9em;
    }

    .project-preview {
        height: 200px;
    }

    .project-description {
        font-size: 0.85em;
    }

    .project-tags .tag,
    .project-languages .pl {
        font-size: 0.7em;
    }

    .warning-box {
        padding: 12px;
        max-width: 350px;
    }

    .warning-box h2 {
        font-size: 1.1em;
    }

    .warning-box p,
    .warning-box label,
    .warning-box button {
        font-size: 0.75em;
    }
}

@media (max-width: 500px) {
    .invisible-on-smartphones {
        display: none;
    }

    .terminal-title {
        font-size: 0.9em;
    }

    .terminal-subtitle {
        font-size: 0.7em;
    }

    .terminal-footer {
        font-size: 0.7em;
    }

    .home-description {
        font-size: 0.8em;
    }

    .project-card {
        scale: 1;
    }

    .project-icon {
        font-size: 1.1em;
    }

    .project-title {
        font-size: 1em;
    }
    
    .project-preview {
        height: 150px;
    }

    .warning-box {
        scale: 0.9;
    }
}