/* Import Modern Font */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');

/* Define Color Variables for Light Mode */
:root {
    --background: #ffffff;
    --text: #264653;
    --heading: #2a9d8f;
    --button: #e76f51;
    --button-hover: #d65a3a;
    --link: #264653;
    --link-hover: #2a9d8f;
    --section-home: #ffffff;
    --section-about: #f8f9fa;
    --section-skills: #e9f5f2;
    --section-education: #f8f9fa;
    --section-projects: #e9f5f2;
    --section-contact: #f8f9fa;
}

/* Dark Mode Variables */
.dark-mode {
    --background: #121212;
    --text: #e0e0e0;
    --heading: #64b5f6;
    --button: #e57373;
    --button-hover: #ef5350;
    --link: #90caf9;
    --link-hover: #42a5f5;
    --section-home: #1e1e1e;
    --section-about: #242424;
    --section-skills: #1e1e1e;
    --section-education: #242424;
    --section-projects: #1e1e1e;
    --section-contact: #242424;
}

/* General Styles */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Section Styling */
.section {
    padding: 100px 20px;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-color: var(--section-home); /* Default */
    transition: background-color 0.3s ease;
}

/* Assign Section Backgrounds */
#home { background-color: var(--section-home); position: relative; }
#about { background-color: var(--section-about); }
#skills { background-color: var(--section-skills); }
#education { background-color: var(--section-education); }
#projects { background-color: var(--section-projects); }
#contact { background-color: var(--section-contact); }

/* Content Animation */
.content {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    transition: all 0.8s ease-out;
}

.section.visible .content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Headings */
h1, h2, h3 {
    margin: 0 0 20px;
    color: var(--heading);
    font-weight: 500;
}

/* Button Styling */
.btn {
    display: inline-block;
    padding: 15px 30px;
    background-color: var(--button);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
}

.btn:hover {
    background-color: var(--button-hover);
    transform: scale(1.05);
}

.btn-secondary {
    background-color: var(--heading);
    margin-left: 15px;
}

.btn-secondary:hover {
    background-color: #247f73; /* Slightly darker teal */
}

/* Navigation */
header {
    background: var(--background);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

nav {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Navigation Menu Styles */
.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    transition: max-height 0.5s ease; /* For mobile menu slide-down effect */
}

/* Menu items animation */
.nav-menu li {
    margin: 0 25px;
    opacity: 1; /* Visible by default on desktop */
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.nav-menu.active li {
    opacity: 1;
    transform: translateY(0);
}

.nav-menu.active li:nth-child(1) { transition-delay: 0.1s; }
.nav-menu.active li:nth-child(2) { transition-delay: 0.2s; }
.nav-menu.active li:nth-child(3) { transition-delay: 0.3s; }
.nav-menu.active li:nth-child(4) { transition-delay: 0.4s; }
.nav-menu.active li:nth-child(5) { transition-delay: 0.5s; }
.nav-menu.active li:nth-child(6) { transition-delay: 0.6s; }

.nav-menu a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--link-hover);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: 0;
    left: 0;
    background-color: var(--link-hover);
    transition: width 0.4s ease;
}

.nav-menu a:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    font-size: 28px;
    color: var(--text);
    cursor: pointer;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
    transition: color 0.3s ease;
}

/* Home Section */
#home::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(42, 157, 143, 0.1) 20%, transparent 70%);
    z-index: -1;
    animation: pulseBackground 8s infinite;
}

@keyframes pulseBackground {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.home-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    width: 100%;
    padding: 0 20px;
}

.home-text {
    flex: 1;
    text-align: left;
}

.home-text h1 {
    font-size: 3.5em;
    line-height: 1.2;
}

.highlight {
    color: var(--button);
    font-weight: 500;
}

.typing {
    font-size: 1.8em;
    color: var(--heading);
    white-space: nowrap;
    overflow: hidden;
    border-right: 4px solid var(--heading);
    width: 0;
    display: inline-block;
}

.section.visible .typing {
    animation: typing 5s steps(20, end) infinite, blink 0.6s step-end infinite;
}

@keyframes typing {
    0% { width: 0; }
    50% { width: 70%; }
    100% { width: 70%; }
}

@keyframes blink {
    0%, 100% { border-color: transparent; }
    50% { border-color: var(--heading); }
}

.tagline {
    font-size: 1.2em;
    color: var(--text);
    margin: 15px 0 25px;
    opacity: 0.8;
}

.home-buttons {
    display: flex;
    gap: 15px;
}

.home-image {
    flex: 1;
    display: flex;
    justify-content: center;
}

.profile-pic {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--heading);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Particles in Home Section */
#home .particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

#home .particles div {
    position: absolute;
    background: rgba(42, 157, 143, 0.3);
    border-radius: 50%;
    animation: floatParticle linear infinite;
}

@keyframes floatParticle {
    0% { transform: translate(0, 0); }
    25% { transform: translate(20px, -50px); }
    50% { transform: translate(0, -100px); }
    75% { transform: translate(-20px, -50px); }
    100% { transform: translate(0, 0); }
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 0;
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.skill-item svg {
    position: relative;
}

.progress {
    transition: stroke-dashoffset 1s ease-in-out;
}

.skill-item span {
    margin-top: 10px;
    font-size: 1em;
    color: var(--text);
    font-weight: 400;
}

/* Timeline (Education) */
.timeline {
    max-width: 900px;
    margin: 30px auto;
}

.timeline-item {
    background: var(--background);
    padding: 25px;
    margin: 25px 0;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    text-align: left;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.6s ease;
}

.section.visible .timeline-item {
    opacity: 1;
    transform: scale(1);
}

.date {
    color: var(--heading);
    font-weight: 500;
}

/* Projects Section */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.project-card {
    background: var(--background);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
}

.project-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
}

/* Contact Section */
form {
    max-width: 700px;
    margin: 30px auto;
    text-align: left;
}

label {
    display: block;
    margin: 15px 0 5px;
    color: var(--text);
    font-weight: 500;
}

input, textarea {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    border: 2px solid var(--heading);
    border-radius: 10px;
    background: var(--background);
    color: var(--text);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

input:focus, textarea:focus {
    border-color: var(--button);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    outline: none;
}

textarea {
    height: 150px;
}

/* ----- Navbar Improvements for Mobile ----- */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
        font-size: 28px;
        cursor: pointer;
        position: absolute;
        right: 20px;
        top: 20px;
    }

    .nav-menu {
        flex-direction: column;
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background: var(--background);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
        z-index: 999;
        padding: 0;
    }

    .nav-menu.active {
        max-height: 350px;
        padding: 10px 0;
    }

    .nav-menu li {
        text-align: center;
        padding: 10px 0;
    }
}

/* ----- Home Section Improvements ----- */
@media (max-width: 768px) {
    .home-container {
        flex-direction: column;
        text-align: center;
    }

    .home-text h1 {
        font-size: 2.2em;
    }

    .typing {
        font-size: 1.1em;
    }

    .profile-pic {
        width: 180px;
        height: 180px;
        margin-top: 15px;
    }

    .home-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* ----- Skills Section Improvements ----- */
@media (max-width: 768px) {
    .skills-grid {
        grid-template-columns: repeat(2, minmax(80px, 1fr));
        gap: 15px;
    }

    .skill-item svg {
        width: 70px;
        height: 70px;
    }

    .skill-item span {
        font-size: 0.9em;
    }
}

/* ----- Further Adjustments for Extra Small Screens (Phones < 480px) ----- */
@media (max-width: 480px) {
    .home-text h1 {
        font-size: 1.8em;
    }

    .typing {
        font-size: 1em;
    }

    .profile-pic {
        width: 150px;
        height: 150px;
    }

    .skills-grid {
        grid-template-columns: repeat(2, minmax(60px, 1fr));
    }

    .skill-item svg {
        width: 60px;
        height: 60px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9em;
    }
}

/* ----- Preserve Original Education Section Styling on Small Screens ----- */
@media (max-width: 768px) {
    #education {
        padding: 100px 20px;
        min-height: 100vh;
    }
}
/* ----- Projects Section Improvements for Mobile Devices ----- */
@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: 1fr; /* Use one column for better stacking */
        gap: 20px;
        padding: 0 15px;
    }
    
    .project-card {
        padding: 15px;
    }
    
    .project-card h3 {
        font-size: 1.5em;
    }
    
    .project-card p {
        font-size: 1em;
    }
    
    .project-card a.btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }
}

/* Extra Small Devices (Phones < 480px) Adjustments for Projects Section */
@media (max-width: 480px) {
    .project-card h3 {
        font-size: 1.3em;
    }
    .project-card p {
        font-size: 0.9em;
    }
}
