/* RESET & BASE STYLES */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --accent-color: #4338ca;
    --background-color: #ffffff;
    --background-alt: #f1f5f9;
    --text-color: #334155;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --header-height: 80px;
    --section-padding: 100px 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--background-color);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

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

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

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

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

.btn-primary:hover {
    background-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

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

.btn-secondary:hover {
    background-color: var(--secondary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* HEADER & NAVIGATION */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: white;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

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

nav ul {
    display: flex;
}

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

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

nav ul li a:hover, nav ul li a.active {
    color: var(--primary-color);
}

nav ul li a:hover::after, nav ul li a.active::after {
    width: 100%;
}

.hamburger {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
}

/* HERO SECTION */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: var(--header-height);
    background-color: var(--background-alt);
}

.hero .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hero-content {
    flex: 1;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-content h1 span {
    color: var(--primary-color);
    position: relative;
}

.hero-content h1 span::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 10px;
    bottom: 5px;
    left: 0;
    background-color: rgba(37, 99, 235, 0.2);
    z-index: -1;
}

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

.hero-content p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    max-width: 600px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.hero-image img {
    width: 400px;
    height: 400px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
    border: 8px solid white;
}

/* ABOUT SECTION */
.about {
    padding: var(--section-padding);
    background-color: var(--background-color);
}

.about-content {
    display: flex;
    align-items: center;
    gap: 50px;
}

.about-image {
    flex: 1;
}

.about-image img {
    border-radius: 10px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.about-text {
    flex: 1;
}

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

.about-text p {
    margin-bottom: 20px;
}

.personal-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.info-item span {
    font-weight: 600;
    margin-right: 5px;
}

/* PORTFOLIO SECTION */
.portfolio {
    padding: var(--section-padding);
    background-color: var(--background-alt);
}

.portfolio .container {
    max-width: none;
    padding: 0;
}

.portfolio-filter {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    padding: 8px 20px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn.active, .filter-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.portfolio-carousel-wrapper {
    overflow: hidden;
    position: relative;
    width: 100%; /* Ensure it takes full width */
}

.portfolio-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 30px;
    /* Remove overflow: hidden from here */
    /* Remove animation from here */
    width: 4530px; /* (12 items * 350px) + (11 gaps * 30px) */
    animation: scrollPortfolio 20s linear infinite; /* Apply animation here */
}

.portfolio-grid:hover {
    animation-play-state: paused; /* Pause on hover */
}

@keyframes scrollPortfolio {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-2250px); /* Move the width of one set of items (6 items, 5 gaps) */
    }
}

.portfolio-item {
    flex: 0 0 350px; /* Prevent shrinking, prevent growing, set base width */
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    height: 250px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(37, 99, 235, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    padding: 20px;
    text-align: center;
    color: white;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-item:hover img {
    transform: scale(1.1);
}

.portfolio-overlay h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.portfolio-overlay p {
    margin-bottom: 20px;
}

.btn-view-project {
    padding: 8px 20px;
    background-color: white;
    color: var(--primary-color);
    border-radius: 30px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-view-project:hover {
    background-color: var(--accent-color);
    color: white;
}

/* SKILLS SECTION */
.skills {
    padding: var(--section-padding);
    background-color: var(--background-color);
}

.skills-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.skills-category h3 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--primary-color);
    position: relative;
}

.skills-category h3::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
}

.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skill-item {
    width: 100%;
}

.skill-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 500;
}

.skill-bar {
    height: 10px;
    background-color: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.skill-level {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    transition: width 1s ease;
}

/* EXPERIENCE SECTION */
.experience {
    padding: var(--section-padding);
    background-color: var(--background-alt);
}

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

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 50px;
}

.timeline-dot {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--primary-color);
    z-index: 1;
}

.timeline-content {
    position: relative;
    width: calc(50% - 40px);
    padding: 30px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

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

.timeline-item:nth-child(even) .timeline-content {
    left: calc(50% + 40px);
}

.timeline-date {
    display: inline-block;
    padding: 5px 15px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-weight: 500;
    margin-bottom: 15px;
}

.timeline-content h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.timeline-content h4 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

/* CONTACT SECTION */
.contact {
    padding: var(--section-padding);
    background-color: var(--background-color);
}

.contact-content {
    display: flex;
    gap: 50px;
}

.contact-info, .contact-form {
    flex: 1;
}

.contact-info-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
}

.contact-info-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-right: 15px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(37, 99, 235, 0.1);
    border-radius: 50%;
}

.contact-info-item h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

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

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

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

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

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

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

/* FOOTER */
footer {
    background-color: #1e293b;
    color: white;
    padding: 50px 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-logo h3 {
    font-size: 2rem;
    margin-bottom: 20px;
}

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

.footer-social {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.footer-social a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.footer-social a:hover {
    background-color: var(--primary-color);
}

/* CHAT BOT */
.chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
}

/* Floating button */
.chat-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.4);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.chat-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(37, 99, 235, 0.5);
}

.chat-button i {
    font-size: 1.6rem;
}

/* Chat window */
.chat-box {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 500px;
    height: 680px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.chat-box.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: #fff;
    flex-shrink: 0;
}

.chat-header-text h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 3px 0;
    line-height: 1.3;
}

.chat-status {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    display: inline-block;
}

.close-chat {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 1rem;
    flex-shrink: 0;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages area */
.chat-messages {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Messages */
.message {
    max-width: 85%;
    font-size: 0.95rem;
    animation: msgIn 0.2s ease-out;
}

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

/* User bubble */
.message.user {
    align-self: flex-end;
}

.message.user p {
    background: var(--primary-color);
    color: #fff;
    padding: 12px 18px;
    border-radius: 20px 20px 4px 20px;
    margin: 0;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Bot bubble */
.message.bot {
    align-self: flex-start;
}

.message-bubble {
    background: #fff;
    padding: 14px 18px;
    border-radius: 4px 20px 20px 20px;
    border: 1px solid #e9edf2;
    line-height: 1.65;
    font-size: 0.95rem;
    color: #334155;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Markdown inside bot bubbles */
.message-bubble p {
    margin: 0 0 10px 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
    font-size: 1em;
    font-weight: 600;
    color: #1e293b;
    margin: 12px 0 6px 0;
}

.message-bubble h1:first-child,
.message-bubble h2:first-child,
.message-bubble h3:first-child,
.message-bubble h4:first-child {
    margin-top: 0;
}

.message-bubble ul,
.message-bubble ol {
    margin: 8px 0;
    padding-left: 22px;
}

.message-bubble li {
    margin-bottom: 4px;
}

.message-bubble strong {
    font-weight: 600;
    color: #1e293b;
}

.message-bubble em {
    font-style: italic;
}

.message-bubble a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.message-bubble code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'SFMono-Regular', Consolas, monospace;
}

.message-bubble pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px 16px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 10px 0;
    font-size: 0.85em;
}

.message-bubble pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Typing indicator */
.typing-indicator .message-bubble {
    padding: 16px 22px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-indicator .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: dotBounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) { animation-delay: 0s; }
.typing-indicator .dot:nth-child(2) { animation-delay: 0.16s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.35; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.chat-input {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
    background: #fff;
    border-top: 1px solid #eef1f5;
    flex-shrink: 0;
}

.chat-input input {
    flex: 1;
    padding: 14px 20px;
    border: 1.5px solid #e2e8f0;
    border-radius: 28px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: #334155;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.chat-input input::placeholder {
    color: #94a3b8;
}

.send-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.15s ease;
}

.send-button:hover {
    background: var(--accent-color);
    transform: scale(1.06);
}

.send-button i {
    font-size: 1rem;
}

/* ACHIEVEMENTS SECTION */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.achievement-item {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    background-color: #fff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.achievement-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.achievement-item img {
    width: 100%;
    height: 400px; /* Fixed height for vertical rectangle */
    object-fit: cover; /* Crop to fill the space */
    display: block;
}

.achievement-title {
    padding: 20px;
}

.achievement-title h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

/* MEDIA QUERIES */
@media (max-width: 992px) {
    .hero .container {
        flex-direction: column-reverse;
        text-align: center;
    }

    .hero-content {
        margin-top: 50px;
    }

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

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

    .about-content {
        flex-direction: column;
    }

    .timeline::before {
        left: 20px;
    }

    .timeline-dot {
        left: 20px;
    }

    .timeline-content {
        width: calc(100% - 60px);
        left: 60px !important;
    }

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

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

    nav ul {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background-color: white;
        flex-direction: column;
        align-items: center;
        padding: 40px 0;
        transition: left 0.5s ease;
        z-index: 999;
    }

    nav ul.active {
        left: 0;
    }

    nav ul li {
        margin: 15px 0;
    }

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

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

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

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

@media (max-width: 640px) {
    .chat-box {
        width: 92vw;
        height: 70vh;
        right: 4vw;
        bottom: 96px;
    }
}

@media (max-width: 576px) {
    :root {
        --section-padding: 70px 0;
    }

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

    .hero-content h2 {
        font-size: 1.3rem;
    }

    .hero-image img {
        width: 280px;
        height: 280px;
    }

    .about-text h3 {
        font-size: 1.5rem;
    }

    .personal-info {
        grid-template-columns: 1fr;
    }

    .chat-container {
        bottom: 14px;
        right: 14px;
    }

    .chat-button {
        width: 56px;
        height: 56px;
    }

    .chat-button i {
        font-size: 1.4rem;
    }

    .chat-box {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 90vh;
        border-radius: 24px 24px 0 0;
    }
}