* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Mode */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --accent-color: #f59e0b;
    --bg-primary: #f8fafc;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(37, 99, 235, 0.1);
}

body.dark-mode {
    /* Dark Mode */
    --bg-primary: #162032;
    --bg-secondary: #223049;
    --bg-tertiary: #32445f;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --card-bg: #223049;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(37, 99, 235, 0.15);
}

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: background-color 0.3s ease, color 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

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

a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Navigation */
.navbar {
    background: var(--bg-primary);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
}

.logo .profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    flex-shrink: 0;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

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

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0.5rem;
}

.theme-toggle:hover {
    color: var(--primary-color);
    transform: rotate(20deg);
}

.github-link {
    background: var(--primary-color);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.github-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 5rem 0 3rem;
    text-align: center;
}

.hero-content .profile-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    border: 4px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.8s ease;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    animation: slideUp 0.8s ease 0.1s backwards;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
    animation: slideUp 0.8s ease 0.2s backwards;
}

.hero-tags {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    animation: slideUp 0.8s ease 0.3s backwards;
}

.tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    animation: slideUp 0.8s ease 0.4s backwards;
}

.btn {
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-block;
    font-size: 0.95rem;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.btn-primary:focus-visible {
    outline: none;
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

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

.btn-secondary:focus-visible {
    outline: none;
}

/* About Section */
.about {
    padding: 5rem 0;
    background: var(--bg-primary);
}

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

.about-text h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

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

.about-list {
    list-style: none;
    margin: 1.5rem 0;
}

.about-list li {
    padding: 0.75rem 0;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.about-list li::before {
    content: "▸";
    color: var(--primary-color);
    font-weight: bold;
    flex-shrink: 0;
}

.about-image {
    display: flex;
    justify-content: center;
}

.profile-photo {
    width: 300px;
    height: 300px;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
}

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

.projects h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    text-align: center;
    color: var(--text-primary);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    text-align: center;
    padding: 2rem;
    background: #fecaca;
    color: #7f1d1d;
    border-radius: 0.5rem;
    margin: 2rem 0;
}

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

.project-card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.project-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.project-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.project-title {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.project-date {
    font-size: 0.85rem;
    opacity: 0.9;
}

.project-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
    flex: 1;
}

.project-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    background: var(--bg-secondary);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.badge.star {
    background: #fef3c7;
    color: #92400e;
}

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

.project-link {
    flex: 1;
    min-width: 120px;
    padding: 0.6rem;
    background: var(--bg-secondary);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.project-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Skills Section */
.skills {
    padding: 5rem 0;
    background: var(--bg-primary);
}

.skills h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    text-align: center;
    color: var(--text-primary);
}

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

.skill-category {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.skill-category:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.skill-category h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
}

.skill-category i {
    font-size: 1.3rem;
}

.skill-category ul {
    list-style: none;
}

.skill-category li {
    padding: 0.6rem 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-category li::before {
    content: "✓";
    color: var(--primary-color);
    font-weight: bold;
}

/* Contact Section */
.contact {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 5rem 0;
    text-align: center;
}

.contact h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.contact > .container > p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.contact-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.contact-link:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
}

.contact-link:focus-visible {
    outline: none;
    border-color: white;
}

/* Footer */
.footer {
    background: #1e293b;
    color: #cbd5e1;
    text-align: center;
    padding: 3rem 0;
}

body.dark-mode .footer {
    background: #162032;
}

.footer-content p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.footer-tech {
    color: #64748b;
    font-size: 0.85rem;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-content {
        flex-wrap: wrap;
        padding: 0.75rem 0;
    }

    .logo {
        font-size: 1.2rem;
        width: 100%;
        margin-bottom: 0.5rem;
        order: 1;
    }

    .nav-links {
        width: 100%;
        gap: 1rem;
        font-size: 0.9rem;
        flex-wrap: wrap;
        justify-content: flex-start;
        order: 2;
    }

    .github-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .github-link i {
        display: none;
    }

    .hero {
        padding: 3rem 0 2rem;
    }

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

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-content .profile-img {
        width: 120px;
        height: 120px;
    }

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

    .about-text h2 {
        font-size: 2rem;
    }

    .profile-photo {
        width: 250px;
        height: 250px;
    }

    .projects h2,
    .skills h2,
    .contact h2 {
        font-size: 2rem;
    }

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

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

    .contact-links {
        gap: 1rem;
    }

    .contact-link {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1rem;
    }

    .logo .profile-img {
        width: 32px;
        height: 32px;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .nav-links a {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .theme-toggle {
        font-size: 1rem;
        padding: 0.3rem;
    }

    .hero-content h1 {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .hero-tags {
        gap: 0.3rem;
    }

    .tag {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .project-card {
        margin: 0;
    }
}
