/* Basic Reset & Global Styles */
:root {
    /* Light Mode Colors */
    --primary-color: #1a73e8; /* A vibrant, attractive blue */
    --secondary-color: #6c757d; /* Grey for secondary text */
    --background-color: #f8f9fa; /* Light background */
    --card-background: #ffffff; /* White for cards/sections */
    --text-color: #343a40; /* Dark grey for main text */
    --heading-color: #212529; /* Even darker for headings */
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);

    /* Specific colors for contact icons */
    --linkedin-blue: #0077B5;
    --gmail-red: #EA4335;
    --github-black: #333; /* GitHub should remain black */
}

/* Dark Mode Colors */
body.dark-mode {
    --primary-color: #4CAF50; /* A pleasant green for dark mode accents */
    --secondary-color: #B0BEC5; /* Lighter grey for secondary text */
    --background-color: #1a202c; /* Dark background */
    --card-background: #2d3748; /* Darker cards/sections */
    --text-color: #e2e8f0; /* Light grey for main text */
    --heading-color: #edf2f7; /* Lighter for headings */
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    scroll-behavior: smooth;
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition for theme change */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Make section headings bigger */
h2 {
    font-size: 2.8rem;
    color: var(--heading-color);
    margin-bottom: 40px;
    text-align: center;
}

h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    color: #fff;
    text-align: center;
}

h3 {
    font-size: 1.6rem;
    margin-bottom: 15px;
    color: var(--heading-color);
    text-align: left;
}

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

a:hover {
    color: var(--primary-color); /* Maintain primary color on hover */
    filter: brightness(0.8); /* Slightly dim for hover effect */
}

section {
    padding: 0;
    text-align: center;
    position: relative;
    z-index: 1;
    background-color: var(--background-color);
    transition: background-color 0.3s ease; /* Smooth transition for theme change */
}

/* --- Header & Navigation --- */
header {
    background-color: var(--card-background);
    box-shadow: 0 2px 5px var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease; /* Smooth transition for theme change */
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

nav .logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li {
    margin-left: 30px;
}

.nav-links a {
    font-size: 1.1rem;
    padding: 5px 0;
    position: relative;
    color: var(--text-color); /* Ensure nav links change color */
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    display: block;
    margin-top: 5px;
    right: 0;
    background: var(--primary-color);
    transition: width 0.3s ease, background-color 0.3s ease; /* Smooth transition for theme change */
}

.nav-links a:hover::after,
.nav-links a.active-nav::after { /* New: active state for navigation */
    width: 100%;
    left: 0;
    background: var(--primary-color);
}

/* Theme Switch Styles */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-left: 20px; /* Adjust spacing as needed */
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Burger Menu (for mobile) */
.burger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-around;
    width: 25px;
    height: 20px;
}

.burger div {
    width: 100%;
    height: 3px;
    background-color: var(--text-color);
    transition: all 0.3s ease;
}

/* --- Hero Section --- */
.hero {
    background: linear-gradient(to right, var(--primary-color), #00bfff);
    color: #fff;
    padding: 100px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    transition: background 0.3s ease; /* Smooth transition for theme change */
}

.hero-content .tagline {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: rgba(255, 255, 255, 0.9);
    min-height: 1.5em;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cursor {
    display: inline-block;
    background-color: #fff;
    width: 2px;
    height: 1.2em;
    margin-left: 5px;
    vertical-align: middle;
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero .profile-pic {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 10px var(--shadow-medium);
    margin-top: 20px;
}

/* --- Main Section Boxes (About, Education, Skills, Tools, Projects) --- */
.section-box {
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-light);
    margin: 60px auto;
    padding: 60px 0;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.3s ease; /* Smooth transition for theme change */
    max-width: 1100px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1;
}

.section-box:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px var(--shadow-medium);
}

.section-box .container {
    position: relative;
    z-index: 2;
}

/* --- About Section --- */
.about p {
    max-width: 900px;
    margin: 0 auto;
    font-size: 1.18rem;
    line-height: 1.8;
    text-align: left;
    padding: 0 40px;
    color: var(--text-color); /* Ensure text color changes */
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

/* Highlighted text in About Me */
.about p .highlight-text {
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

/* --- Education Section --- */
.education-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
    justify-items: center;
}

.education-item {
    text-align: left;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    color: var(--text-color); /* Ensure text color changes */
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.education-item h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.education-item .institution {
    font-size: 1.1rem;
    color: var(--heading-color);
    margin-bottom: 5px;
    font-weight: bold;
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.education-item .dates {
    font-size: 0.95rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.education-item .details {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

/* Highlighted text in Education */
.education-item .highlight-text {
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

/* --- Individual Box Item Styling (for Skills, Tools, Projects, Education) --- */
.box-item {
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-light);
    margin: 0;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.3s ease; /* Smooth transition for theme change */
    border: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1;
}

.box-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-medium);
}


/* --- Skills & Tools Sections (Adjusted for individual boxes) --- */
.skill-icons, .tool-icons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 25px;
    margin-top: 40px;
    justify-items: center;
}

.skill-item, .tool-item {
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
    color: var(--text-color);
    width: 100%;
    max-width: 200px;
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.skill-item .skill-icon,
.tool-item .tool-icon {
    width: 70px;
    height: 70px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

body.dark-mode .skill-item .skill-icon,
body.dark-mode .tool-item .tool-icon {
    filter: invert(100%) grayscale(100%); /* Invert and grayscale for dark mode */
}

.skill-item:hover .skill-icon,
.tool-item:hover .tool-icon {
    filter: grayscale(0%);
    opacity: 1;
    transform: translateY(-5px) scale(1.05);
}

body.dark-mode .skill-item:hover .skill-icon,
body.dark-mode .tool-item:hover .tool-icon {
    filter: invert(0%) grayscale(0%); /* Restore original colors on hover in dark mode */
}


/* --- Projects Section --- */
.project-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* FORCES TWO COLUMNS ON LARGER SCREENS */
    gap: 30px;
    margin-top: 40px;
}

.project-item {
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 30px;
    color: var(--text-color); /* Ensure text color changes */
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.project-item .project-image {
    width: 100%;
    height: 210px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.project-item h3 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--heading-color);
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.project-item p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--secondary-color);
    flex-grow: 1;
    transition: color 0.3s ease; /* Smooth transition for theme change */
}

.project-link {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    align-self: flex-start;
}

.project-link:hover {
    background-color: var(--primary-color); /* Maintain primary color on hover */
    filter: brightness(0.8);
}

/* Project Tags Container */
.project-tags {
    margin-top: 10px;
    margin-bottom: 15px; /* Adjust spacing as needed */
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* Space between tags */
}

/* Individual Tag Style */
.tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px; /* Pill shape */
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--card-background); /* Tag text color */
    background-color: var(--primary-color); /* Tag background color */
    transition: background-color 0.3s ease;
}

/* Dark mode tag colors */
body.dark-mode .tag {
    color: var(--background-color);
    background-color: var(--primary-color);
}

/* New Styles for "View All Projects" and "Back to Portfolio" buttons */
.view-all-projects, .back-to-portfolio {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px; /* Add some space above the button */
}

.primary-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 12px 25px;
    border-radius: 7px;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.3s ease;
    text-decoration: none; /* Remove underline */
    box-shadow: 0 4px 8px var(--shadow-light);
}

.primary-button:hover {
    background-color: var(--primary-color); /* Maintain primary color on hover */
    filter: brightness(0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--shadow-medium);
}


/* --- Contact Section & Footer --- */
.contact {
    background-color: var(--background-color);
    padding: 80px 20px;
    transition: background-color 0.3s ease; /* Smooth transition for theme change */
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin-top: 40px;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
    position: static;
    overflow: visible;
    z-index: auto;
    transition: transform 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-5px);
    box-shadow: none;
}

.contact-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-color);
    transition: color 0.3s ease;
    position: relative;
    z-index: 2;
}

.contact-item a span {
    margin-top: 5px;
}

.contact-icon {
    width: 60px;
    height: 60px;
    object-fit: contain;
    transition: transform 0.3s ease, filter 0.3s ease;
}

/* Invert contact icons in dark mode */
body.dark-mode .contact-icon {
    filter: invert(100%);
}


footer {
    background-color: var(--heading-color);
    color: #fff;
    text-align: center;
    padding: 20px 0;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition for theme change */
}

/* --- Responsive Design (Media Queries) --- */
@media (max-width: 768px) {
    /* Navigation */
    .nav-links {
        position: absolute;
        right: 0;
        top: 60px;
        background-color: var(--card-background);
        box-shadow: 0 5px 10px var(--shadow-light);
        flex-direction: column;
        width: 100%;
        text-align: center;
        transform: translateX(100%);
        transition: transform 0.5s ease-in-out;
    }

    .nav-links.nav-active {
        transform: translateX(0%);
    }

    .nav-links li {
        margin: 0;
        padding: 15px 0;
        border-bottom: 1px solid #eee;
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .burger {
        display: flex;
    }

    /* Hero Section */
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content .tagline {
        font-size: 1.2rem;
    }

    /* General Sections */
    section {
        padding: 0;
    }

    .section-box {
        margin: 30px auto;
        padding: 40px 0;
    }

    h2 {
        font-size: 2rem;
        margin-bottom: 25px;
    }

    /* About Me text responsiveness */
    .about p {
        font-size: 1rem;
        padding: 0 20px;
        text-align: center;
    }

    /* Education Section responsiveness */
    .education-timeline {
        grid-template-columns: 1fr;
    }

    .education-item h3 {
        font-size: 1.3rem;
    }

    .skill-icons, .tool-icons {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 20px;
    }

    .skill-item, .tool-item {
        padding: 20px;
        max-width: 160px;
    }

    .skill-item .skill-icon,
    .tool-item .tool-icon {
        width: 50px;
        height: 50px;
    }

    .contact {
        padding: 40px 20px;
    }

    .contact-links {
        gap: 20px;
    }

    .contact-item {
        /* No specific padding/sizing for mobile, relies on grid/flex behavior */
    }

    .contact-icon {
        width: 40px;
        height: 40px;
    }

    .project-list {
        /* ENSURES A SINGLE COLUMN ON SMALLER SCREENS */
        grid-template-columns: 1fr;
    }

    .project-item .project-image {
        height: 150px;
    }

    .theme-switch-wrapper {
        margin-left: auto; /* Push to the right on smaller screens */
        margin-right: 20px;
    }

    /* New button responsive styles */
    .primary-button {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

/* Burger Animation */
.toggle .line1 {
    transform: rotate(-45deg) translate(-5px, 6px);
}
.toggle .line2 {
    opacity: 0;
}
.toggle .line3 {
    transform: rotate(45deg) translate(-5px, -6px);
}
