/* CSS Variables for theme colors */
:root {
    /* Dark mode colors (default) */
    --bg-primary: linear-gradient(135deg, #0c0c1e 0%, #1a1a2e 50%, #16213e 100%);
    --bg-secondary: rgba(0, 0, 0, 0.1);
    --bg-glass: rgba(255, 255, 255, 0.1);
    --bg-glass-hover: rgba(255, 255, 255, 0.15);
    --bg-card: rgba(255, 255, 255, 0.12);
    --bg-card-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-accent: #64c8ff;
    --border-color: rgba(255, 255, 255, 0.2);
    --border-accent: rgba(255, 255, 255, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.4);
    --shadow-strong: rgba(0, 0, 0, 0.5);
    --particle-hue-base: 200;
}

/* Light mode colors */
.light-mode {
    --bg-primary: linear-gradient(135deg, #f0f4f8 0%, #e1e8ed 50%, #d3dee9 100%);
    --bg-secondary: rgba(255, 255, 255, 0.3);
    --bg-glass: rgba(255, 255, 255, 0.4);
    --bg-glass-hover: rgba(255, 255, 255, 0.6);
    --bg-card: rgba(255, 255, 255, 0.4);
    --bg-card-hover: rgba(255, 255, 255, 0.6);
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-accent: #2b6cb0;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-accent: rgba(0, 0, 0, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.15);
    --particle-hue-base: 210;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    cursor: pointer;
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px var(--shadow-color);
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--border-accent);
    box-shadow: 0 8px 30px var(--shadow-strong);
}

.theme-toggle i {
    font-size: 1.2rem;
    position: absolute;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-accent);
}

.theme-toggle .fa-sun {
    opacity: 0;
    transform: rotate(180deg) scale(0.5);
}

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

.light-mode .theme-toggle .fa-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.light-mode .theme-toggle .fa-moon {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    /* Prevent layout shifts during scroll */
    will-change: auto;
    transition: all 0.4s ease;
}

/* Ensure proper stacking context */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    z-index: -3;
    pointer-events: none;
}

/* Particle Canvas Background */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

/* Mouse follower effect */
.mouse-follower {
    position: fixed;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(100, 200, 255, 0.8) 0%, rgba(100, 200, 255, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transition: transform 0.1s ease;
    mix-blend-mode: screen;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 10;
    background: var(--bg-secondary);
    backdrop-filter: blur(1px);
    border-radius: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    transition: all 0.4s ease;
}

/* Header styles */
header {
    text-align: center;
    padding: 40px 0 20px 0;
    position: relative;
    z-index: 20;
}

.profile {
    position: relative;
    z-index: 21;
}

.avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid rgba(100, 200, 255, 0.5);
    box-shadow: 
        0 0 20px rgba(100, 200, 255, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    z-index: 22;
}

.avatar:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 40px rgba(100, 200, 255, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
}

h1 {
    font-size: 3rem;
    margin: 20px 0;
    background: linear-gradient(45deg, #64c8ff, #a855f7, #ec4899);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease-in-out infinite;
    position: relative;
    z-index: 22;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.bio {
    font-size: 1.2rem;
    color: var(--text-secondary);
    height: 1.5em;
    position: relative;
    transition: color 0.4s ease;
}

.cursor {
    opacity: 1;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Glass morphism cards */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.glass-card:hover::before {
    left: 100%;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Links section */
.links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0 40px 0;
    position: relative;
    z-index: 15;
    flex-wrap: wrap;
}

.link-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    padding: 20px;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    z-index: 16;
    width: 70px;
    height: 70px;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.link-card i {
    font-size: 1.8rem;
    min-width: 30px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.link-card span {
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 0;
    flex-shrink: 0;
    color: var(--text-primary);
}

.link-card.github i { 
    color: #64c8ff; 
}
.link-card.blog i { 
    color: #a855f7; 
}
.link-card.cv i { 
    color: #ec4899; 
}
.link-card.email i { 
    color: #10b981; 
}

/* Hover effects */
.link-card:hover {
    border-radius: 35px;
    width: 180px;
    padding: 20px 25px;
    transform: translateY(-5px);
    justify-content: flex-start;
    gap: 15px;
    background: var(--bg-glass-hover);
    box-shadow: 
        0 15px 40px var(--shadow-strong),
        0 0 20px var(--border-color);
}

.link-card:hover span {
    opacity: 1;
    transform: translateX(0);
    margin-left: 0;
}

.link-card:hover i {
    transform: translateX(0);
    min-width: 30px;
}

/* Individual button colors on hover */
.link-card.github:hover {
    background: rgba(100, 200, 255, 0.2);
    border-color: rgba(100, 200, 255, 0.4);
    box-shadow: 
        0 15px 40px rgba(100, 200, 255, 0.3),
        0 0 30px rgba(100, 200, 255, 0.2);
}

.link-card.blog:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 
        0 15px 40px rgba(168, 85, 247, 0.3),
        0 0 30px rgba(168, 85, 247, 0.2);
}

.link-card.cv:hover {
    background: rgba(236, 72, 153, 0.2);
    border-color: rgba(236, 72, 153, 0.4);
    box-shadow: 
        0 15px 40px rgba(236, 72, 153, 0.3),
        0 0 30px rgba(236, 72, 153, 0.2);
}

.link-card.email:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 
        0 15px 40px rgba(16, 185, 129, 0.3),
        0 0 30px rgba(16, 185, 129, 0.2);
}

/* Pulsing animation for icons */
.link-card i {
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

.link-card:hover i {
    animation: none;
    transform: scale(1);
}

/* Ripple effect on click */
.link-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--bg-glass-hover);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    z-index: 1;
}

.link-card:active::before {
    width: 120px;
    height: 120px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    .theme-toggle {
        top: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .theme-toggle i {
        font-size: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .links {
        gap: 15px;
        margin: 15px 0 30px 0;
    }
    
    .link-card {
        width: 60px;
        height: 60px;
        padding: 15px;
    }
    
    .link-card i {
        font-size: 1.5rem;
        min-width: 24px;
    }
    
    .link-card:hover {
        width: 150px;
        padding: 15px 20px;
        gap: 12px;
    }
    
    .link-card span {
        font-size: 0.9rem;
    }
    
    .link-card:hover i {
        min-width: 24px;
    }
    
    .education-item {
        flex-direction: column;
        text-align: center;
    }
    
    .skills-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .avatar {
        width: 120px;
        height: 120px;
    }
    
    header {
        padding: 40px 0 20px 0;
    }
}

@media (max-width: 480px) {
    .theme-toggle {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    .theme-toggle i {
        font-size: 0.9rem;
    }
    
    .link-card:hover {
        width: 130px;
        padding: 12px 16px;
        gap: 10px;
    }
    
    .link-card span {
        font-size: 0.8rem;
    }
    
    .link-card i {
        font-size: 1.3rem;
        min-width: 20px;
    }
    
    .link-card:hover i {
        min-width: 20px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .bio {
        font-size: 1rem;
    }
    
    .skills-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}

/* Sections */
section {
    margin: 60px 0;
    position: relative;
    z-index: 15;
}

section h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--text-accent);
    position: relative;
    display: inline-block;
    z-index: 16;
    transition: color 0.4s ease;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(45deg, #64c8ff, #a855f7);
    transition: width 0.3s ease;
}

section:hover h2::after {
    width: 100%;
}

/* About section */
.about {
    @extend .glass-card;
}

.about li {
    list-style: none;
    margin: 15px 0;
    padding-left: 20px;
    position: relative;
    color: var(--text-primary);
    transition: color 0.4s ease;
}

.about li::before {
    content: '▶';
    position: absolute;
    left: 0;
    color: var(--text-accent);
    font-size: 0.8rem;
}

/* Education timeline */
.education {
    @extend .glass-card;
}

.education-timeline {
    position: relative;
}

.education-item {
    display: flex;
    gap: 20px;
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-glass);
    border-radius: 10px;
    border-left: 3px solid var(--text-accent);
    transition: all 0.3s ease;
}

.education-item:hover {
    background: var(--bg-glass-hover);
    transform: translateX(10px);
}

.education-logo img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
}

.education-content h3 {
    color: var(--text-accent);
    margin-bottom: 10px;
    transition: color 0.4s ease;
}

.degree {
    color: #a855f7;
    font-weight: 600;
}

.year {
    color: #ec4899;
    font-size: 0.9rem;
}

.advisor {
    color: #10b981;
    font-style: italic;
}

/* Skills section */
.skills-interests {
    @extend .glass-card;
}

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

.skills-category h3 {
    color: #a855f7;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-item {
    background: rgba(100, 200, 255, 0.2);
    color: #64c8ff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(100, 200, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.skill-item:hover {
    background: rgba(100, 200, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(100, 200, 255, 0.3);
}

.skill-item.python { 
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.3);
}

.skill-item.cpp { 
    background: rgba(0, 123, 255, 0.2);
    color: #007bff;
    border-color: rgba(0, 123, 255, 0.3);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
    position: relative;
    z-index: 15;
    color: var(--text-secondary);
    transition: all 0.4s ease;
}

.social-links {
    margin-top: 20px;
}

.social-links a {
    color: var(--text-accent);
    font-size: 1.5rem;
    margin: 0 15px;
    transition: all 0.3s ease;
}

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

/* Scroll animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.8s ease forwards;
}

/* Apply glass-card styles to sections */
.about, .education, .skills-interests {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 
        0 8px 32px var(--shadow-color),
        inset 0 1px 0 var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 15;
}

.about::before, .education::before, .skills-interests::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--bg-glass), transparent);
    transition: left 0.5s ease;
}

.about:hover::before, .education:hover::before, .skills-interests:hover::before {
    left: 100%;
}

.about:hover, .education:hover, .skills-interests:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    box-shadow: 
        0 15px 40px var(--shadow-strong),
        inset 0 1px 0 var(--border-accent);
}

/* Light mode specific color overrides for better readability */
.light-mode {
    /* Update text colors for better contrast */
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-accent: #2b6cb0;
}

/* Light mode text shadow for better readability on transparent backgrounds */
.light-mode .about li,
.light-mode .education-content,
.light-mode .skills-category,
.light-mode section h2,
.light-mode .bio {
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
}

/* Light mode container with subtle backdrop blur increase */
.light-mode .container {
    backdrop-filter: blur(8px) !important;
}

/* Light mode sections with increased backdrop blur */
.light-mode .about, 
.light-mode .education, 
.light-mode .skills-interests {
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

/* Light mode education items with better contrast */
.light-mode .education-item {
    background: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(8px) !important;
}

/* Light mode education section colors */
.light-mode .education-content h3 {
    color: #2c5aa0 !important;
}

.light-mode .degree {
    color: #7c3aed !important;
}

.light-mode .year {
    color: #dc2626 !important;
}

.light-mode .advisor {
    color: #059669 !important;
}

/* Light mode skills section colors */
.light-mode .skills-category h3 {
    color: #7c3aed !important;
}

.light-mode .skill-item {
    background: rgba(43, 108, 176, 0.2) !important;
    color: #1e40af !important;
    border-color: rgba(43, 108, 176, 0.4) !important;
    backdrop-filter: blur(4px) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.light-mode .skill-item:hover {
    background: rgba(43, 108, 176, 0.35) !important;
    box-shadow: 0 5px 15px rgba(43, 108, 176, 0.25) !important;
}

.light-mode .skill-item.python { 
    background: rgba(234, 88, 12, 0.2) !important;
    color: #c2410c !important;
    border-color: rgba(234, 88, 12, 0.4) !important;
    backdrop-filter: blur(4px) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.light-mode .skill-item.cpp { 
    background: rgba(37, 99, 235, 0.2) !important;
    color: #1d4ed8 !important;
    border-color: rgba(37, 99, 235, 0.4) !important;
    backdrop-filter: blur(4px) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

/* Light mode link card icon colors */
.light-mode .link-card.github i { 
    color: #1e40af !important;
}
.light-mode .link-card.blog i { 
    color: #7c3aed !important;
}
.light-mode .link-card.cv i { 
    color: #dc2626 !important;
}
.light-mode .link-card.email i { 
    color: #059669 !important;
}

/* Light mode section headers */
.light-mode section h2 {
    color: #2b6cb0 !important;
}

/* Light mode social links */
.light-mode .social-links a {
    color: #2b6cb0 !important;
}

.light-mode .social-links a:hover {
    color: #7c3aed !important;
}

/* Light mode about section list markers */
.light-mode .about li::before {
    color: #2b6cb0 !important;
}

/* Light mode footer text */
.light-mode footer {
    color: #4a5568 !important;
}

/* Light mode education item border */
.light-mode .education-item {
    border-left-color: #2b6cb0 !important;
}

/* Light mode h1 gradient for better visibility */
.light-mode h1 {
    background: linear-gradient(45deg, #1e40af, #7c3aed, #dc2626) !important;
    background-size: 300% 300% !important;
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* Light mode bio text */
.light-mode .bio {
    color: #4a5568 !important;
}

/* Light mode avatar border for better visibility */
.light-mode .avatar {
    border-color: rgba(43, 108, 176, 0.5) !important;
    box-shadow: 
        0 0 20px rgba(43, 108, 176, 0.3),
        inset 0 0 20px rgba(43, 108, 176, 0.1) !important;
}

.light-mode .avatar:hover {
    box-shadow: 
        0 0 40px rgba(43, 108, 176, 0.6),
        inset 0 0 20px rgba(43, 108, 176, 0.2) !important;
}
