:root {
    --dark-primary: #121212;
    --dark-secondary: #1E1E1E;
    --dark-tertiary: #2D2D2D;
    --accent-color: #BB86FC;
    --accent-color-light: #CF9EFF;
    --text-primary: #E1E1E1;
    --text-secondary: #A0A0A0;
    --text-tertiary: #7A7A7A;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --card-bg: #252525;

    --light-primary: #FFFFFF;
    --light-secondary: #F5F5F5;
    --light-tertiary: #E0E0E0;
    --light-text-primary: #333333;
    --light-text-secondary: #555555;
    --light-shadow-color: rgba(0, 0, 0, 0.1);
    --light-card-bg: #FFFFFF;
}

/* ========== Base ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--dark-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== Theme Toggle ========== */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.theme-toggle {
    background-color: var(--dark-secondary);
    color: var(--text-primary);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px var(--shadow-color);
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle i {
    position: absolute;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.theme-toggle .fa-moon {
    opacity: 1;
    transform: translateY(0);
}

.theme-toggle .fa-sun {
    opacity: 0;
    transform: translateY(100%);
}

body.light-mode .theme-toggle .fa-moon {
    opacity: 0;
    transform: translateY(-100%);
}

body.light-mode .theme-toggle .fa-sun {
    opacity: 1;
    transform: translateY(0);
}

/* ========== Header ========== */
header {
    background-color: var(--dark-secondary);
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: background-color 0.3s ease;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ========== Navigation ========== */
nav {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--dark-secondary);
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: background-color 0.3s ease;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem 1.1rem;
    border-radius: 6px;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

nav a:hover,
nav a.nav-active {
    background-color: var(--accent-color);
    color: var(--dark-primary);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.4rem;
    margin-right: auto;
}

/* ========== Full-width section wrapper ========== */
.full-width-section {
    width: 100%;
}

.full-width-section.dark-bg {
    background-color: var(--dark-secondary);
}

/* ========== Sections ========== */
section {
    padding: 5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ========== Hero ========== */
.hero {
    background: linear-gradient(135deg, var(--dark-secondary), var(--dark-primary));
    text-align: center;
    padding: 7rem 2rem 10rem;
    position: relative;
    overflow: hidden;
    max-width: none;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(187, 134, 252, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.highlight {
    color: var(--accent-color);
}

.hero p {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin: 0 auto 2.5rem;
    max-width: 600px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-color);
    color: var(--dark-primary);
    padding: 0.9rem 2rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid var(--accent-color);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--accent-color-light);
    border-color: var(--accent-color-light);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(187, 134, 252, 0.4);
}

.btn.btn-outline {
    background-color: transparent;
    color: var(--accent-color);
}

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

.btn .btn-loading {
    display: none;
    position: absolute;
}

.btn.loading .btn-text {
    visibility: hidden;
}

.btn.loading .btn-loading {
    display: flex;
}

/* ========== Scroll indicator ========== */
.hero-scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
}

.mouse {
    width: 25px;
    height: 40px;
    border: 2px solid var(--text-secondary);
    border-radius: 60px;
    position: relative;
}

.mouse::before {
    content: '';
    width: 5px;
    height: 5px;
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: wheel 2s infinite;
}

@keyframes wheel {
    to {
        opacity: 0;
        top: 25px;
    }
}

/* ========== Section titles ========== */
.section-title {
    text-align: center;
    margin-bottom: 4rem;
    font-size: 2.5rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background-color: var(--accent-color);
    margin: 1rem auto 0;
    border-radius: 2px;
}

/* ========== About ========== */
.about-container {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.about-img {
    flex: 1;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow-color);
    max-width: 420px;
}

.about-img img {
    width: 100%;
    height: auto;
    display: block;
}

.about-text {
    flex: 1.2;
}

.about-text p {
    margin-bottom: 1.3rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
}

.about-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 2.5rem;
    gap: 1rem;
}

.stat-item {
    text-align: center;
    flex: 1;
    background-color: var(--card-bg);
    padding: 1.5rem 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 0.4rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== Projects ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px var(--shadow-color);
}

.project-img {
    height: 220px;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.project-card:hover .project-img {
    transform: scale(1.04);
}

.project-info {
    padding: 1.5rem;
    transition: background-color 0.3s ease;
}

.project-card:hover .project-info {
    background-color: var(--dark-tertiary);
}

.project-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.7rem;
    color: var(--accent-color);
    transition: color 0.3s ease;
}

.project-card:hover .project-info h3 {
    color: var(--accent-color-light);
}

.project-info p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-tags span {
    background-color: var(--dark-tertiary);
    color: var(--text-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.project-card:hover .project-tags span {
    background-color: rgba(187, 134, 252, 0.2);
    color: var(--accent-color-light);
}

.view-more {
    margin-top: 3rem;
    text-align: center;
}

/* ========== Skills ========== */
.skills-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.skill-item {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.skill-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow-color);
}

.skill-icon {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 1.2rem;
}

.skill-item h3 {
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
}

.skill-bar {
    height: 8px;
    background-color: var(--dark-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.skill-level {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-color-light));
    width: 0;
    border-radius: 4px;
    transition: width 1.5s ease;
}

/* ========== Contact ========== */
.contact-container {
    display: flex;
    gap: 3rem;
}

.contact-info {
    flex: 1;
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.contact-info h3 {
    font-size: 1.4rem;
    margin-bottom: 2rem;
    color: var(--accent-color);
}

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

.info-item i {
    font-size: 1.1rem;
    color: var(--accent-color);
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.contact-form {
    flex: 1.2;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--dark-tertiary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(187, 134, 252, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

.form-group textarea {
    height: 150px;
    resize: vertical;
}

.form-message {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    display: none;
    font-size: 0.95rem;
}

.form-message.success {
    background-color: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: #2ecc71;
    display: block;
}

.form-message.error {
    background-color: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.4);
    color: #e74c3c;
    display: block;
}

/* ========== Social Links ========== */
.social-links {
    display: flex;
    gap: 1.2rem;
    margin-top: 2rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-links a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}

/* ========== Footer ========== */
footer {
    background-color: var(--dark-secondary);
    padding: 4rem 2rem 2rem;
    transition: background-color 0.3s ease;
    position: relative;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto 3rem;
    gap: 3rem;
}

.footer-logo h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.footer-logo p {
    color: var(--text-secondary);
}

.footer-links h3 {
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
    color: var(--accent-color);
}

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

.footer-links li {
    margin-bottom: 0.7rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--dark-tertiary);
    color: var(--text-secondary);
    max-width: 1200px;
    margin: 0 auto;
}

/* ========== Back to top ========== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background-color: var(--accent-color);
    color: var(--dark-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(187, 134, 252, 0.4);
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--accent-color-light);
    transform: translateY(-3px);
}

/* ========== Animations ========== */
.animate-fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s ease forwards;
}

.animate-delay-1 { animation-delay: 0.3s; }
.animate-delay-2 { animation-delay: 0.6s; }

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.animate-delay-1 { transition-delay: 0.15s; }
.animate-on-scroll.animate-delay-2 { transition-delay: 0.3s; }

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Light Mode ========== */
body.light-mode {
    background-color: var(--light-primary);
    color: var(--light-text-primary);
}

body.light-mode header,
body.light-mode nav,
body.light-mode .full-width-section.dark-bg,
body.light-mode footer {
    background-color: var(--light-secondary);
}

body.light-mode .theme-toggle {
    background-color: var(--light-secondary);
    color: var(--light-text-primary);
}

body.light-mode nav a {
    color: var(--light-text-primary);
}

body.light-mode nav a:hover,
body.light-mode nav a.nav-active {
    color: var(--dark-primary);
}

body.light-mode .hero {
    background: linear-gradient(135deg, var(--light-secondary), var(--light-primary));
}

body.light-mode .hero p,
body.light-mode .about-text p,
body.light-mode .project-info p,
body.light-mode .stat-label,
body.light-mode .footer-logo p,
body.light-mode .footer-links a,
body.light-mode .footer-bottom,
body.light-mode .social-links a,
body.light-mode .info-item span {
    color: var(--light-text-secondary);
}

body.light-mode .project-card,
body.light-mode .skill-item,
body.light-mode .contact-info,
body.light-mode .stat-item,
body.light-mode .form-group input,
body.light-mode .form-group textarea {
    background-color: var(--light-card-bg);
    box-shadow: 0 4px 15px var(--light-shadow-color);
}

body.light-mode .project-tags span {
    background-color: var(--light-tertiary);
    color: var(--light-text-primary);
}

body.light-mode .skill-bar {
    background-color: var(--light-tertiary);
}

body.light-mode .form-group input,
body.light-mode .form-group textarea {
    border-color: var(--light-tertiary);
    color: var(--light-text-primary);
}

body.light-mode .footer-bottom {
    border-top-color: var(--light-tertiary);
}

body.light-mode .hamburger {
    color: var(--light-text-primary);
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .about-container,
    .contact-container {
        flex-direction: column;
    }

    .about-img {
        max-width: 420px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    nav {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.8rem 1.2rem;
        gap: 0;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0.5rem 0 0.8rem;
        gap: 0.2rem;
    }

    .nav-links.open {
        display: flex;
    }

    nav a {
        width: 100%;
        padding: 0.6rem 1rem;
    }

    .hero h1 {
        font-size: 2.4rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 3rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .skills-container {
        grid-template-columns: 1fr 1fr;
    }

    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }

    .about-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.6rem;
    }

    .hero {
        padding: 5rem 1.5rem 8rem;
    }

    .hero h1 {
        font-size: 1.9rem;
    }

    section {
        padding: 3.5rem 1.2rem;
    }

    .skills-container {
        grid-template-columns: 1fr;
    }
}
