:root {
    /* Light Mode Variables */
    --primary-color: #6366f1;
    --secondary-color: #a855f7;
    --bg-color: #f0f4f8; 
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --input-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark Mode Variables */
body.dark-mode {
    --primary-color: #818cf8;
    --secondary-color: #c084fc;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-light: #94a3b8;
    --input-bg: #334155;
    --border-color: #475569;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
    font-family: var(--font-family);
    background: var(--bg-color);
    color: var(--text-color);
    margin: 0; line-height: 1.6; padding-top: 80px; 
    transition: background-color 0.3s ease, color 0.3s ease;
}
a { text-decoration: none; color: inherit; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 2rem; }

/* Header */
.navbar {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; 
    background: var(--card-bg); border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}
header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; }
.logo {
    font-weight: 800; font-size: 1.5rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
nav { display: flex; align-items: center; gap: 2rem; }
nav ul { list-style: none; display: flex; gap: 2rem; margin: 0; padding: 0; }
nav a.nav-link { font-weight: 600; color: var(--text-light); transition: color 0.3s; }
nav a.nav-link:hover, nav a.nav-link.active { color: var(--primary-color); }
#theme-toggle { background: none; border: 2px solid var(--border-color); color: var(--text-color); padding: 0.5rem; border-radius: 50%; cursor: pointer; transition: 0.3s; }
#theme-toggle:hover { background: var(--border-color); }

/* Hero */
#hero { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; padding: 4rem 0; }
.hero-content h1 { font-size: 3rem; font-weight: 800; line-height: 1.1; margin-bottom: 0.5rem; background: linear-gradient(to right, var(--primary-color), var(--secondary-color)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-content h2 { font-size: 1.5rem; margin-bottom: 1rem; color: var(--text-color); }
.tech-stack h3 { font-size: 0.9rem; text-transform: uppercase; color: var(--text-light); margin-bottom: 1rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 2rem; }
.tag { background-color: var(--card-bg); color: var(--text-color); border: 1px solid var(--border-color); padding: 0.5rem 1rem; border-radius: 99px; font-size: 0.9rem; font-weight: 500; transition: transform 0.2s; display: flex; align-items: center; gap: 0.5rem; }
.tag:hover { transform: translateY(-3px); border-color: var(--primary-color); }
.tag i { color: var(--primary-color); }

/* Buttons */
.cta-container { display: flex; gap: 1rem; margin-bottom: 2rem; }
.primary-btn, .secondary-btn, .back-btn {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.8rem 1.8rem; 
    border-radius: 99px; font-weight: 600; cursor: pointer; border: none; font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.primary-btn, .back-btn {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.primary-btn:hover, .back-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(99, 102, 241, 0.5); }
.secondary-btn { background: var(--card-bg); color: var(--text-color); border: 2px solid var(--border-color); }
.secondary-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }

/* Profile Image & Socials */
.social-links { display: flex; gap: 1.5rem; }
.social-icon { font-size: 1.8rem; color: var(--text-light); transition: 0.3s; }
.social-icon:hover { color: var(--primary-color); transform: translateY(-3px); }
.profile-image-container { display: flex; justify-content: center; }
.profile-image { width: 300px; height: 300px; object-fit: cover; border-radius: 30% 70% 70% 30%/30% 30% 70% 70%; border: 4px solid var(--card-bg); box-shadow: var(--shadow); animation: morph 8s ease-in-out infinite; }
@keyframes morph { 0%, 100% { border-radius: 60% 40% 30% 70%/60% 30% 70% 40%; } 50% { border-radius: 30% 60% 70% 40%/50% 60% 30% 60%; } }

/* Projects */
#projects { padding: 4rem 0; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.project-card { background-color: var(--card-bg); border-radius: 1rem; overflow: hidden; box-shadow: var(--shadow); transition: transform 0.3s ease; }
.project-card:hover { transform: translateY(-10px); }
.project-image { width: 100%; height: 200px; object-fit: cover; }
.project-content { padding: 1.5rem; }
.project-title { font-size: 1.2rem; font-weight: 700; color: var(--text-color); margin: 0; }
.project-links a { color: var(--text-light); font-size: 1.2rem; margin-left: 10px; transition: color 0.2s; }
.project-links a:hover { color: var(--primary-color); }

/* Contact Form */
#contact { padding: 4rem 0; text-align: center; }
.contact-wrapper { max-width: 600px; margin: 0 auto; }
.contact-form { margin-top: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.form-group input, .form-group textarea { width: 100%; padding: 1rem; border-radius: 0.5rem; border: 1px solid var(--border-color); background: var(--input-bg); color: var(--text-color); font-family: inherit; }

/* Footer - PERFECTLY CENTERED */
footer {
    padding: 2rem 0;
    text-align: center;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
footer .container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}
footer p { margin: 0; width: 100%; text-align: center; }

/* Certificate Grid */
.cert-container { padding-bottom: 100px; text-align: center; }
.cert-header { margin: 2rem 0 3rem 0; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; justify-items: center; }
.cert-image { width: 100%; max-width: 400px; border-radius: 1rem; box-shadow: var(--shadow); border: 4px solid var(--card-bg); transition: transform 0.3s; cursor: pointer; }
.cert-image:hover { transform: scale(1.05); }

/* Fixed Back Button */
.fixed-bottom-nav { position: fixed; bottom: 2rem; left: 0; width: 100%; display: flex; justify-content: center; z-index: 900; pointer-events: none; }
.fixed-bottom-nav .back-btn { pointer-events: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }

/* Modal (Lightbox) */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.9); backdrop-filter: blur(5px); }
.modal-content { margin: auto; display: block; width: 80%; max-width: 800px; max-height: 80vh; object-fit: contain; margin-top: 5%; border-radius: 8px; animation: zoomIn 0.3s; }
@keyframes zoomIn { from {transform:scale(0)} to {transform:scale(1)} }
.close-modal { position: absolute; top: 20px; right: 35px; color: #f1f1f1; font-size: 40px; font-weight: bold; cursor: pointer; }
#caption { margin: auto; display: block; width: 80%; max-width: 700px; text-align: center; color: #ccc; padding: 10px 0; font-size: 1.2rem; }

/* Interactive Elements */
.typing-text { color: var(--primary-color); position: relative; }
.typing-text::after { content: "|"; position: absolute; right: -10px; animation: blink 0.7s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.animation-wrapper { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; pointer-events: none; }
.particle { position: absolute; border-radius: 50%; opacity: 0.3; filter: blur(10px); animation: float 20s infinite linear; }
.p1 { width: 200px; height: 200px; background: var(--primary-color); top: -50px; left: -50px; }
.p2 { width: 300px; height: 300px; background: var(--secondary-color); bottom: -100px; right: -50px; animation-delay: -5s; }
.p3 { width: 150px; height: 150px; background: #6366f1; top: 40%; left: 60%; animation-delay: -10s; }
@keyframes float { 0% { transform: translate(0, 0) rotate(0deg); } 33% { transform: translate(30px, -50px) rotate(100deg); } 66% { transform: translate(-20px, 20px) rotate(200deg); } 100% { transform: translate(0, 0) rotate(360deg); } }

/* Mobile */
@media (max-width: 768px) {
    #hero { grid-template-columns: 1fr; text-align: center; }
    .profile-image-container { order: -1; }
    .profile-image { width: 220px; height: 220px; }
    header { flex-direction: column; gap: 1rem; }
    nav { width: 100%; justify-content: space-between; }
    nav ul { gap: 1rem; font-size: 0.9rem; }
    .cta-container { justify-content: center; }
    .tags { justify-content: center; }
}