/* Light Theme (Default) */
:root {
    --primary-color: #2b6777; /* Deep Teal */
    --secondary-color: #52ab98; /* Muted Green */
    --accent-color: #c8d8e4; /* Light Blue-Gray */
    --background-color: #f2f2f2; /* Light Gray */
    --text-color: #0d1b2a; /* Dark Navy */
    --card-bg-color: #ffffff; /* White */
    --shadow-color: rgba(0,0,0,0.1);
    --header-overlay-color: rgba(27, 38, 59, 0.7); /* Dark Blue Overlay */
}

/* Dark Theme */
html.dark-mode {
    --primary-color: #0d1b2a;
    --secondary-color: #1b263b;
    --accent-color: #e0b1cb;
    --background-color: #0d1b2a;
    --text-color: #e0e1dd;
    --card-bg-color: #1b263b;
    --shadow-color: rgba(0,0,0,0.4);
    --header-overlay-color: rgba(13, 27, 42, 0.8);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

/* Preloader Styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--secondary-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.container {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

header {
    background-image: linear-gradient(var(--header-overlay-color), var(--header-overlay-color)), url('iitkgp.jfif');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: white;
    padding: 6rem 1rem;
    text-align: center;
}

#typed-text {
    color: var(--accent-color);
    font-weight: bold;
}

nav {
    display: flex;
    justify-content: center;
    background-color: var(--primary-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px var(--shadow-color);
}

nav a {
    color: white;
    margin: 0 1.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--accent-color);
}

.hamburger {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    cursor: pointer;
}

.bar1, .bar2, .bar3 {
    height: 3px;
    width: 25px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: 0.4s;
}

.hamburger.active .bar1 { transform: rotate(-45deg) translate(-5px, 6px); }
.hamburger.active .bar2 { opacity: 0; }
.hamburger.active .bar3 { transform: rotate(45deg) translate(-5px, -6px); }

.section {
    margin-bottom: 2.5rem;
    background: var(--card-bg-color);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 16px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px var(--shadow-color);
}

#about {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-pic img {
    border-radius: 50%;
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 5px solid var(--primary-color);
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

html.dark-mode h2 {
    color: var(--accent-color);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.project-tags span {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.8em;
    margin-right: 0.5rem;
    display: inline-block;
    margin-top: 1rem;
}

.project-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

html.dark-mode .project-link {
    color: var(--accent-color);
}

.project-link:hover { text-decoration: underline; }

#achievements ul {
    list-style-type: '🏆 ';
    padding-left: 1.5rem;
}

#achievements ul li { margin-bottom: 0.8rem; }

#contact { text-align: center; }

#contact a {
    color: var(--primary-color);
    text-decoration: none;
}
html.dark-mode #contact a { color: var(--accent-color); }

#contact a:hover { text-decoration: underline; }

.social-media a {
    color: var(--primary-color);
    font-weight: bold;
    margin: 0 1rem;
}
html.dark-mode .social-media a { color: var(--accent-color); }

#contact a.btn {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.8rem 1.6rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: transform 0.2s, background-color 0.2s;
}
#contact a.btn:hover {
    transform: scale(1.05);
    background-color: var(--secondary-color);
    color: white; /* This line is added to fix the issue */
}

footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
}

.back-to-top, .theme-switcher {
    position: fixed;
    right: 2rem;
    background-color: var(--secondary-color);
    color: white;
    padding: 1rem;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 8px var(--shadow-color);
    transition: transform 0.3s ease, background-color 0.3s ease;
    border: none;
    font-size: 1rem;
    z-index: 999;
}

.back-to-top { bottom: 2rem; display: none; }
.theme-switcher { bottom: 6rem; }

.back-to-top:hover, .theme-switcher:hover {
    background-color: var(--primary-color);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    #about { flex-direction: column; text-align: center; }
    .hamburger { display: block; }

    nav {
        flex-direction: column;
        align-items: center;
        position: fixed;
        top: 0;
        left: -100%;
        width: 70%;
        height: 100vh;
        background-color: var(--primary-color);
        transition: left 0.3s ease-in-out;
        padding-top: 5rem;
    }
    nav.show-nav { left: 0; }
    nav a { margin: 1.5rem 0; font-size: 1.2rem; }
}