/* 
   Theme: Modern Dark Premium
   Fonts: Outfit (Headings), Space Grotesk (Body/Tech)
*/

:root {
    /* Colors */
    --bg-dark: #0a0a0c;
    --bg-card: #131316;
    --bg-sidebar: #0f0f12;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent-primary: #6366f1;
    --accent-primary-rgb: 99, 102, 241;
    /* Indigo */
    --accent-secondary: #8b5cf6;
    /* Violet */
    --accent-glow: rgba(99, 102, 241, 0.15);
    --border-color: #27272a;

    /* Gradients */
    --gradient-main: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

:root.light-mode {
    /* Colors - Beige & Brown Theme */
    --bg-dark: #f2e8d9;
    /* Warm beige background */
    --bg-card: #faefe1;
    /* Slightly lighter cream for cards */
    --bg-sidebar: #e8dcc8;
    /* Muted sand for navbar */
    --text-primary: #3e2723;
    /* Deep dark brown text */
    --text-secondary: #795548;
    /* Medium brown text */
    --accent-primary: #8d6e63;
    --accent-primary-rgb: 141, 110, 99;
    /* Elegant brown accent */
    --accent-secondary: #d84315;
    /* Warm terra cotta orange */
    --accent-glow: rgba(141, 110, 99, 0.15);
    --border-color: #d7ccc8;
    /* Light brown borders */

    /* Gradients */
    --gradient-main: linear-gradient(135deg, #8d6e63 0%, #d84315 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navbar */
.top-navbar {
    display: flex;
    align-items: center;
    padding: 0.8rem 2.5rem;
    background-color: rgba(15, 15, 18, 0.7);
    /* Elegance via slight transparency (glassmorphism) */
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 1rem;
    z-index: 1000;
    margin: 1rem auto;
    width: calc(100% - 4rem);
    max-width: 1400px;
    border-radius: 100px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.nav-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo i {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-nav {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 3rem;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1.05rem;
    transition: var(--transition-fast);
}

.nav-links a:hover,
.nav-links li.active a {
    color: var(--accent-primary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Auth Padlock */
#authPadlock {
    font-size: 0.9em;
    margin-left: 0.2rem;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

#authPadlock.fa-lock-open {
    color: #2ecc71;
    /* green */
}

/* =========================================
   Subject Detail Page Styles
   ========================================= */

/* Layout Grid */
.subject-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--spacing-xl);
    align-items: start;
}

@media (max-width: 1024px) {
    .subject-layout {
        grid-template-columns: 1fr;
    }
}

/* Tabs Navigation */
.tabs-container {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-md);
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 0;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    box-shadow: 0 -2px 10px var(--accent-primary);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar Styles */
.subject-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
}

.info-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.info-item .label {
    color: var(--text-secondary);
}

.info-item .value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Progress Bar */
.progress-container {
    margin-bottom: 1rem;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-main);
    border-radius: 100px;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.check-item i.completed {
    color: #2ecc71;
}

/* Quick Links */
.quick-links {
    list-style: none;
}

.quick-links li {
    margin-bottom: 0.5rem;
}

.quick-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition-fast);
}

.quick-links a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
}

/* Timeline Styles */
.timeline-container {
    position: relative;
    padding-left: 1.5rem;
    border-left: 2px solid var(--border-color);
    margin-left: 0.5rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-dot {
    position: absolute;
    left: -1.95rem;
    top: 0.2rem;
    width: 12px;
    height: 12px;
    background: var(--bg-dark);
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition-fast);
}

.timeline-dot.active {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.timeline-content h4 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.timeline-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Markdown Content Styles */
.markdown-content {
    color: var(--text-secondary);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.markdown-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
}

.markdown-content blockquote {
    border-left: 4px solid var(--accent-primary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.05);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
}

.markdown-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
    color: var(--accent-secondary);
}

.markdown-content pre {
    background: #1e1e1e;
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.9rem;
}

/* Resource Links */
.resource-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: var(--transition-fast);
}

.resource-link:hover {
    border-color: var(--accent-primary);
    transform: translateX(5px);
}

.resource-icon {
    font-size: 1.5rem;
    color: var(--accent-primary);
}

.resource-info {
    flex: 1;
}

.resource-info h4 {
    margin-bottom: 0.2rem;
}

.resource-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.resource-action {
    color: var(--text-secondary);
    opacity: 0.5;
    transition: var(--transition-fast);
}

.resource-link:hover .resource-action {
    opacity: 1;
    color: var(--accent-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    width: 100%;
    padding: var(--spacing-xl) 5%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.search-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 400px;
    transition: var(--transition-fast);
}

.search-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-container input {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-family: inherit;
}

.search-container i {
    color: var(--text-secondary);
}

/* Search Dropdown */
.search-wrapper {
    position: relative;
    width: 400px;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.search-results-dropdown.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-fast);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--accent-glow);
}

.result-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.result-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.1rem;
    color: var(--text-primary);
}

.result-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.logout-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.logout-btn:hover {
    background-color: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.5);
    color: #ef4444;
}

.logout-btn i {
    font-size: 1rem;
}

/* Hero Section */
.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5rem;
    position: relative;
}

.hero-content {
    max-width: 600px;
    z-index: 2;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
}

.gradient-text {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: var(--spacing-lg);
}

.hero-stats {
    display: flex;
    gap: var(--spacing-xl);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-visual {
    position: absolute;
    right: -5%;
    top: -20%;
    width: 500px;
    height: 500px;
    z-index: 1;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.blob-1 {
    width: 300px;
    height: 300px;
    background-color: var(--accent-primary);
    top: 0;
    right: 0;
    animation: float 10s infinite ease-in-out;
}

.blob-2 {
    width: 250px;
    height: 250px;
    background-color: var(--accent-secondary);
    bottom: 50px;
    left: 50px;
    animation: float 8s infinite ease-in-out reverse;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(20px, -20px);
    }

    100% {
        transform: translate(0, 0);
    }
}

/* Sections */
section {
    margin-bottom: 5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

h2::before {
    content: '';
    display: block;
    width: 6px;
    height: 24px;
    background: var(--gradient-main);
    border-radius: 4px;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: var(--spacing-lg);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.card-icon {
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-primary);
}

.light-mode .card-icon {
    background-color: rgba(0, 0, 0, 0.05);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
}

.card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.card-arrow {
    position: absolute;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--transition-fast);
    color: var(--accent-primary);
}

.card:hover .card-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Extra Cards Specifics */
.extra-card .card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--accent-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-text {
    color: var(--accent-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-top: auto;
}

.btn-text:hover {
    gap: var(--spacing-sm);
}

/* -------------------------------------------------------------------------- */
/* RESPONSIVE DESIGN & SIDEBAR LOGIC                                          */
/* -------------------------------------------------------------------------- */

/* Sidebar Toggle Button (Floating Single Button) - Base Styles */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer !important;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    transition: all var(--transition-smooth);
    z-index: 9999;
    position: fixed;
    top: 37px;
    /* Vertically centered with logo (center = 51px) */
    left: 190px;
    /* Clean gap after 'MyNotes' text (ends at 181px) */
    border: none;
    box-shadow: none;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* ----------------------------- DESKTOP LOGIC (> 768px) -------------------- */
/* ----------------------------- TABLET OPTIMIZATION (< 1024px) -------------- */
@media (max-width: 1024px) {
    .hero h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .top-bar {
        flex-direction: column-reverse;
        gap: var(--spacing-md);
        align-items: stretch;
    }

    .search-container {
        width: 100%;
    }

    .user-profile {
        align-self: flex-end;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        margin-bottom: 2rem;
    }

    .hero-content {
        margin-bottom: 0;
    }

    .hero-stats {
        justify-content: center;
    }
}

/* Back Button Styles */
.back-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.05); /* Effetto hover in Dark Mode */
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateX(-3px); /* Leggero e moderno effetto di movimento verso sinistra */
}

/* Modifica per Light Mode */
:root.light-mode .back-btn:hover {
    background-color: rgba(0, 0, 0, 0.05); /* Effetto hover più leggibile in Light Mode */
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.breadcrumbs a:hover {
    color: var(--accent-primary);
}

.breadcrumbs i {
    font-size: 0.7rem;
}

.breadcrumbs span {
    color: var(--text-primary);
    font-weight: 500;
}

/* Hero Small */
.hero-small {
    margin-bottom: 1.5rem;
    padding-bottom: 0;
}

.hero-small h1,
.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.2rem;
}

.hero-content p {
    margin-bottom: 0;
}

/* Subject Cards */
.subject-card {
    padding: 0;
    gap: 0;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.card-header-img {
    height: 120px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.card-header-img::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-card) 100%);
}

.programming-bg {
    background: linear-gradient(45deg, #2c3e50, #3498db);
}

.math-bg {
    background: linear-gradient(45deg, #c0392b, #e74c3c);
}

.hardware-bg {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
}

.lang-bg {
    background: linear-gradient(45deg, #8e44ad, #9b59b6);
}

.subject-card .card-content {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex: 1;
}

.tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-completed {
    background: rgba(39, 174, 96, 0.2);
    color: #2ecc71;
}

.tag-progress {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
}

.tag-code {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.tag-theory {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.tag-hardware {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
}

.card-meta {
    margin-top: auto;
    padding-top: var(--spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* FIX LAYOUT OVERFLOW */
.subject-main {
    min-width: 0;
}

/* SNIPPET & ACCORDION STYLES */
details.snippet-container {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* More subtle elegant border */
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

details.snippet-container:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

details.snippet-container[open] {
    border-color: var(--accent-primary);
    box-shadow: 0 8px 30px -5px rgba(0, 0, 0, 0.4);
}

/* Light mode overrides for container */
.light-mode details.snippet-container {
    background: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.light-mode details.snippet-container:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.light-mode details.snippet-container[open] {
    border-color: var(--accent-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

summary.snippet-header {
    list-style: none;
    padding: 0.6rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: transparent;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

summary.snippet-header::-webkit-details-marker {
    display: none;
}

summary.snippet-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.light-mode summary.snippet-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

summary.snippet-header i.fa-chevron-down {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
}

details.snippet-container[open] summary.snippet-header i.fa-chevron-down {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

.snippet-title h3 {
    margin: 0 0 0.2rem 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.snippet-title p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.snippet-body {
    position: relative;
    background: #111116;
    /* Deep elegant dark */
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.light-mode .snippet-body {
    background: #1e1e24;
    /* Keep snippet body dark in light mode too */
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.snippet-body pre {
    margin: 0;
    border: none;
    border-radius: 0;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
}

/* Force dark style on pre inside snippet body even in light mode! */
.light-mode details.snippet-container .snippet-body pre {
    background: transparent !important;
    border-color: transparent !important;
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a1a1aa;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Copy button kept dark style inside the dark code body for light mode */
.light-mode .snippet-body .copy-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #d1d5db;
}

.light-mode .snippet-body .copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}


/* ===================================
   Portfolio Section Styles
   =================================== */

/* Portfolio Sections */
.portfolio-section {
    margin-bottom: 4rem;
    max-width: 1300px;
    padding: 0 1.5rem;
    /* Ensure it never touches the screen edge on small monitors */
    margin-left: auto;
    margin-right: auto;
}

/* CV Card */
.cv-container {
    width: 100%;
}

.cv-card {
    padding: 2rem;
    position: relative;
}

/* Toggle button (hidden statically the home page, kept basic style if needed elsewhere) */
.cv-toggle {
    display: none;
}

.cv-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    transition: margin-bottom 0.4s ease,
        padding-bottom 0.4s ease,
        border-color 0.4s ease;
}

.cv-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    flex-shrink: 0;
}

.cv-info h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.cv-info p {
    color: var(--text-secondary);
    margin: 0;
}

.cv-section {
    margin-bottom: 2rem;
}

.cv-section:last-child {
    margin-bottom: 0;
}

.cv-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.cv-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.cv-item:last-child {
    margin-bottom: 0;
}

.cv-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    min-width: 100px;
    flex-shrink: 0;
}

.cv-details strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.cv-details p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* Skills Grid */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skill-tag {
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Certification Cards with Grouping */
.cert-card {
    text-align: center;
    padding: 2rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
}

.cert-card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform var(--transition-fast);
    flex-grow: 1;
    /* Allows header to take available space */
}

.cert-card:hover .cert-card-header {
    transform: translateY(-5px);
}

.cert-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #ffd700;
}

.cert-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.cert-issuer {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.cert-card .toggle-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: auto;
    /* Pushes the icon to the very bottom of the card */
    padding-top: 1rem;
    transition: transform var(--transition-smooth);
}

.cert-card.active .toggle-icon {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

/* Hidden content until expanded - Now an Overlay */
.cert-group-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(19, 19, 22, 0.98);
    backdrop-filter: blur(8px);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    display: flex;
    flex-direction: column;
    padding: 3rem 1.5rem 1.5rem 1.5rem;
    overflow-y: auto;
}

.light-mode .cert-group-content {
    background: rgba(250, 239, 225, 0.98);
}

.cert-card.active .cert-group-content {
    opacity: 1;
    visibility: visible;
}

/* Close Button for Overlay */
.cert-close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
    z-index: 20;
}

.cert-close-btn:hover {
    color: var(--accent-primary);
}

.cert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    margin-bottom: 0;
    transition: var(--transition-fast);
    text-align: left;
}

.light-mode .cert-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.cert-item:last-child {
    border-bottom: none;
}

.cert-item:hover {
    background: transparent;
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.cert-item-info h4 {
    margin: 0 0 0.3rem 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.cert-item-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .cert-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.btn-text:hover {
    gap: 0.75rem;
}

.btn-text i {
    transition: var(--transition-fast);
}

/* Project Cards */
.project-card {
    position: relative;
    padding: 2rem;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.project-header>i {
    font-size: 1.5rem;
    color: var(--accent-primary);
}

.project-status {
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    border: 1px solid;
}

.project-status.status-active {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.project-status.status-completed {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.project-status.status-paused {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.project-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.project-card>p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.tech-tag {
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.project-links a {
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: var(--transition-fast);
    text-decoration: none;
}

.project-links a:hover {
    color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Social Grid */
.social-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.social-card {
    text-align: center;
    padding: 2rem;
    transition: var(--transition-smooth);
    text-decoration: none;
    display: block;
}

.social-card i {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.social-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.social-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.social-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .cv-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .cv-date {
        min-width: auto;
    }

    .social-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   Stats Dashboard Styles
   =================================== */

/* Stats Dashboard */
.stats-dashboard {
    margin-bottom: 3rem;
}

.stats-dashboard h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.light-mode .stat-icon {
    background: rgba(216, 67, 21, 0.1); /* Using terra cotta accent for light mode contrast */
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.stat-value.monospace {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 0.25rem;
}

.stat-content .btn-text {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.stat-content .btn-text:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.stat-content .btn-text:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Battery Bar */
.battery-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.battery-bar {
    height: 100%;
    background: var(--gradient-main);
    border-radius: 100px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* Screen Tilt Card */
.tilt-visual-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.75rem 0;
    perspective: 200px;
}

.tilt-device {
    width: 60px;
    height: 40px;
    background: rgba(99, 102, 241, 0.15);
    border: 2px solid var(--accent-primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out;
    transform-style: preserve-3d;
}

.tilt-screen {
    width: 48px;
    height: 28px;
    background: var(--gradient-main);
    border-radius: 3px;
    opacity: 0.6;
}

.tilt-values {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tilt-axis {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0.3rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.light-mode .tilt-axis {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.05);
}

.tilt-label {
    font-size: 0.7rem;
    color: var(--accent-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tilt-axis .stat-value {
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* Real-time Card */
.realtime-card {
    padding: 1.5rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.metric-value {
    color: var(--text-primary);
    font-weight: 600;
}

.metric-value.monospace {
    font-family: 'Courier New', monospace;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.1rem;
}

.theme-toggle-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: var(--accent-glow);
    transform: rotate(15deg);
}

/* Light Mode Navbar - Modern Beige Pill */
:root.light-mode .top-navbar {
    background-color: rgba(242, 232, 217, 0.75);
    border-color: rgba(141, 110, 99, 0.2);
    box-shadow: 0 10px 40px rgba(141, 110, 99, 0.12);
}

:root.light-mode .top-navbar .logo {
    color: var(--text-primary);
}

:root.light-mode .top-navbar .nav-links a {
    color: var(--text-secondary);
}

:root.light-mode .top-navbar .nav-links a:hover,
:root.light-mode .top-navbar .nav-links li.active a {
    color: var(--text-primary);
    background: rgba(141, 110, 99, 0.08); /* Darker tint for better visibility */
}

:root.light-mode .top-navbar .nav-right a {
    color: var(--text-primary) !important; /* Darker icons for contrast */
}

:root.light-mode .top-navbar .nav-right a:hover {
    color: var(--accent-secondary) !important;
}

:root.light-mode .theme-toggle-btn {
    color: var(--text-primary);
    border-color: var(--border-color);
    background: rgba(141, 110, 99, 0.05);
}

:root.light-mode .theme-toggle-btn:hover {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
    background: rgba(216, 67, 21, 0.1);
}

/* Elegant CV Grid System */
.elegant-cv-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .elegant-cv-grid {
        grid-template-columns: 1fr;
    }
}

.cv-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cv-new-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.8rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.cv-new-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-primary-rgb, 124, 92, 252), 0.3);
}

.highlight-card {
    border: 1px solid var(--accent-primary);
    box-shadow: 0 4px 25px var(--accent-glow);
}

.card-header-flex {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header-flex h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.header-icon {
    font-size: 1.4rem;
    color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb, 124, 92, 252), 0.1);
    padding: 0.8rem;
    border-radius: 8px;
}

/* Skills Category refinements */
.skill-category {
    margin-bottom: 1.5rem;
}

.skill-category h5 {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.skill-tag.highlight {
    background: rgba(var(--accent-primary-rgb, 124, 92, 252), 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    font-weight: 600;
}

/* Base CV Items adaptations for the new cards */
.cv-new-card .cv-item {
    margin-bottom: 1.2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-color);
}

.cv-new-card .cv-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.compact-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.compact-item .cv-date {
    font-size: 0.85rem;
    color: var(--accent-primary);
    font-weight: 600;
}

/* Modern Linear CV Layout */
.cv-linear-container {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    /* Increased spacing between sections */
    padding: 1rem 0;
}

.cv-linear-section {
    border-left: 3px solid rgba(var(--accent-primary-rgb, 124, 92, 252), 0.3);
    padding-left: 2rem;
    position: relative;
    transition: border-color 0.3s ease;
}

.cv-linear-section:hover {
    border-left-color: var(--accent-primary);
}

.cv-section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.cv-section-title i {
    color: var(--accent-primary);
    font-size: 1.2rem;
    /* Optional circle icon background */
    background: var(--bg-card);
    padding: 0.6rem;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* Position over the border line */
    position: absolute;
    left: -22px;
    /* Adjust based on padding/border width */
    top: -2px;
}

.cv-section-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    /* Increased spacing between subsections/items */
}

/* Linear specific items */
.skill-group {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.skill-group h5 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.cv-item-linear {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    padding-bottom: 1.5rem;
    border-bottom: 1px dotted var(--border-color);
}

.cv-item-linear:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cv-item-linear.compact {
    padding-bottom: 1.2rem;
    align-items: center;
    gap: 1.5rem;
}

.cv-date-linear {
    flex: 0 0 120px;
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 0.95rem;
    padding-top: 2px;
}

.cv-details-linear {
    flex: 1;
}

.cv-details-linear strong {
    font-size: 1.1rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.4rem;
}

.cv-details-linear p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.cv-details-linear.full-width {
    flex: 1;
}

@media (max-width: 768px) {
    .cv-item-linear {
        flex-direction: column;
        gap: 0.5rem;
    }

    .cv-date-linear {
        flex: none;
    }

    .cv-linear-section {
        padding-left: 1.5rem;
    }

    .cv-section-title i {
        left: -18px;
        padding: 0.6rem;
        font-size: 1.2rem;
    }
}

/* Tech Grid for IT Skills */
.tech-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.tech-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    position: relative;
    cursor: default;
}

/* Elegant CSS Tooltips for IT Skills */
.tech-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 1000;
}

.tech-item[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.tech-item.highlight-tech {
    background: rgba(var(--accent-primary-rgb, 124, 92, 252), 0.05);
    border-color: rgba(var(--accent-primary-rgb, 124, 92, 252), 0.3);
    color: var(--text-primary);
}

.tech-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.tech-item i {
    font-size: 1.1rem;
}

/* Clickable Project Items */
a.clickable-project {
    display: flex;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: 12px;
    padding: 1rem;
    margin: -1rem;
    /* Offset padding to keep alignment */
    align-items: center;
    /* Align arrow vertically */
}

a.clickable-project:hover {
    background: rgba(var(--accent-primary-rgb, 124, 92, 252), 0.05);
    /* very light accent bg */
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: transparent;
    /* hide dotted bottom border if any */
}

.project-arrow {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: transform 0.3s ease, color 0.3s ease;
    opacity: 0;
    transform: translateX(-10px);
}

a.clickable-project:hover .project-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent-primary);
}

a.clickable-project:hover .cv-details-linear strong {
    color: var(--accent-primary);
}

/* ===================================
   Hamburger / Drawer (hidden on desktop)
   =================================== */
.hamburger-btn,
.mobile-overlay,
.mobile-drawer {
    display: none;
}

/* ===================================
   Global Mobile Fixes
   =================================== */
@media (max-width: 768px) {

    /* === Refine Back Button for Mobile Touch === */
    .back-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        margin-right: -0.2rem; /* Leggero compenso visivo se necessario */
    }

    /* === Overflow Fix === */
    html,
    body,
    .app-container {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* === Main layout scaling (more compact) === */
    .main-content {
        padding: 1rem 0.75rem;
    }

    section,
    .portfolio-section {
        margin-bottom: 2rem;
        padding: 0 0.5rem;
    }

    h2 {
        font-size: 1.35rem;
        margin-bottom: 1rem;
    }

    /* === Reduce gaps in grids === */
    .cards-grid,
    .social-grid,
    .tech-grid {
        gap: 0.75rem;
    }

    /* === Shrink padding and sizes of cards === */
    .card,
    .project-card,
    .cert-card,
    .cv-card,
    .social-card,
    .info-card {
        padding: 1rem;
        gap: 0.6rem;
        border-radius: 10px;
    }

    /* === Refine Subject Cards on Mobile === */
    .card.subject-card {
        padding: 0;
        gap: 0;
    }

    .subject-card .card-header-img {
        height: 85px;
        font-size: 2rem;
    }

    .subject-card .card-content {
        padding: 1rem;
        gap: 0.5rem;
    }

    .subject-card h3 {
        font-size: 1.25rem;
        margin-bottom: 0.2rem;
    }

    .subject-card p {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 0.2rem;
    }

    .subject-card .tags .tag {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .subject-card .card-meta {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        font-size: 0.75rem;
        gap: 0.75rem;
    }

    .cv-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .cv-avatar {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .cv-info h3 {
        font-size: 1.1rem;
    }

    /* === Navbar: hide links, show hamburger === */
    .top-navbar {
        padding: 0.6rem 1rem;
        flex-wrap: nowrap;
        gap: 0;
        justify-content: space-between;
        top: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border-color);
        box-shadow: none;
        background-color: var(--bg-card);
    }

    .nav-left {
        flex: 0 0 auto;
    }

    .logo {
        font-size: 1.15rem;
    }

    /* Hide desktop nav links and right icons on mobile */
    .top-nav,
    .nav-right {
        display: none !important;
    }

    /* === Hamburger Button === */
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 6px;
        z-index: 200;
    }

    .hamburger-btn span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--text-primary);
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    /* Contrast fix for light mode mobile hamburger */
    :root.light-mode .hamburger-btn span {
        background: var(--text-primary);
    }

    .hamburger-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    /* === Mobile Overlay === */
    .mobile-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* === Mobile Drawer === */
    .mobile-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        max-width: 80vw;
        height: 100%;
        background: var(--bg-card);
        border-left: 1px solid var(--border-color);
        z-index: 999;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding: 0;
    }

    :root.light-mode .mobile-drawer {
        border-left-color: rgba(0, 0, 0, 0.1);
    }

    .mobile-drawer.active {
        transform: translateX(0);
    }

    .drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.2rem 1.5rem;
        border-bottom: 1px solid var(--border-color);
    }

    .drawer-header .logo {
        font-size: 1.2rem;
    }

    .drawer-close {
        background: none;
        border: none;
        color: var(--text-secondary);
        font-size: 1.4rem;
        cursor: pointer;
        padding: 4px;
        transition: color 0.2s;
    }

    .drawer-close:hover {
        color: var(--text-primary);
    }

    .drawer-links {
        list-style: none;
        padding: 1rem 0;
        margin: 0;
    }

    .drawer-links li a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.9rem 1.5rem;
        color: var(--text-secondary);
        font-size: 1rem;
        font-weight: 500;
        transition: all 0.2s;
    }

    .drawer-links li a:hover,
    .drawer-links li.active a {
        color: var(--accent-primary);
        background: rgba(99, 102, 241, 0.05);
    }

    .drawer-links li.active a {
        border-left: 3px solid var(--accent-primary);
    }

    .drawer-divider {
        height: 1px;
        background: var(--border-color);
        margin: 0 1.5rem;
    }

    .drawer-actions {
        padding: 0.75rem 1.5rem;
    }

    .drawer-theme-btn {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        background: none;
        border: none;
        color: var(--text-secondary);
        font-size: 1rem;
        font-weight: 500;
        cursor: pointer;
        padding: 0.5rem 0;
        width: 100%;
        transition: color 0.2s;
        font-family: inherit;
    }

    .drawer-theme-btn:hover {
        color: var(--accent-primary);
    }

    .drawer-socials {
        display: flex;
        gap: 1.5rem;
        padding: 1rem 1.5rem;
    }

    .drawer-socials a {
        color: var(--text-secondary);
        font-size: 1.3rem;
        transition: color 0.2s;
    }

    .drawer-socials a:hover {
        color: var(--accent-primary);
    }

    /* === Hero: more compact === */
    .hero-small {
        padding: 0.75rem 0.25rem 0 0.25rem;
        margin-bottom: 0.5rem;
    }

    .portfolio-section {
        margin-top: 1rem !important;
        padding-top: 0 !important;
    }

    .breadcrumbs {
        display: none !important;
    }

    .hero-small h1,
    .hero-content h1 {
        font-size: 1.65rem !important;
        line-height: 1.15;
    }

    .hero-content p {
        font-size: 0.9rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* === CV Section: compact === */
    .cv-linear-container {
        gap: 2.5rem;
    }

    .cv-linear-section {
        padding-left: 1.2rem;
    }

    .cv-section-title {
        font-size: 1.15rem;
        margin-bottom: 1rem;
    }

    .cv-section-title i {
        left: -16px;
        padding: 0.5rem;
        font-size: 1rem;
    }

    .cv-section-content {
        gap: 0.8rem;
    }

    .cv-item-linear {
        gap: 0.4rem;
        padding-bottom: 0.75rem;
    }
    
    .cv-item-linear.compact {
        padding-bottom: 0.5rem;
        align-items: flex-start;
    }

    .cv-date-linear {
        flex: 0 0 auto;
        font-size: 0.85rem;
    }

    .cv-details-linear strong {
        font-size: 0.95rem;
    }

    .cv-details-linear p, 
    .cv-item-linear.compact .cv-details-linear {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    /* === Tech items: smaller on mobile === */
    .tech-item {
        padding: 0.35rem 0.6rem;
        font-size: 0.78rem;
        gap: 0.35rem;
    }

    .tech-item img {
        width: 12px !important;
        height: 12px !important;
    }

    /* === CV download button: compact === */
    .portfolio-section > div:first-child {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start !important;
    }

    .portfolio-section .btn-primary {
        font-size: 0.85rem !important;
        padding: 0.6rem 1.2rem !important;
    }

    /* === Project cards: compact === */
    .project-card h3 {
        font-size: 0.95rem;
    }

    .project-card > p {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .project-tech {
        margin: 0.5rem 0;
    }

    .tech-tag {
        font-size: 0.72rem;
        padding: 0.2rem 0.55rem;
    }

    /* === Social grid: 2 columns === */
    .social-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .social-card {
        padding: 1.2rem 0.75rem;
    }

    .social-card i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .social-card h3 {
        font-size: 0.95rem;
    }

    .social-card p {
        font-size: 0.8rem;
    }

    /* === Cert cards: compact === */
    .cert-card-header {
        padding: 0;
    }

    .cert-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .cert-card h3 {
        font-size: 1rem;
    }

    .cert-issuer {
        font-size: 0.8rem;
    }

    .cert-group-content {
        padding: 2.5rem 1rem 1rem 1rem;
    }

    .cert-item-info h4 {
        font-size: 0.9rem;
    }
}

/* =========================================
   TABS UI (Project Pages)
========================================= */

.tabs-container {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    padding-bottom: 0px;
    scrollbar-width: none;
    /* Firefox */
}

.tabs-container::-webkit-scrollbar {
    display: none;
    /* Safari and Chrome */
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-size: 1rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.tab-btn.active {
    color: var(--accent-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    /* Pull it down to cover the border-bottom */
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out forwards;
}

.tab-content.active {
    display: block;
}

/* Markdown Rendering Settings for tabs */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    color: var(--text-primary);
}

.markdown-content p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.2rem;
}

.markdown-content pre {
    background: #1e1e1e !important;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-content code {
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
}

.light-mode .markdown-content pre {
    background: #f8f9fa !important;
    border-color: #e5e7eb;
}

/* Code Wrapper and Copy Button */
.code-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.copy-btn {
    position: absolute;
    top: 0.8rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 10;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.light-mode .copy-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.light-mode .copy-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Test Files Accordion UI */
.test-file-details {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: var(--transition-fast);
}

.test-file-summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    user-select: none;
    transition: background 0.2s ease;
    border-bottom: 1px solid transparent;
}

.test-file-details[open] .test-file-summary {
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
}

.test-file-summary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.light-mode .test-file-summary {
    background: rgba(0, 0, 0, 0.02);
}

.light-mode .test-file-details[open] .test-file-summary {
    background: rgba(0, 0, 0, 0.04);
}

.light-mode .test-file-summary:hover {
    background: rgba(0, 0, 0, 0.05);
}

.test-file-content {
    background: rgba(0, 0, 0, 0.1);
}

.light-mode .test-file-content {
    background: rgba(0, 0, 0, 0.02);
}
/* =========================================
   SWUP.JS PAGE TRANSITIONS
   ========================================= */

/* Stato di transizione (animazione morbida) */
.transition-fade {
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    opacity: 1;
    transform: translateY(0);
}

/* Stato in cui la pagina "esce" o "sta caricando" */
html.is-animating .transition-fade {
    opacity: 0;
    transform: translateY(10px); /* Piccolo effetto di slittamento verso l'alto */
}

/* Evita flash di colore durante il caricamento */
html.is-animating, 
html.is-rendering {
    cursor: wait;
}

/* =========================================
   STAGGERED FADE-IN ANIMATION (CSS ONLY)
   ========================================= */
@keyframes fadeInUpCascata {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.anim-load {
    opacity: 0; /* Mantiene la struttura senza layout shift */
    animation: fadeInUpCascata 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}

/* Staggering progressivo automatico basato sulla posizione nell'HTML */
.anim-load:nth-child(1) { animation-delay: 0.02s !important; }
.anim-load:nth-child(2) { animation-delay: 0.04s !important; }
.anim-load:nth-child(3) { animation-delay: 0.06s !important; }
.anim-load:nth-child(4) { animation-delay: 0.08s !important; }
.anim-load:nth-child(5) { animation-delay: 0.10s !important; }
.anim-load:nth-child(6) { animation-delay: 0.12s !important; }
.anim-load:nth-child(7) { animation-delay: 0.14s !important; }
.anim-load:nth-child(8) { animation-delay: 0.16s !important; }
.anim-load:nth-child(n+9) { animation-delay: 0.18s !important; }

/* Classi manuali */
.delay-1 { animation-delay: 0.02s !important; }
.delay-2 { animation-delay: 0.06s !important; }
