/* 1. THEME VARIABLES (Light & Dark) */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;

    /* Light Mode Colors */
    --bg-body: #ffffff;
    --bg-section: #f9fafb;
    --bg-card: #ffffff;
    --bg-nav: rgba(255, 255, 255, 0.95);
    --text-main: #1f2937;
    --text-sub: #6b7280;
    --border-color: #eeeeee;
    --input-bg: #ffffff;

    --transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-body: #0f172a;
    --bg-section: #1e293b;
    --bg-card: #1e293b;
    --bg-nav: rgba(15, 23, 42, 0.95);
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --border-color: #334155;
    --input-bg: #0f172a;
}

/* 2. BASE & RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-main);
    background: var(--bg-body);
    overflow-x: hidden;
    transition: var(--transition);
}

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

.section {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

.section-title h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

.underline {
    width: 60px;
    height: 4px;
    background: var(--primary);
    margin: 0 auto;
    border-radius: 2px;
}


/* 3. PRELOADER */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-body);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
}

.loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loader-logo {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 1px;
    font-family: 'Poppins', sans-serif;
    animation: fadeInDown 0.8s ease-out;
}

.loader-logo span {
    color: var(--primary);
}

.loader-progress-container {
    width: 180px;
    height: 3px;
    background-color: rgba(79, 70, 229, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loader-progress-line {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    animation: loadingBar 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes loadingBar {
    0% {
        left: -100%;
    }

    50% {
        left: 0;
    }

    100% {
        left: 100%;
    }
}

@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

body.loading {
    overflow: hidden;
}


/* 4. NAVBAR */

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 0;
    background: var(--bg-nav);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.navbar.scrolled {
    padding: 12px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-size: 1.6rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-main);
}

.nav-logo span {
    color: var(--primary);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
    margin-left: auto;
}

.nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    padding: 5px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background: var(--primary);
    transition: 0.3s;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-cta {
    background: var(--primary);
    color: white !important;
    padding: 8px 20px;
    border-radius: 6px;
    margin-left: 10px;
}

.nav-cta::after {
    display: none;
}

/* Theme Toggle Swich in Nav */
.theme-switch {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-main);
    padding: 5px;
    transition: var(--transition);
}

.theme-switch:hover {
    color: var(--primary);
    transform: scale(1.1);
}


/* 5. HERO SECTION */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: var(--bg-section);
    padding-top: 80px;
    transition: var(--transition);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center;
}

.hero-tag {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 10px;
}

.hero-name {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 15px;
    color: var(--text-main);
}

.hero-name span {
    color: var(--primary);
}

.hero-title {
    font-size: 1.5rem;
    color: var(--text-sub);
    margin-bottom: 20px;
}

.hero-desc {
    margin-bottom: 30px;
    font-size: 1.1rem;
    color: var(--text-sub);
}

.hero-btns {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.hero-socials {
    display: flex;
    gap: 20px;
    font-size: 1.4rem;
}

.hero-socials a {
    color: var(--text-sub);
    transition: 0.3s;
}

.hero-socials a:hover {
    color: var(--primary);
    transform: translateY(-3px);
}

.img-box {
    width: 100%;
    max-width: 330px;
    border-radius: 30px;
    overflow: hidden;
    background: #eee;
    margin-left: auto;
    border: 3px solid var(--primary);
}

.img-box img {
    width: 100%;
    display: block;
}


/* 6. ABOUT SECTION */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.code-window {
    background: #1e1e3f;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.code-head {
    padding: 12px;
    background: #2d2d5a;
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.r {
    background: #ff5f56;
}

.dot.y {
    background: #ffbd2e;
}

.dot.g {
    background: #27ca40;
}

pre {
    padding: 25px;
    color: #fff;
    font-size: 0.85rem;
    overflow-x: auto;
}

.purple {
    color: #c792ea;
}

.blue {
    color: #82aaff;
}

.green {
    color: #c3e88d;
}

.about-text h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--text-main);
}

.about-info {
    margin-top: 30px;
    display: grid;
    gap: 10px;
    color: var(--text-sub);
}


/* 7. SKILLS SECTION */
.skills-flex {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.skill-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 130px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.skill-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.skill-card i {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.skill-card span {
    font-size: 0.8rem;
    font-weight: 600;
}



/* 8. PROJECTS SECTION  */

/* 1. Grid Layout */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 20px 0;
}

/* 2. Card Styling */
.p-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.p-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

/* 3. Image Section */
.p-img {
    height: 220px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: var(--bg-section);
}

.p-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform 0.6s ease;
}

.p-card:hover .p-img img {
    transform: scale(1.1);
}

/* 4. Overlay (Icons) */
.p-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(79, 70, 229, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    transition: all 0.4s ease;
    z-index: 5;
}

.p-card:hover .p-overlay {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.p-links {
    display: flex;
    gap: 15px;
}

/* Overlay Icons */

.p-link-icon {
    width: 45px;
    height: 45px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.p-link-icon:hover {
    background: #111 !important;
    color: #fff !important;
    transform: scale(1.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.p-link-icon i {
    font-size: 1.1rem;
    transition: 0.3s;
}

/* 5. Info Section */
.p-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.p-info h3 {
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 12px;
    font-weight: 700;
}

.p-info p {
    color: var(--text-sub);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
    overflow: visible;
}

/* 6. Tags Styling */
.p-tags {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.p-tags span {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}


/* 9. CERTIFICATES SECTION */
.certs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.cert-card {
    background: var(--bg-section);
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.cert-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.cert-icon {
    font-size: 2rem;
    color: var(--primary);
}

.cert-info h3 {
    color: var(--text-main);
    margin-bottom: 5px;
}

.cert-info .issuer {
    color: var(--text-sub);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.cert-tag {
    font-size: 0.7rem;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
}


/* 10. CONTACT SECTION */
.contact-wrapper {
    max-width: 700px;
    margin: 0 auto;
    background: var(--bg-section);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

#contact-form .form-group {
    margin-top: 10px;
}

.form-row .form-group {
    margin-top: 0;
}

.form-group label {
    margin-bottom: 8px;
    display: inline-block;
}

.btn-block {
    width: 100%;
    margin-top: 25px;
    display: block;
}

#submit-btn {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    cursor: pointer;
}

#submit-btn:hover {
    background-color: var(--primary-dark) !important;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
}

#submit-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(79, 70, 229, 0.2);
}


/* 11. FOOTER SECTION */
.footer {
    background: #111827;
    color: #f3f4f6;
    padding: 60px 0 0;
    margin-top: 50px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 50px;
    padding-bottom: 40px;
}

.footer-about .nav-logo {
    color: white;
    margin-bottom: 15px;
    display: inline-block;
}

.footer-about p {
    color: #9ca3af;
    font-size: 0.9rem;
    max-width: 300px;
}

.footer h4 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.3s;
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    width: 38px;
    height: 38px;
    background: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: 0.3s;
}

.social-icons a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding: 25px 0;
    text-align: center;
    font-size: 0.85rem;
    color: #9ca3af;
}


/* 12. RESPONSIVE DESIGN */

html,
body {
    width: 100%;
    overflow-x: hidden !important;
    position: relative;
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-body);
}

.loader-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.5s ease;
}

/* 3. Media Query for Tablets & Mobiles (Under 1024px) */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* 4. Media Query for Mobile (Under 768px) */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 85px;
        left: 20px;
        right: 20px;
        background: var(--bg-card);
        padding: 15px !important;
        border-radius: 15px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        border: 1px solid var(--border-color);
        z-index: 1000;
        gap: 8px !important;
        box-sizing: border-box !important;
    }

    .nav-menu.active {
        display: flex !important;
    }

    .nav-menu li {
        width: 100% !important;
        list-style: none !important;
    }

    .nav-link {
        display: block !important;
        width: 100% !important;
        padding: 12px 18px !important;
        font-size: 1rem;
        font-weight: 500;
        color: var(--text-main) !important;
        text-decoration: none !important;
        border-radius: 10px;
        transition: 0.3s ease;
        text-align: left;
        background: transparent !important;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(79, 70, 229, 0.08) !important;
        color: var(--primary) !important;
    }

    .nav-cta {
        margin-left: 0 !important;
        margin-top: 5px !important;
        padding: 12px 18px !important;
        background: transparent !important;
        color: var(--text-main) !important;
        font-weight: 500 !important;
        text-align: left !important;
        display: block !important;
        width: 100% !important;
    }

    .nav-cta.active,
    .nav-cta:hover {
        background: rgba(79, 70, 229, 0.08) !important;
        color: var(--primary) !important;
    }

    .theme-switch {
        margin-left: 0 !important;
        padding: 12px 18px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        transform: none !important;
        scale: 1 !important;
    }

    .theme-switch i {
        font-size: 1.1rem !important;
        width: 20px;
        text-align: center;
    }

    .nav-cta:hover,
    .nav-cta.active {
        background: rgba(79, 70, 229, 0.08) !important;
        color: var(--primary) !important;
    }

    .theme-switch {
        width: 100% !important;
        padding: 12px 18px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        cursor: pointer;
        border-radius: 10px;
        transition: 0.3s;
        margin-top: -2px !important;
        color: var(--text-main);
        scale: 1 !important;
    }

    .theme-switch:hover {
        background: rgba(79, 70, 229, 0.05) !important;
        transform: none !important;
        scale: 1 !important;
    }

    .nav-link::after {
        display: none !important;
    }

    .nav-toggle {
        display: flex !important;
    }

    /* Sections Reset */
    .hero-grid,
    .about-grid,
    .certs-grid,
    .form-row,
    .footer-grid {
        grid-template-columns: 1fr !important;
        text-align: center;
    }

    /* Hero Section */
    .hero {
        padding-top: 100px;
        text-align: center;
    }

    .hero-name {
        font-size: 2.2rem;
        line-height: 1.2;
    }

    .hero-btns {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .btn {
        width: 100%;
        max-width: 280px;
    }

    .hero-socials {
        justify-content: center;
    }

    .img-box {
        margin-top: -15px !important;
        margin-left: auto;
        margin-right: auto;
        max-width: 260px;
    }

    /* About Section */
    .about-text h3 {
        font-size: 1.5rem;
    }

    .code-window {
        margin-bottom: 30px;
    }

    pre {
        font-size: 0.75rem;
        white-space: pre-wrap;
        word-break: break-all;
    }

    /* Projects & Skills */
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .skills-flex {
        gap: 10px;
    }

    .skill-card {
        width: calc(50% - 10px);
        min-width: 120px;
    }

    /* Contact Form */
    .contact-wrapper {
        padding: 20px;
    }

    /* Footer */
    .footer-grid {
        padding-bottom: 50px !important;
        gap: 35px !important;
    }

    .footer-about p {
        margin: 0 auto 20px;
    }

    .social-icons {
        justify-content: center;
        margin-bottom: 13px;
    }
}

/* 5. Extra Small Screen  < 400px */
@media (max-width: 400px) {
    .container {
        padding: 0 15px;
    }

    .hero-name {
        font-size: 1.8rem;
    }

    .section-title h2 {
        font-size: 1.8rem;
    }

    .nav-logo {
        font-size: 1.3rem;
    }
}

[data-aos] {
    pointer-events: none;
}

.aos-animate {
    pointer-events: auto;
}


.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
    z-index: 1100;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* 3. Mobile Display */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex !important;
    }

    /* Dark mode support */
    [data-theme="dark"] .nav-toggle span {
        background-color: #ffffff;
    }
}