/* CSS Custom Properties for Theme */
:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --accent-primary: #4a90e2;
    --accent-secondary: #357abd;
    --card-bg: #ffffff;
    --border-color: #e1e5e9;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(74, 144, 226, 0.2);
    --overlay: rgba(255, 255, 255, 0.95);
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --hero-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --text-primary: #e6edf3;
    --text-secondary: #7d8590;
    --text-light: #656d76;
    --accent-primary: #58a6ff;
    --accent-secondary: #1f6feb;
    --card-bg: #21262d;
    --border-color: #30363d;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(88, 166, 255, 0.3);
    --overlay: rgba(13, 17, 23, 0.95);
    --navbar-bg: rgba(13, 17, 23, 0.95);
    --hero-gradient: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: color 0.3s ease, background-color 0.3s ease;
}

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

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--navbar-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 1000;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    z-index: 1001;
}

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

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 400;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

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

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

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.theme-toggle:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    transform: rotate(180deg);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 1001;
    padding: 0.5rem;
}

.hamburger span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

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

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

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

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: var(--hero-gradient);
    position: relative;
    padding: 80px 0 40px;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    min-height: 70vh;
}

.hero-text h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 300;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.hero-text h1 .accent {
    color: var(--accent-primary);
    font-weight: 700;
}

.hero-text p {
    font-size: clamp(1rem, 2vw, 1.1rem);
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

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

.btn-primary, .btn-secondary {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
    text-align: center;
    touch-action: manipulation;
}

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

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.philolo {
    width: 100%;
    max-width: 500px;
    height: auto;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 10px 25px var(--shadow);
    background: var(--accent-primary);
    transition: transform 0.3s ease;
}

.philolo:hover {
    transform: scale(1.05);
}

.social-links {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 10;
}

.social-links a {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    touch-action: manipulation;
    box-shadow: 0 2px 10px var(--shadow);
}

.social-links a:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    transform: scale(1.1);
}

/* Section Styles */
section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.section-line {
    width: 60px;
    height: 3px;
    background: var(--accent-primary);
    margin: 0 auto;
}

/* About Section */
.about {
    background: var(--bg-secondary);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text h3 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

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

.cv-download {
    margin-top: 2rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.skill-item {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.skill-item:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 15px 30px var(--shadow-hover);
}

.skill-item i {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
}

.skill-item:hover i {
    color: var(--accent-secondary);
    transform: scale(1.2) rotate(10deg);
}

.skill-item:nth-child(1) i { animation-delay: 0s; }
.skill-item:nth-child(2) i { animation-delay: 0.5s; }
.skill-item:nth-child(3) i { animation-delay: 1s; }
.skill-item:nth-child(4) i { animation-delay: 1.5s; }
.skill-item:nth-child(5) i { animation-delay: 2s; }
.skill-item:nth-child(6) i { animation-delay: 2.5s; }

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.skill-item span {
    font-weight: 500;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.skill-item:hover span {
    color: var(--accent-primary);
}

/* Education Section */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.education-item {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.education-item:hover {
    transform: translateY(-5px);
}

.education-icon {
    width: 60px;
    height: 60px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.education-icon i {
    color: var(--bg-primary);
    font-size: 1.5rem;
}

.education-item h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.education-item h4 {
    font-size: 1.1rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.education-item .year {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.education-item p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Projects Section */
.projects {
    background: var(--bg-secondary);
}

.project-showcase {
    max-width: 800px;
    margin: 0 auto;
}

.project-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

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

.project-image {
    height: 250px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-image::before {
    content: 'Instadev';
    color: var(--bg-primary);
    font-size: 2rem;
    font-weight: 600;
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(74, 144, 226, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-image:hover .project-overlay {
    opacity: 1;
}

.project-content {
    padding: 2rem;
}

.project-content h3 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.project-subtitle {
    color: var(--accent-primary);
    font-weight: 500;
    margin-bottom: 1rem;
}

.project-content > p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

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

.project-tech span {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.project-features ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.project-features li {
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.project-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: bold;
}

/* Interests Section */
.interests-intro {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.interests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.interest-item {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.interest-item:hover {
    transform: translateY(-5px);
}

.interest-icon {
    width: 60px;
    height: 60px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.interest-icon i {
    color: var(--bg-primary);
    font-size: 1.5rem;
}

.interest-item h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.interest-item p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Contact Section */
.contact {
    background: var(--bg-secondary);
}

.contact-intro {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

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

.contact-icon {
    width: 50px;
    height: 50px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-icon i {
    color: var(--bg-primary);
    font-size: 1.2rem;
}

.contact-details h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.contact-details p {
    color: var(--text-secondary);
}

.contact-social {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.contact-social a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.contact-social a:hover {
    background: var(--accent-secondary);
    transform: scale(1.1);
}

/* Contact Form */
.contact-form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow);
    border: 1px solid var(--border-color);
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

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

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

.error-message {
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: block;
}

.success-message {
    color: #27ae60;
    font-size: 0.9rem;
    margin-top: 1rem;
    padding: 10px;
    background: rgba(39, 174, 96, 0.1);
    border-radius: 5px;
    display: none;
    border: 1px solid #27ae60;
}

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

.footer-content p {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.footer-content p:last-child {
    margin-bottom: 0;
    opacity: 0.6;
    font-size: 0.9rem;
}

/* Theme Transition */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--card-bg);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px var(--shadow);
        padding: 2rem 0;
        border: 1px solid var(--border-color);
        border-top: none;
    }

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

    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .social-links {
        position: static;
        flex-direction: row;
        justify-content: center;
        margin-top: 2rem;
        transform: none;
    }

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

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .project-features ul {
        grid-template-columns: 1fr;
    }

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

    .section-header h2 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.8rem;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }

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

    .project-tech {
        justify-content: center;
    }

    section {
        padding: 60px 0;
    }

    .nav-container {
        padding: 0 15px;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    .theme-toggle {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

/* Smooth Animations */
.hero-text h1,
.hero-text p,
.hero-buttons {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

.hero-text p {
    animation-delay: 0.2s;
}

.hero-buttons {
    animation-delay: 0.4s;
}

.hero-image {
    opacity: 0;
    transform: scale(0.8);
    animation: fadeInScale 0.8s ease forwards;
    animation-delay: 0.6s;
}

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

@keyframes fadeInScale {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scroll Animations */
.section-header,
.about-text,
.skills-grid,
.education-grid,
.project-card,
.interests-grid,
.contact-content {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Loading State */
body:not(.loaded) {
    overflow: hidden;
}

body:not(.loaded) * {
    transition: none !important;
}

.loaded {
    overflow: visible;
}

/* Dark Mode Specific Adjustments */
[data-theme="dark"] .project-overlay {
    background: rgba(88, 166, 255, 0.9);
}

[data-theme="dark"] .philolo {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Focus styles for better accessibility */
.nav-link:focus,
.btn-primary:focus,
.btn-secondary:focus,
.theme-toggle:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --shadow: rgba(0, 0, 0, 0.5);
        --border-color: #666;
    }
    
    [data-theme="dark"] {
        --shadow: rgba(255, 255, 255, 0.3);
        --border-color: #999;
    }
}