:root {
    --primary: #0176d3;
    --secondary: #1b96ff;
    --dark: #032d60;
    --light: #f3f3f3;
    --success: #2e844a;
    --text: #16325c;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    color: var(--text);
    background-color: var(--light);
    line-height: 1.6;
}

header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    height: 80px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.logo span {
    color: var(--dark);
}

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

.nav-item {
    margin-left: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 0;
    position: relative;
}

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

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

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

.hamburger {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    transition: all 0.3s ease;
    background-color: var(--text);
}

.hero {
    min-height: 100vh;
    background: var(--bg-gradient);
    color: var(--text);
    padding: 120px 5% 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%230176d3' fill-opacity='0.05' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-content {
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.hero h2 {
    font-size: 1.8rem;
    font-weight: 500;
    margin-bottom: 30px;
    color: var(--dark);
}

.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 40px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--primary);
    color: white;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-right: 15px;
    margin-bottom: 15px;
    border: 2px solid var(--primary);
}

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

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

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

/* Section styles */
section {
    padding: 100px 5%;
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

.section-title h2 {
    font-size: 2.5rem;
    color: var(--primary);
}

.section-title::after {
    content: "";
    position: absolute;
    width: 80px;
    height: 3px;
    background-color: var(--primary);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
}

/* About section */
.about-content {
    display: flex;
    align-items: center;
    gap: 50px;
    justify-content: space-between;
}

.about-text {
    flex: 1.2; /* Give text slightly more space */
}

.about-text h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--dark);
}

/* Enhanced About Image styling */
.about-image {
    flex: 1;
    text-align: center;
    max-width: 500px; /* Limit maximum width */
}

.about-image img {
    max-width: 100%;
    max-height: 350px; /* Limit maximum height */
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: 4px solid rgba(1, 118, 211, 0.1);
}

.about-image img:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    border-color: rgba(1, 118, 211, 0.3);
}

.skills {
    background-color: #f9f9f9;
}

.skills-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.skill-category {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    flex: 1 1 300px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.skill-category:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

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

.skill-category h3 i {
    margin-right: 10px;
}

/* Skill progress bars */
.skill-progress {
    margin-bottom: 20px;
}

.skill-progress h4 {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.progress-bar {
    height: 10px;
    background-color: #e6e6e6;
    border-radius: 5px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--primary);
    border-radius: 5px;
    transition: width 1.5s ease;
}

/* Experience section */
.experience {
    background-color: #f9f9f9;
}

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

.timeline::after {
    content: '';
    position: absolute;
    width: 3px;
    background-color: var(--secondary);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1.5px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
    box-sizing: border-box;
}

.timeline-item:nth-child(odd) {
    left: 0;
}

.timeline-item:nth-child(even) {
    left: 50%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: white;
    border: 3px solid var(--primary);
    border-radius: 50%;
    top: 15px;
    z-index: 1;
}

.timeline-item:nth-child(odd)::after {
    right: -10px;
}

.timeline-item:nth-child(even)::after {
    left: -10px;
}

.timeline-content {
    padding: 20px;
    background-color: white;
    position: relative;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.timeline-date {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
}

.timeline-title {
    margin-bottom: 10px;
}

/* Parallax section */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.parallax-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.parallax-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    padding: 0 20px;
}

.parallax-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

/* Contact section */
.contact {
    background-color: white;
}

.contact-container {
    display: flex;
    justify-content: space-between;
    gap: 50px;
}

.contact-info {
    flex: 1;
}

.contact-info h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--dark);
}

.contact-list {
    list-style: none;
}

.contact-list li {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.contact-list li i {
    width: 30px;
    color: var(--primary);
}

.contact-form {
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(1, 118, 211, 0.2);
}

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

.btn-submit {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-submit:hover {
    background-color: var(--dark);
}

/* Footer */
footer {
    background-color: var(--dark);
    color: white;
    text-align: center;
    padding: 30px 5%;
}

.social-links {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 20px;
}

.social-links a {
    color: white;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

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

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.back-to-top:hover {
    background-color: var(--dark);
}

/* Theme switcher */
.theme-switch {
    position: fixed;
    top: 100px;
    right: 30px;
    z-index: 1000;
    background-color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.theme-switch i {
    font-size: 1.5rem;
    color: var(--primary);
}

.theme-switch:hover {
    transform: rotate(30deg);
}

/* Dark theme */
body.dark-theme {
    --light: #121212;
    --text: #f3f3f3;
    --bg-gradient: linear-gradient(135deg, #2d3436 0%, #000000 100%);
    background-color: #121212;
    color: #f3f3f3;
}

body.dark-theme header {
    background-color: rgba(20, 20, 20, 0.95);
}

body.dark-theme .nav-link {
    color: #f3f3f3;
}

body.dark-theme .bar {
    background-color: #f3f3f3;
}

body.dark-theme .skill-category,
body.dark-theme .timeline-content,
body.dark-theme .form-control {
    background-color: #1e1e1e;
    color: #f3f3f3;
}

body.dark-theme .skill-category h3,
body.dark-theme .about-text h3,
body.dark-theme .contact-info h3,
body.dark-theme .section-title h2 {
    color: var(--secondary);
}

body.dark-theme .skills,
body.dark-theme .experience {
    background-color: #181818;
}

body.dark-theme .contact {
    background-color: #121212;
}

body.dark-theme .form-control {
    border-color: #333;
}

/* Update hero text colors for dark theme */
body.dark-theme .hero h1,
body.dark-theme .hero h2 {
    color: white;
}

body.dark-theme .hero p {
    color: #ddd;
}

body.dark-theme .hero::before {
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.05' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
}

/* 3D card effect */
.card-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card-3d-inner {
    transition: transform 0.5s;
    transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
    transform: rotateY(10deg) rotateX(5deg);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate {
    opacity: 0;
}

.animated {
    animation: fadeIn 0.6s forwards;
}

/* Typing effect */
.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--primary);
    white-space: nowrap;
    width: 0;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.typing-effect.start-typing {
    opacity: 1;
    animation: typing 3.5s steps(40, end) forwards, blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary) }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Media queries */
@media (max-width: 992px) {
    .about-content {
        flex-direction: column;
    }

    .about-image {
        order: -1;
        margin-bottom: 30px;
        max-width: 350px; /* Smaller on tablets */
        margin: 0 auto;
    }
    
    .about-image img {
        max-height: 300px;
    }

    .contact-container {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .header-container {
        height: 70px;
    }

    html {
        scroll-padding-top: 70px;
    }

    .hamburger {
        display: block;
    }

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

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
        padding: 20px 0;
        gap: 20px;
    }

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

    .nav-item {
        margin: 0;
    }

    body.dark-theme .nav-menu {
        background-color: #1e1e1e;
    }

    .hero {
        padding-top: 100px;
    }

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

    .about-image {
        max-width: 280px; /* Even smaller on phones */
    }
    
    .about-image img {
        max-height: 250px;
    }

    .timeline::after {
        left: 31px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }

    .timeline-item:nth-child(even) {
        left: 0;
    }

    .timeline-item::after {
        left: 20px;
    }
}