:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(30, 41, 59, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-cyan: #00f2fe;
    --accent-purple: #b06ab3;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    background: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(176, 106, 198, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 242, 254, 0.1) 0%, transparent 40%);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: 280px;
    padding: 2rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.profile-card { text-align: center; margin-bottom: 2rem; }
.avatar { 
    width: 100px; 
    height: 100px; 
    border-radius: 50%; 
    border: 3px solid var(--accent-cyan); 
    margin-bottom: 1rem;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}
.profile-card h1 { font-size: 1.5rem; font-weight: 700; }
.role { 
    color: var(--accent-cyan); 
    font-family: 'JetBrains Mono', monospace; 
    font-size: 0.9rem; 
    margin: 0.5rem 0; 
}
.status { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    font-size: 0.8rem; 
    color: var(--accent-green); 
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.5rem;
}
.led { 
    width: 8px; 
    height: 8px; 
    background: var(--accent-green); 
    border-radius: 50%; 
    box-shadow: 0 0 10px var(--accent-green); 
    animation: pulse 2s infinite; 
}
@keyframes pulse { 
    0% { opacity: 1; } 
    50% { opacity: 0.5; } 
    100% { opacity: 1; } 
}
.location {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

nav ul { list-style: none; margin: 2rem 0; }
nav li { margin-bottom: 0.5rem; }
nav a { 
    color: var(--text-muted); 
    text-decoration: none; 
    font-family: 'JetBrains Mono', monospace; 
    font-size: 0.9rem;
    transition: 0.3s;
    display: block;
    padding: 0.5rem;
    border-radius: 6px;
}
nav a:hover, nav a.active { 
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.1);
}

.lang-switch { 
    display: flex; 
    gap: 10px; 
    margin: 1rem 0;
    justify-content: center;
}
.lang-switch button { 
    background: transparent; 
    border: 1px solid var(--card-border); 
    color: var(--text-muted); 
    padding: 5px 15px; 
    cursor: pointer; 
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    transition: 0.3s;
}
.lang-switch button.active { 
    border-color: var(--accent-cyan); 
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.1);
}

.social-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: auto;
    padding-top: 2rem;
}
.social-icon {
    color: var(--text-muted);
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.social-icon:hover {
    color: var(--accent-cyan);
    transform: translateY(-3px);
}

/* ============ DASHBOARD GRID ============ */
.dashboard {
    flex: 1;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    align-content: start;
}

.widget {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.widget:hover { 
    transform: translateY(-5px); 
    border-color: rgba(0, 242, 254, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.widget-title {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-cyan);
    font-size: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px dashed var(--card-border);
    padding-bottom: 0.5rem;
}

/* ============ WIDGET HERO (full width) ============ */
.widget-hero {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.1) 0%, rgba(176, 106, 198, 0.1) 100%);
}
.narrative-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 1rem;
}
.hero-tags {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.hero-tag {
    background: rgba(0, 242, 254, 0.15);
    border: 1px solid var(--accent-cyan);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', monospace;
}

/* ============ WIDGET AI ============ */
.widget-ai {
    border-left: 3px solid var(--accent-purple);
}
.ai-desc {
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}
.ai-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.badge {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid var(--accent-cyan);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    transition: 0.3s;
}
.badge:hover {
    background: rgba(0, 242, 254, 0.25);
    transform: scale(1.05);
}
.badge-ai {
    border-color: var(--accent-purple);
    background: rgba(176, 106, 198, 0.1);
}
.badge-ai:hover {
    background: rgba(176, 106, 198, 0.25);
}

/* ============ WIDGET GITHUB ============ */
.widget-github {
    border-left: 3px solid var(--accent-green);
}
.gh-loading {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}

/* ============ WIDGET NETWORK ============ */
.widget-network {
    border-left: 3px solid var(--accent-orange);
}
.network-info {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============ WIDGET STACK (full width) ============ */
.widget-stack {
    grid-column: 1 / -1;
}
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.stack-category h3 {
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}
.stack-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.stack-item {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid var(--card-border);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: 0.3s;
}
.stack-item:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.2);
}

/* ============ WIDGET SKILLS MATRIX ============ */
.widget-skills {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.05) 0%, rgba(176, 106, 198, 0.05) 100%);
}

.skills-matrix-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.skill-category-matrix h3 {
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

.skill-bars {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.skill-bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.skill-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skill-name {
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
}

.skill-level {
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 700;
}

.skill-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    border-radius: 4px;
    transition: width 1s ease;
    position: relative;
}

.skill-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skills-matrix-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px dashed var(--card-border);
}

.view-all-skills {
    color: var(--accent-cyan);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.view-all-skills:hover {
    color: var(--accent-purple);
    transform: translateX(5px);
}

/* ============ WIDGET TIMELINE (full width) ============ */
.widget-timeline {
    grid-column: 1 / -1;
}
.timeline-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.timeline-tab {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    transition: 0.3s;
}
.timeline-tab.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
    font-weight: 600;
}
.timeline-content {
    display: grid;
    gap: 1rem;
}
.timeline-content.hidden {
    display: none;
}
.timeline-item {
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--accent-cyan);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    transition: 0.3s;
}
.timeline-item:hover {
    border-left-color: var(--accent-purple);
    transform: translateX(5px);
}
.timeline-date {
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.timeline-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.timeline-company {
    color: var(--accent-purple);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.timeline-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============ ROW PAIR (Download + Contact 50/50) ============ */
.widget-row-pair {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.widget-row-pair .widget {
    margin: 0;
    height: 100%;
}

/* ============ WIDGET DOWNLOAD ============ */
.widget-download {
    text-align: center;
    background: linear-gradient(135deg, rgba(176, 106, 198, 0.08) 0%, rgba(0, 242, 254, 0.08) 100%);
    border: 1px solid rgba(176, 106, 198, 0.3);
    border-left: 4px solid var(--accent-purple);
    padding: 2rem 1.5rem;
}

.widget-download .widget-title {
    text-align: left;
    margin-bottom: 1.5rem;
}

.download-icon-large {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.5));
}

.download-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 1rem;
}

.download-button {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.8rem;
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-cyan));
    color: #000;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.download-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(176, 106, 198, 0.5);
    border-color: var(--accent-cyan);
}

.download-meta-info {
    margin-top: 1.2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.8;
}

/* ============ WIDGET CONTACT ============ */
.widget-contact {
    text-align: center;
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.05) 0%, rgba(176, 106, 198, 0.05) 100%);
}
.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}
.btn-primary {
    background: linear-gradient(45deg, var(--accent-cyan), var(--accent-purple));
    color: #000;
}
.btn-secondary {
    border: 1px solid var(--text-muted);
    color: var(--text-main);
}
.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.contact-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--card-border);
}
.contact-detail {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.3rem 0;
}

/* ============ WIDGET CERTIFICAZIONI (full width, 3 colonne) ============ */
.widget-certs {
    grid-column: 1 / -1;
}

.widget-certs .widget-title {
    margin-bottom: 1.5rem;
}

.certs-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}

.cert-item {
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.3rem;
    transition: all 0.3s ease;
    border-top: 3px solid var(--accent-cyan);
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.cert-item:hover {
    transform: translateY(-5px);
    border-top-color: var(--accent-purple);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(176, 106, 198, 0.3);
}

.cert-badge {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    margin-bottom: 0.8rem;
    align-self: flex-start;
    letter-spacing: 0.5px;
}

.cert-badge.google {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
}

.cert-badge.microsoft {
    background: rgba(176, 106, 198, 0.2);
    border: 1px solid var(--accent-purple);
    color: var(--accent-purple);
}

.cert-badge.european {
    background: rgba(0, 242, 254, 0.2);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
}

.cert-badge.security {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.cert-badge.network {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.cert-badge.development {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    color: #3b82f6;
}

.cert-name {
    font-size: 1.05rem;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.cert-organization {
    color: var(--accent-purple);
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.cert-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    margin-top: auto;
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* ============ LOADING SPINNER ============ */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--card-border);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    body { flex-direction: column; }
    .sidebar { 
        width: 100%; 
        height: auto; 
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }
    .dashboard {
        grid-template-columns: 1fr;
    }
    .widget-hero, .widget-stack, .widget-timeline, .widget-certs, .widget-row-pair, .widget-skills {
        grid-column: 1;
    }
    .widget-row-pair {
        grid-template-columns: 1fr;
    }
    .certs-container {
        grid-template-columns: repeat(2, 1fr);
    }
    .skills-matrix-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .hero-tags {
        flex-direction: column;
    }
    .stack-grid {
        grid-template-columns: 1fr;
    }
    .timeline-tabs {
        flex-direction: column;
    }
    .certs-container {
        grid-template-columns: 1fr;
    }
    .cta-buttons {
        flex-direction: column;
    }
    .btn {
        justify-content: center;
    }
}