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

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    background-color: #f0f0f0;
    transition: background-color 0.3s, color 0.3s;
}

/* DarkMode Style */
body.dark-mode {
    background-color: #222;
    color: #f0f0f0;
}

/* Navbar Style (Default/Light Mode) */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

/*Progress Bar*/
#scroll-progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 5px;
    background-color: #3498db;
    z-index: 1001;
    transition: width 0.1s linear;
}

body.dark-mode #scroll-progress-indicator {
    background-color: #88c0d8;
}

.nav-link.active {
    color: #3498db;
    font-weight: 700;
}

body.dark-mode .nav-link.active {
    color: #88c0d8;
}

/* Navbar Style (Dark Mode) */
body.dark-mode .navbar {
    background-color: rgba(34, 34, 34, 0.95);
    box-shadow: 0 2px 5px rgba(255, 255, 255, 0.1); 
}

/* Navbar Style when scrolled (Light Mode) */
.navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Navbar Style when scrolled (Dark Mode) */
body.dark-mode .navbar.scrolled {
    background: rgba(34, 34, 34, 0.98);
    box-shadow: 0 2px 5px rgba(255, 255, 255, 0.1);
}

/* Container for general content centering */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation specific styles */
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    text-decoration: none;
}

/* Logo color in Dark Mode */
body.dark-mode .nav-logo a {
    color: #f0f0f0;
}

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

.nav-link {
    color: #333; /* สีลิงก์ใน Light Mode */
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #3498db;
}

/* Link color in Dark Mode */
body.dark-mode .nav-menu li a.nav-link {
    color: #f0f0f0;
}

body.dark-mode .nav-menu li a.nav-link:hover {
    color: #88c0d8; /* สี hover ใน Dark Mode */
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
}

/* Hamburger icon color in Dark Mode */
body.dark-mode .nav-toggle .bar {
    background: #f0f0f0;
}

/* DarkMode Toggle Button Style */
.btn-darkMode {
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s, border-color 0.3s;
    font-size: 1.2em;
    margin-left: 1rem;
}

/* Hide Dark Mode Icon by default (for Light Mode) */
.btn-darkMode .dark {
    display: none;
}

/* Show Light Mode Icon by default (for Light Mode) */
.btn-darkMode .light {
    display: inline-block;
}

/* Dark Mode Active Styles for the button */
body.dark-mode .btn-darkMode {
    background-color: #555;
    border-color: #777;
}

/* Hide Light Mode Icon when Dark Mode is Active */
body.dark-mode .btn-darkMode .light {
    display: none;
}

/* Show Dark Mode Icon when Dark Mode is Active */
body.dark-mode .btn-darkMode .dark {
    display: inline-block;
    color: #f39c12; 
}

#loading-overlay.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

body.dark-mode #loading-overlay.loader {
    background-color: rgba(34, 34, 34, 0.95);
    color: #f0f0f0;
}

.progress-bar {
    width: 60%;
    max-width: 400px;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 15px;
}

body.dark-mode .progress-bar {
    background-color: #555;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #3498db;
    border-radius: 5px;
    transition: width 0.1s linear;
}

body.dark-mode .progress-fill {
    background-color: #88c0d8;
}

.loading-text {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 15px;
}

body.dark-mode .loading-text {
    color: #e0e0e0;
}

#loading-overlay.loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Hero Section */
.hero {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

}

.hero-main {
    display: flex;
    padding: 100px 20px 50px;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.hero-text {
    position: relative;
    margin-bottom: 2em;
}

@keyframes blink {
    50% {opacity: 0;}
}

.hero-content {
    flex: 1;
}

.hero-title {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 0;
}

.hero-highlight {
    font-size: 3rem;
    font-weight: bold;
    color: #f39c12;
    line-height: 2;

}

.hero-subtitle {
    font-size: 1.5rem;
    margin-top: 1em;
    opacity: 0.9;
    line-height: 2;

}

.hero-description {
    font-size: 1.1rem;
    /* margin-bottom: 0; */
    opacity: 0.8;
    line-height: 2;

}

.cursor {
    color: white;
    position: absolute;
    border-right: 1.5px solid #fff;
    padding-left: 5px;

}
.blinking{
    animation: blink 1s step-start infinite;
}

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

.btn {
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: white;
    color: #333;
}

.hero-image {
    flex: 1;
    text-align: center;
}

.hero-image img {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid rgba(255, 255, 255, 0.2);
}

/* Section Titles */
.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: #2c3e50;
}

/* Section Title color in Dark Mode */
body.dark-mode .section-title {
    color: #f0f0f0;
}


/* About Section */
.about {
    padding: 100px 0;
    background: #f8f9fa;
}

/* About Section background in Dark Mode */
body.dark-mode .about {
    background: #2c2c2c;
}

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

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #666;
}

/* About text color in Dark Mode */
body.dark-mode .about-text p {
    color: #bbb;
}

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

.stat-item {
    text-align: center;
}

.stat-item h3 {
    font-size: 2rem;
    color: #3498db;
    margin-bottom: 0.5rem;
}

.about-image img {
    width: 100%;
    border-radius: 10px;
}

/* Skills Section */
.skills {
    padding: 100px 0;
}

/* Skills Section background in Dark Mode */
body.dark-mode .skills {
    background-color: #333;
}

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

.skill-item {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

/* Skill Item background and text in Dark Mode */
body.dark-mode .skill-item {
    background: #444; 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

body.dark-mode .skill-item h3 {
    color: #f0f0f0;
}

body.dark-mode .skill-item p {
    color: #bbb;
}


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

.skill-item i {
    font-size: 3rem;
    color: #3498db;
    margin-bottom: 1rem;
}

.skill-item h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* Projects Section */
.projects {
    padding: 100px 0;
    background: #f8f9fa;
    justify-content: center;
    align-items: center;
}
.projects-title-wrapper{
    display: flex;
    position: relative;
    justify-content: center;

}

.project-filter {
    list-style: none;
    position: absolute;
    right : 0;

    display: flex;
    justify-content: end;
    transition: all 0.4s ease-in;
    
    max-width: 0;
    min-width: 60px;
    
    white-space: nowrap;
    overflow: hidden;
    text-overflow: visible;
    
    border-radius: 2rem;
    height: 60px;
    background-color: #f8f9fa;
}

.project-filter,
.project-filter ul,
.project-filter li,
.project-filter li>button {
    background-color: transparent;
}

.project-pill {
    max-width: 500px;
    background-color: #3498db;
}

.project-filter button {
    font-size: 1.2em;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    height: 60px;
    width: 60px;
    color: #2c3e50;
    border-radius: 2rem;
    list-style: none;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.project-filter input {
    display: none;
    height: 100%;
    font-size: 1em;
    border: none;
    background-color: #3498db;
    padding: 0 1rem;
    max-width: 200px;
    color: white;
    
}

.project-filter input:focus {
    outline: none;
}

.project-filter:hover,
.project-filter button:hover,
.project-filter li:hover,
.project-pill:hover {
    color: #fff;
    background-color: #3498db;
}

.project-title {
    align-self: center;
}

/* Projects Section background in Dark Mode */
body.dark-mode .projects {
    background: #2c2c2c;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 365px);
    justify-content: center;
    gap: 2rem;
}

.project-card {
    max-width: 700px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

/* Project Card background and text in Dark Mode */
body.dark-mode .project-card {
    background: #444;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

body.dark-mode .project-card h3 {
    color: #f0f0f0;
}

body.dark-mode .project-card p {
    color: #bbb;
}

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

.project-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.project-info p {
    color: #666;
    margin-bottom: 1.5rem;
}

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

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* Contact Section */
.contact {
    padding: 100px 0;
}

/* Contact Section background in Dark Mode */
body.dark-mode .contact {
    background-color: #333;
}

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

.contact-info h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* Contact Info text in Dark Mode */
body.dark-mode .contact-info h3 {
    color: #f0f0f0;
}

body.dark-mode .contact-info p {
    color: #bbb;
}

.contact-info p {
    color: #666;
    margin-bottom: 2rem;
}

.contact-details {
    margin-bottom: 2rem;
}

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

.contact-item i {
    font-size: 1.2rem;
    color: #3498db;
    margin-right: 1rem;
    width: 20px;
}

/* Contact Item text color in Dark Mode */
body.dark-mode .contact-item span {
    color: #f0f0f0;
}


.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: background 0.3s ease;
}

.social-links a:hover {
    background: #2980b9;
}

/* Social Links in Dark Mode */
body.dark-mode .social-links a {
    background: #555;
    color: #f0f0f0;
}

body.dark-mode .social-links a:hover {
    background: #777;
}

/* Contact Form */
.contact-form {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
}

/* Contact Form background in Dark Mode */
body.dark-mode .contact-form {
    background: #444;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease, background-color 0.3s, color 0.3s;
}

/* Form input/textarea in Dark Mode */
body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    background-color: #555;
    border-color: #666;
    color: #f0f0f0;
}

body.dark-mode .form-group input::placeholder,
body.dark-mode .form-group textarea::placeholder {
    color: #ccc;
}

body.dark-mode .project-filter button {
    color: #ffffff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
}


/* Responsive Design */
@media (max-width: 768px) {
    .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 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
    }

    /* Mobile Nav Menu in Dark Mode */
    body.dark-mode .nav-menu {
        background-color: #2c2c2c;
        box-shadow: 0 10px 27px rgba(255, 255, 255, 0.05);
    }

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

    .nav-toggle {
        display: flex;
    }

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

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

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

    .hero {
        flex-direction: column-reverse;
        text-align: center;
        padding: 120px 20px 50px;
    }

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

    .hero-image {
        margin-bottom: 2rem;
    }

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

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

    .about-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

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

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

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

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

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }

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

    .about-stats {
        grid-template-columns: 1fr;
    }

    .project-links {
        flex-direction: column;
    }
}

/* Back to Top Button */
.back-to-top {
    display: none;
    visibility: hidden;
    opacity: 0;
    
    min-width: 54px;
    max-width: 0;
    
    z-index: 99;
    position: fixed;
    bottom: 30px;
    right: 30px;
    
    background-color: #3498db;
    
    border-radius: 2rem;

    overflow: hidden;
    transition: all 0.8s ease;

    cursor: pointer;
}

.back-to-top ul {
    list-style: none;
    display : flex;
    flex-direction: row-reverse;
    justify-content: end;
    align-items: center;
}

.back-to-top.show {
    display: block;
    visibility: visible;
    opacity: 1;

    
    margin: 0;
    padding: 0;

}

.back-to-top button {
    display: flex;
    justify-content: center;
    align-items: center;

    border: none;
    outline: none;
    border-radius: 50%;
    height: 54px;
    width: 54px;
    
    cursor: pointer;

    font-size: 20px;
    color: white;
    background-color: #3498db;

}

.pill {
    max-width: 300px;

}

/* Back to Top Button in Dark Mode */
body.dark-mode .back-to-top {
    background-color: #555;
}

body.dark-mode .back-to-top:hover {
    background-color: #777;
}

.pill-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: hidden;

    padding-left :1rem;

    font-size: 20px;
    color: white;


}


@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        padding: 12px;
        font-size: 16px;
    }
}

