/* Modern CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Variables */
:root {
    /* Light Theme */
    --primary-color: #7234ad;
    --primary-color-rgb: 114, 52, 173;
    --secondary-color: #0066ad;
    --accent-yellow: #ffbf1f;
    --accent-green: #0b8500;
    --accent-red: #8e0c16;
    --bg-color: #f8f7fc;
    --bg-color-rgb: 248, 247, 252;
    --text-color: #2d2b38;
    --text-color-light: #6b6a75;
    --input-bg: #ffffff;
    --input-bg-rgb: 255, 255, 255;
    --input-border: #7234ad;
    --card-bg: #ffffff;
    --footer-bg: #f1eef8;
    --shadow-color: rgba(114, 52, 173, 0.1);
    --header-height: 60px;
    --container-width: 80%;
    --section-padding: 6rem 0;
}

:root[data-theme='dark'] {
    --primary-color: #7234ad;
    --primary-color-rgb: 114, 52, 173;
    --secondary-color: #0066ad;
    --accent-yellow: #ffbf1f;
    --accent-green: #0b8500;
    --accent-red: #8e0c16;
    --bg-color: #1a1721;
    --bg-color-rgb: 26, 23, 33;
    --text-color: #e6e5ea;
    --text-color-light: #a09fa7;
    --input-bg: #2d2838;
    --input-bg-rgb: 45, 40, 56;
    --input-border: #7234ad;
    --card-bg: #2d2838;
    --footer-bg: #211e29;
    --shadow-color: rgba(114, 52, 173, 0.2);
    --header-height: 60px;
    --container-width: 80%;
    --section-padding: 6rem 0;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    transition: color 0.3s;
}

.theme-toggle:hover {
    color: var(--primary-color);
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Base */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.section {
    padding: var(--section-padding);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--bg-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.nav {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav.container {
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo img {
    height: 2.5rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.nav-list {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-weight: 500;
    transition: color 0.3s;
}

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

.nav-toggle {
    display: none;
}

/* Home */
/* Three.js and Particles Combined Hero */
.three-js-hero {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

#three-js-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
}

.particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.8;
    pointer-events: none;
}

.three-js-hero .home-content {
    position: relative;
    z-index: 3;
    padding-top: var(--header-height);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.home-content {
    text-align: center;
}

.home-title {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.home-description {
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

/* About */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.skills-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.skill-item {
    background-color: var(--skill-bg);
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.skill-name {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: rgba(var(--primary-color-rgb), 0.15);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    position: absolute;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    width: 0;
    transition: width 1s ease-out;
    box-shadow: 0 0 5px rgba(var(--primary-color-rgb), 0.5);
}

.progress-fill.animate {
    animation: fillProgress 1s ease-out forwards;
}

@keyframes fillProgress {
    from { width: 0; }
    to { width: var(--progress); }
}

/* Projects */
.projects-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    width: 100%;
}

.project-card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    transition: transform 0.3s;
    height: 100%;
    width: 300px;
    flex-grow: 0;
    box-shadow: 0 4px 10px var(--shadow-color);
}

.project-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.project-description {
    margin-bottom: 1rem;
    flex: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    margin-top: auto;
}

.project-tag {
    background-color: var(--primary-color);
    color: var(--bg-color);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.875rem;
}

.project-link {
    display: inline-block;
    margin-top: auto;
}

/* Contact */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.error-message {
    color: var(--accent-red);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.captcha-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.captcha-group img {
    border-radius: 0.5rem;
    border: 1px solid var(--input-border);
}

.captcha-group input {
    max-width: 150px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    font-family: inherit;
    transition: border-color 0.3s, background-color 0.3s;
    background-color: rgba(var(--bg-color-rgb), 0.3);
    color: var(--text-color);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.form-group textarea {
    height: auto;
    min-height: 150px;
    max-height: 400px;
    resize: none;
    overflow-y: auto;
}

/* Autofill styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px rgba(var(--bg-color-rgb), 0.7) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
    background-color: rgba(var(--input-bg-rgb), 0.3);
    transition: background-color 5000s ease-in-out 0s;
}

[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px rgba(var(--bg-color-rgb), 0.7) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
    background-color: rgba(var(--input-bg-rgb), 0.3);
}
.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-color: var(--primary-color);
    border-radius: 12px;
    border: 3px solid;
    background-color: rgba(var(--input-bg-rgb), 0.3);
    color: var(--primary-color);
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    backdrop-filter: blur(2px);
}

.button:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    transform: translateY(-1px);
    backdrop-filter: blur(5px);
}

.button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}
.form-group.captcha-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.captcha-image {
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    height: 40px;
}

.refresh-captcha {
    padding: 0.5rem;
    font-size: 1.25rem;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.captcha-input {
    flex: 1;
}

.footer {
    background-color: var(--footer-bg);
    padding: 2rem 0;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --container-width: 100%;
        --section-padding: 4rem 0;
    }
    
    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background-color: var(--bg-color);
        transition: left 0.3s;
        z-index: 99;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        padding-top: 2rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-list {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    
    .nav-link {
        font-size: 1.2rem;
    }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        cursor: pointer;
        z-index: 100;
    }

    .nav-toggle span {
        display: block;
        width: 1.5rem;
        height: 2px;
        background-color: var(--text-color);
        transition: 0.3s;
    }

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

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

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

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .home-title {
        font-size: 2.5rem;
    }
}

/* Contact Form Enhancements */
.captcha-image {
    display: block;
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.refresh-captcha {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.error-message {
    color: var(--accent-red);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-group input:disabled,
.form-group textarea:disabled,
button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Autofill styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-color) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Dark theme autofill */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-color) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
}
.three-js-hero {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
}

#three-js-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
}

.three-js-hero .home-content {
    position: relative;
    z-index: 3;
}
