/* --- GLOBAL RESET & FONT SETUP --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f0f0f0;
    font-family: 'VT323', monospace; /* Retro font */
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    font-size: 16px;
    padding-top: 10px; /* Space for fixed toggle button on desktop */
}

a {
    text-decoration: none;
    transition: color 0.2s;
    color: var(--primary-dark);
}

/* --- COLOR VARIABLES (Blue Light Mode / Neon Dark Mode) --- */
/* LIGHT MODE COLORS (Blue/Cyan Theme) */
:root {
    --primary-color: #5AF; /* Light Blue/Cyan for highlights */
    --primary-dark: #004993; /* Darker Cyan/Teal for secondary text/borders */
    --background-light: #ffffff;
    --text-color-light: #333333;
    --text-color-dark: #000000;
    --nav-bg-light: #424242; /* grey darken-3 */
    --grey-text: #616161;
}

/* DARK MODE COLORS (Terminal Theme - Neon Green) */
.dark-mode {
    --primary-color: #00ff00; /* Neon green */
    --primary-dark: #00b300;
    --background-light: #0d1a26;
    --text-color-light: #00ff00;
    --text-color-dark: #00ff00;
    --nav-bg-light: #003300;
    --grey-text: #009900;
    background-color: #0d1a26;
    color: var(--text-color-light);
}
.dark-mode a { color: #00ffff; }
.dark-mode a:hover { text-decoration: underline; }
.dark-mode .cv-card { 
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4); 
    border-color: var(--primary-color);
}
.dark-mode .divider { 
    background-image: linear-gradient(to right, transparent, var(--primary-color), transparent);
}

/* --- UTILITY CLASS MAPPING --- */
/* These classes ensure structural elements pick up the current primary theme color */
.light-green-bg {
    background-color: var(--primary-color) !important;
}
.light-green-text {
    color: var(--primary-color) !important;
}
.light-green-text-darken-3 {
    color: var(--primary-dark) !important;
}
.cv-topborder.light-green {
    background-color: var(--primary-color);
}
.new-badge.light-green {
    background-color: var(--primary-color);
}


/* --- THEME SWITCH STYLES --- */
.theme-switch-container {
    position: fixed;
    top: 10px;
    right: 20px;
    display: flex;
    align-items: center;
    z-index: 1000;
}
.switch-text {
    font-size: 0.8em;
    margin-right: 10px;
}
.switch-label {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin-right: 10px;
}
.switch-label input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary-color); /* Dark/Off state */
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--background-light);
    transition: .4s;
}
input:checked + .slider {
    background-color: var(--primary-color); /* Light/On state */
}
input:checked + .slider:before {
    transform: translateX(26px);
    background-color: var(--text-color-dark);
}
.slider.round {
    border-radius: 34px;
}
.slider.round:before {
    border-radius: 50%;
}


/* --- A4 PAGE LAYOUT (Desktop) --- */
.cv-sidebar-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 200px;
    height: 100vh;
    background-color: var(--nav-bg-light);
    color: var(--background-light);
    padding: 20px 0;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
    transition: transform 0.3s ease; /* For mobile transition */
}
.cv-sidebar-nav ul {
    list-style: none;
}
.cv-main-content {
    margin-left: 200px; /* Offset for the sidebar */
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}
.a4-page {
    width: 210mm; 
    min-height: 297mm; 
    margin: 0;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background-color: var(--background-light);
    color: var(--text-color-light);
    border: 2px solid var(--text-color-dark);
    transition: all 0.3s;
}
.cv-card {
    background-color: var(--background-light);
    padding: 0;
}


/* --- NAVIGATION STYLING --- */
.cv-sidebar-nav a, .cv-sidebar-nav button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--primary-color);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.cv-sidebar-nav .light-green-bg a, 
.cv-sidebar-nav .light-green-bg {
    background-color: var(--primary-color) !important;
    color: var(--text-color-dark) !important;
}
/* FIX: Ensure high contrast for active nav item in dark mode */
.dark-mode .cv-sidebar-nav .light-green-bg a, 
.dark-mode .cv-sidebar-nav .light-green-bg {
    color: var(--background-light) !important;
}

.cv-sidebar-nav .white-bg {
    background-color: var(--background-light);
    margin-top: 15px;
}
.cv-sidebar-nav .white-bg a, 
.cv-sidebar-nav .white-bg button {
    color: var(--primary-dark) !important;
}


/* --- CV CONTENT STYLES (2-Column Desktop Layout) --- */
.cv-body-row {
    display: grid;
    grid-template-columns: 25% 75%;
    gap: 15px;
    margin-bottom: 15px;
    padding: 5px 0;
}

/* Nested grid for About section content */
.about-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* 2/3rds for summary, 1/3 for key focus */
    gap: 30px;
}
.about-key-focus .cv-list {
    margin-top: 5px;
}


.cv-title-col {
    font-size: 1.2em;
    font-weight: bold;
    text-transform: uppercase;
    text-align: right;
    color: var(--primary-dark);
    padding-right: 15px;
    border-right: 1px solid var(--grey-text);
}
.cv-content-col {
    text-align: left;
    padding-left: 15px;
}
.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Initials Box Styling */
.cv-initials-box {
    width: 150px; /* Same size as old image */
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5em; /* Large font for visibility */
    font-weight: bold;
    color: var(--text-color-dark); /* Contrast text color */
    border: 3px solid var(--primary-dark);
}
/* Ensure dark mode contrast for the initials box */
.dark-mode .cv-initials-box {
    color: var(--text-color-dark); /* Neon Green */
    border-color: var(--primary-color);
}
.cv-photowrapper {
    /* Base styles for wrapper (kept for structure) */
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto;
    overflow: hidden;
    border: 3px solid var(--text-color-dark);
}
.dark-mode .cv-photowrapper {
    border-color: var(--primary-dark);
    color: var(--background-light);
}


/* --- Project CTAs Styling --- */
.project-ctas {
    margin-top: 10px;
    display: flex;
    gap: 15px;
    padding-top: 5px;
    border-top: 1px dashed var(--grey-text);
}
.cta-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 0;
    font-size: 1.1em;
    font-weight: bold;
    border-bottom: 2px solid transparent;
}
.dark-mode .cta-link {
    color: var(
        --primary-color
    ); /* Brighter color for dark mode CTAs */
    border-bottom-color: var(--primary-color);
}
.light-mode .cta-link {
    color: var(--primary-dark);
    border-bottom-color: var(--primary-dark);
}
.cta-link:hover {
    border-bottom-color: var(--primary-color);
}
.cta-link i.material-icons {
    font-size: 1.1em;
}


/* --- Download CV Button (Call to Action) --- */
.download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 15px;
    border: 2px solid var(--primary-dark);
    color: var(--text-color-dark);
    background-color: var(--primary-color);
    font-family: inherit;
    font-size: 1em;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--primary-dark);
    transition: all 0.1s;
}
.download-button:hover {
    box-shadow: 2px 2px 0 var(--primary-dark);
    transform: translate(2px, 2px);
}
/* FIX: Ensure high contrast for download button in dark mode */
.dark-mode .download-button {
    color: var(--background-light); /* Use dark background color for text contrast */
    border-color: var(--primary-dark);
    background-color: var(--primary-color);
    box-shadow: 4px 4px 0 var(--primary-dark);
}

.download-button .material-icons {
    font-size: 1.2em;
}
.cv-personalinfo i.material-icons {
    /* NEW: Made icons smaller than the surrounding 1em text */
    font-size: 0.9em; 
    margin-right: 5px;
}
/* --- MOBILE SPECIFIC STYLES --- */
.menu-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    background-color: var(--nav-bg-light);
    color: var(--primary-color);
    border: none;
    padding: 8px;
    z-index: 1001;
    cursor: pointer;
    border-radius: 4px;
}
.hide-on-large {
    display: none;
}
.cv-sidebar-nav.hidden-nav {
    transform: translateX(-200px);
}
.cv-sidebar-nav.show-nav {
    transform: translateX(0);
}

/* --- Scroll to Top Button Styles --- */
#scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-dark);
    color: var(--background-light);
    border: none;
    padding: 12px; /* Slightly larger padding */
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0; /* Hidden by default */
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, background-color 0.3s;
    font-size: 1.5em;
    line-height: 1; 
}

#scroll-to-top:hover {
    background-color: var(--primary-color);
}
#scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}


/* --- MEDIA QUERIES (Mobile/Tablet Responsiveness) --- */
@media screen and (max-width: 1024px) {
    .a4-page {
        width: 100%;
        min-height: auto;
        padding: 20px;
    }
}

@media screen and (max-width: 768px) {
    /* Main Layout */
    body {
        padding-top: 50px; /* Make space for menu button */
    }
    .cv-main-content {
        margin-left: 0;
        padding: 10px;
    }
    .theme-switch-container {
        top: 10px;
        right: 10px;
    }

    /* Navigation Override (Hidden by default) */
    .cv-sidebar-nav {
        transform: translateX(-200px);
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
    }
    .cv-sidebar-nav.show-nav {
        transform: translateX(0);
    }
    .hide-on-large {
        display: block;
    }

    /* Two-Column Content Stacking */
    .cv-header-row {
        flex-direction: column;
        text-align: center;
    }
    .cv-pinfo-col {
        text-align: center;
    }
    .cv-personalinfo {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

    /* Content Layout Stacking */
    .cv-body-row {
        grid-template-columns: 100%; /* Single column */
        gap: 5px;
        margin-bottom: 25px;
    }
    /* About content also stacks */
    .about-content-grid {
        grid-template-columns: 100%;
        gap: 15px;
    }
    .cv-title-col {
        text-align: left;
        border-right: none;
        padding-right: 0;
        border-bottom: 1px dashed var(--grey-text);
        margin-bottom: 5px;
        padding-bottom: 5px;
    }
    .cv-content-col {
        padding-left: 0;
    }
    .skills-grid {
        grid-template-columns: 1fr; /* Stack skills on mobile */
    }
    .cv-photowrapper {
        margin-bottom: 10px;
    }
    
    /* Ensure project CTAs also stack/fit well */
    .project-ctas {
        flex-direction: column;
        gap: 5px;
    }
}


/* --- Print Styles (A4 Friendly) --- */
@media print {
    /* Hide all web elements not part of the A4 page */
    .cv-sidebar-nav, 
    .menu-toggle,
    .theme-switch-container,
    .project-ctas .cta-link,
    #scroll-to-top { /* Hide scroll button in print */
        display: none !important;
    }
    
    .cv-main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .a4-page {
        width: 100% !important;
        min-height: 100vh !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 15mm !important; /* Standard print margin */
        
        /* Force black/white print, regardless of dark mode */
        background-color: #ffffff !important;
        color: #000000 !important;
    }
    
    .cv-card, .cv-card *, .download-button {
        background-color: transparent !important;
        color: #000000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Force About section to print well (single column) */
    .about-content-grid {
        display: block !important;
    }
    
    .cv-photowrapper { border-color: #000000 !important; }
    .cv-title-col { border-right-color: #000000 !important; border-bottom-color: #000000 !important; }
    .cv-topborder { background-color: #000000 !important; }
    .new-badge { background-color: #999999 !important; color: #ffffff !important; }
    
    a { text-decoration: underline !important; }
}
/* --- A4 FOOTER STYLES --- */
.a4-footer {
    padding-top: 20px;
    margin-top: 30px;
    border-top: 1px dashed var(--grey-text);
    text-align: center;
    font-size: 0.9em;
}

#download-cv {
    /* Match retro button aesthetic */
    display: inline-block;
    padding: 8px 15px;
    margin: 15px auto 10px;
    border: 2px solid var(--primary-dark);
    color: var(--text-color-dark);
    background-color: var(--primary-color);
    font-family: inherit;
    font-size: 1.2em;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--primary-dark);
    transition: all 0.1s;
    font-weight: bold;
    text-transform: uppercase;
    line-height: 1;
}
#download-cv:hover {
    box-shadow: 2px 2px 0 var(--primary-dark);
    transform: translate(2px, 2px);
}
/* Dark mode styles for footer button */
.dark-mode #download-cv {
    color: var(--background-light); 
    border-color: var(--primary-dark);
    background-color: var(--primary-color);
    box-shadow: 4px 4px 0 var(--primary-dark);
}