/* Universal box-sizing for better responsive design */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Desktop-specific overflow behavior */
@media (min-width: 769px) {
    html {
        overflow-x: hidden;
        overflow-y: auto;
        margin: 0;
        padding: 0;
        height: 100%;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
    }
    
    html::-webkit-scrollbar {
        display: none; /* Safari and Chrome */
        width: 0;
        background: transparent;
    }
    
    body {
        overflow-x: hidden;
        overflow-y: auto;
        min-height: 100vh;
        margin: 0;
        padding: 0;
        padding-top: 60px;
        height: auto;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
    }
    
    body::-webkit-scrollbar {
        display: none; /* Safari and Chrome */
        width: 0;
        background: transparent;
    }
}

/* Hide scrollbars globally on desktop while maintaining scroll functionality */
@media (min-width: 769px) {
    * {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
    }
    
    *::-webkit-scrollbar {
        display: none; /* Safari and Chrome */
        width: 0;
        background: transparent;
    }
    
    /* Ensure container elements don't show scrollbars */
    .container,
    .section-content-container,
    section,
    main {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .container::-webkit-scrollbar,
    .section-content-container::-webkit-scrollbar,
    section::-webkit-scrollbar,
    main::-webkit-scrollbar {
        display: none;
        width: 0;
        background: transparent;
    }
}

/* General Styling */
:root {
    --primary-color: #e74c3c;
    --secondary-color: #34495e;
    --light-grey: #ecf0f1;
    --dark-grey: #7f8c8d;
}

html {
    margin: 0;
    padding: 0;
    scroll-behavior: smooth; /* Enable smooth scrolling */
}

body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    padding-top: 60px; /* Space for fixed header */
    background: url('images/backgrounds/background-maindark.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--light-grey);
    line-height: 1.6;
    transition: all 0.3s ease;
    box-sizing: border-box;
    width: 100%;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--light-grey);
}

/* Prevent text and content overflow */
section {
    width: 100%;
    box-sizing: border-box;
}

.hero-content,
.about-content,
.contact-info,
.project-description-content {
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    box-sizing: border-box;
}

/* Header and Navigation */
header {
    background-color: rgba(52, 73, 94, 0.95);
    color: var(--light-grey);
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-height: 52px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

header::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important;
    overflow-y: visible !important; /* Allow slider to show */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

nav::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

/* Desktop layout - horizontal header */
.logo-desktop {
    display: flex; /* Show desktop logo */
}

.logo-mobile,
.nav-logo-row {
    display: none; /* Hide mobile logo on desktop */
}

.nav-main-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
}

/* Add logo to main row for desktop */
.nav-main-row::before {
    display: none;
}

.nav-controls-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 32px;
    width: auto;
    transition: height 0.3s ease;
    vertical-align: middle;
    margin-top: 2px; /* Small adjustment to center better */
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden !important; /* Completely prevent scroll */
    scrollbar-width: none;
    -ms-overflow-style: none;
    white-space: nowrap; /* Prevent wrapping */
}

nav ul::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

nav ul li {
    margin-left: 20px;
    display: flex;
    align-items: center;
}

nav ul li a {
    color: var(--light-grey);
    font-weight: 600;
    font-size: 0.85em;
    position: relative;
    overflow: visible;
    transition: color 0.3s ease;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
}

/* Hover effect only - no underline */
nav ul li a:hover {
    background-color: rgba(231, 76, 60, 0.15);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Active state - just color change */
nav ul li a.active {
    color: var(--primary-color);
    background-color: rgba(231, 76, 60, 0.1);
}

@keyframes slideIn {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

/* Navigation Slider - REMOVED per user request */
.nav-slider {
    display: none !important; /* Completely hide slider */
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--light-grey);
    padding: 5px 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.theme-toggle:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.theme-toggle i {
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(180deg);
}

/* Language Toggle Button */
.language-toggle {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--light-grey);
    padding: 4px 8px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 50px;
    height: 32px;
    font-weight: 600;
}

.language-toggle:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.language-toggle i {
    font-size: 0.9em;
}

#lang-text {
    font-size: 0.75em;
    font-weight: 700;
}

/* Hero Section */
#hero {
    min-height: min(40vh, 400px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 0;
    margin-bottom: 40px;
}

.hero-container {
    padding: 30px;
    border-radius: 10px;
    max-width: 800px;
    width: 100%;
}

.hero-content h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 3.5em;
    margin-bottom: 10px;
}

.hero-content p {
    font-size: 1.5em;
    color: var(--primary-color);
    font-weight: 300;
}

/* Main Sections Spacing */
#work, #about, #contact {
    padding: 10px 0; /* Padding untuk spacing antar section */
    margin: 10px 0 10px 0; /* Tambah margin bawah lebih besar untuk spacing */
    background-color: transparent; /* Background dipindah ke container */
}

/* The Main Box Style for All Sections - kotak container */
.section-content-container {
    background-color: rgba(52, 73, 94, 0.85); /* Background kotak */
    padding: 50px 40px; /* Padding dalam kotak */
    margin: 0 40px 40px 40px; /* Tambah margin bawah untuk spacing kotak */
    border-radius: 12px; /* Rounded corners */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25); /* Shadow untuk depth */
}

/* Section Title Styling */
.section-title {
    text-align: center;
    margin-bottom: 40px; /* Tambah spacing bawah */
    margin-top: 0; /* Reset top margin karena section sudah ada padding */
    padding-top: 20px; /* Tambah padding atas untuk spacing dari tepi section */
}

.section-title h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5em;
    color: var(--primary-color);
    margin-top: 10px;
    margin-bottom: 0;
}

.section-title i {
    font-size: 2em;
    color: var(--light-grey);
}

/* Mobile section titles spacing */
@media (max-width: 768px) {
    .section-title {
        margin-bottom: 35px; /* Tambah spacing bawah untuk mobile */
        margin-top: 0; /* Reset top margin */
        padding-top: 15px; /* Padding atas untuk mobile */
        padding: 0 10px;
        padding-top: 15px; /* Override padding-top */
    }
    
    .section-title i {
        display: block;
        margin-bottom: 8px;
        font-size: 1.8em;
    }
    
    .section-title h2 {
        font-size: 2em;
        margin-top: 8px;
        margin-bottom: 0;
        line-height: 1.2;
    }
}

.detail-image-gallery {
    overflow: hidden;
    max-width: 100%;
}

.main-detail-image {
    max-width: 100%;
    box-sizing: border-box;
}

/* Project Grid and Items */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 15px;
    margin-bottom: 40px;
}

.project-item {
    background-color: rgba(44, 62, 80, 0.9);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.5s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    opacity: 0;
    transform: translateX(-100px);
}

.main-detail-image {
    min-height: 200px;
    max-height: 400px;
}

/* Animation states for scroll reveal */
.project-item.reveal-left {
    transform: translateX(-100px);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.project-item.reveal-right {
    transform: translateX(100px);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.project-item.revealed {
    transform: translateX(0) !important;
    opacity: 1;
    transition: transform 0.6s ease, opacity 0.6s ease, box-shadow 0.3s ease !important;
}

.project-item:hover {
    transform: scale(1.03) translateY(-8px) !important;
    z-index: 10;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.project-item.revealed:hover {
    transform: scale(1.03) translateY(-8px) !important;
    z-index: 10;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

/* Efek animasi membesar khusus project 1 */
.project-1 {
    transition: transform 0.35s cubic-bezier(0.4, 0.2, 0.2, 1), box-shadow 0.3s, opacity 0.6s ease;
}

.project-1:hover {
    transform: scale(1.03) translateY(-8px) !important;
    z-index: 10;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.project-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.project-item:hover img {
    transform: scale(1.05);
}

.project-info {
    padding: 20px;
}

.project-info h4 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4em;
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--primary-color);
    line-height: 1.3;
}

.project-info .category {
    font-size: 0.9em;
    color: var(--dark-grey);
    margin-bottom: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-info .description {
    font-size: 0.95em;
    color: var(--light-grey);
    line-height: 1.5;
    margin: 0;
}

/* About Section Content */
.about-content {
    text-align: center;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    margin-top: 15px;
}

.about-content.revealed {
    opacity: 1;
    transform: translateY(0);
}

.about-content p {
    font-size: 1.1em;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.about-content p.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Contact Section Content */
.contact-info {
    text-align: center;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    margin-top: 15px;
}

.contact-info.revealed {
    opacity: 1;
    transform: translateY(0);
}

.contact-info p {
    font-size: 1.1em;
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.contact-info p.revealed {
    opacity: 1;
    transform: translateY(0);
}

.contact-methods {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.contact-methods.revealed {
    opacity: 1;
    transform: translateY(0);
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    color: var(--light-grey);
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.5s ease, opacity 0.5s ease;
    background-color: rgba(44, 62, 80, 0.7);
    opacity: 0;
    transform: scale(0.8);
}

.contact-item.revealed {
    opacity: 1;
    transform: scale(1);
}

.contact-item i {
    font-size: 1.5em;
    margin-right: 10px;
    color: var(--primary-color);
}

.contact-item:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #34495e;
}

.contact-item:hover i {
    color: #34495e;
}

/* Text jumping animation on hover */
.contact-item span {
    display: inline-block;
    transition: transform 0.3s ease;
}

.contact-item:hover span {
    animation: textJump 0.6s ease;
}

/* Light mode text jumping animation */
body.light-mode .contact-item span {
    display: inline-block;
    transition: transform 0.3s ease;
}

body.light-mode .contact-item:hover span {
    animation: textJump 0.6s ease;
}

@keyframes textJump {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-8px);
    }
    50% {
        transform: translateY(-4px);
    }
    75% {
        transform: translateY(-2px);
    }
}

/* Footer */
footer {
    background-color: rgba(52, 73, 94, 0.95);
    color: var(--light-grey);
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
    margin-bottom: 20px; /* Add bottom margin to ensure it's not cut off */
    font-size: 0.9em;
    width: 100%;
    box-sizing: border-box;
    border-top: 1px solid rgba(231, 76, 60, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

footer p {
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Detail image gallery container */
.detail-image-gallery {
    margin: 20px 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
}

/* Mobile image gallery */
.detail-image-gallery {
    margin: 15px 0;
    min-height: 180px;
}

/* Project Detail Page Styles */
.detail-image-gallery {
    margin: 20px 0;
    text-align: center;
}

.main-detail-image {
    width: 100%;
    max-width: 600px;
    height: 300px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    background-color: rgba(0, 0, 0, 0.1);
    display: block;
    margin: 0 auto;
}

.main-detail-image:hover {
    transform: scale(1.02);
}

.project-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2.2em;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
}

.project-meta {
    text-align: center;
    color: var(--dark-grey);
    margin-bottom: 30px;
    font-size: 0.9em;
}

.project-description-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: rgba(44, 62, 80, 0.9);
    border-radius: 8px;
    line-height: 1.7;
}

.project-description-content h3 {
    color: var(--primary-color);
    font-family: 'Poppins', sans-serif;
    margin-top: 25px;
    margin-bottom: 15px;
}

.project-description-content ul {
    padding-left: 20px;
}

.project-description-content li {
    margin-bottom: 8px;
}

/* Light mode styles for project detail */
body.light-mode .project-description-content {
    background-color: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

body.light-mode .project-title {
    color: var(--primary-color);
}

body.light-mode .project-meta {
    color: #34495e;
}

body.light-mode .project-description-content h3 {
    color: var(--primary-color);
}

/* Light Mode Styles */
body.light-mode {
    background: url('images/backgrounds/background-mainwhite.jpg') no-repeat center center fixed;
    background-size: cover;
    color: #2c3e50;
}

body.light-mode header {
    background-color: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Ensure auto-hide works in light mode */
body.light-mode header.hidden {
    transform: translateY(-100%) !important;
    opacity: 0 !important;
}

body.light-mode header.visible {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

body.light-mode nav ul li a {
    color: #2c3e50;
    font-weight: 700;
}

/* Light mode hover and active states */
body.light-mode nav ul li a:hover {
    background-color: rgba(231, 76, 60, 0.15);
    color: var(--primary-color);
    transform: translateY(-2px);
}

body.light-mode nav ul li a.active {
    color: var(--primary-color);
    background-color: rgba(231, 76, 60, 0.1);
}

body.light-mode .theme-toggle {
    color: #2c3e50;
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.8);
}

body.light-mode .theme-toggle:hover {
    background-color: var(--primary-color);
    color: white;
}

body.light-mode .language-toggle {
    color: #2c3e50;
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.8);
}

body.light-mode .language-toggle:hover {
    background-color: var(--primary-color);
    color: white;
}

body.light-mode .nav-slider {
    background: linear-gradient(90deg, var(--primary-color), #e67e22);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

body.light-mode .project-item {
    background-color: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(231, 76, 60, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

body.light-mode .project-item.revealed:hover {
    transform: scale(1.03) translateY(-8px) !important;
    box-shadow: 0 20px 40px rgba(231, 76, 60, 0.25);
    border-color: var(--primary-color);
}

body.light-mode .project-info h4 {
    color: #2c3e50;
    font-weight: 700;
}

body.light-mode .project_info .category {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.85em;
}

body.light-mode .project-info .description {
    color: #34495e;
    font-weight: 500;
}

body.light-mode .section-title h2 {
    color: #2c3e50;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

body.light-mode .section-title i {
    color: var(--primary-color);
}

body.light-mode .hero-content h1 {
    color: #2c3e50;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

body.light-mode .hero-content p {
    color: #34495e;
    font-weight: 600;
}

/* Light mode - background untuk kotak container */
body.light-mode #work,
body.light-mode #about,
body.light-mode #contact {
    background-color: transparent; /* Background dipindah ke container */
    box-shadow: none;
    border: none;
}

body.light-mode .section-content-container {
    background-color: rgba(255, 255, 255, 0.9); /* Background kotak light mode */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.1);
}

body.light-mode .about-content {
    color: #2c3e50;
    font-weight: 500;
    margin: 15px 0;
}

body.light-mode .about-content p {
    color: #2c3e50;
    font-weight: 500;
    margin: 15px 0;
}

body.light-mode .contact-info {
    color: #2c3e50;
    font-weight: 600;
}

body.light-mode .contact-info p {
    color: #2c3e50;
    font-weight: 600;
}

body.light-mode .contact-item {
    color: #2c3e50;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(231, 76, 60, 0.2);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

body.light-mode .contact-item:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px) scale(1);
    box-shadow: 0 10px 25px rgba(231, 76, 60, 0.4);
    border-color: var(--primary-color);
}

/* Light mode styles for back button */
body.light-mode .back-button {
    color: #2c3e50;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

body.light-mode .back-button:hover {
    color: white;
    background-color: var(--primary-color);
    transform: translateX(-5px) translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
    border-color: var(--primary-color);
}

/* Back to Projects Button */
.back-to-projects {
    margin-bottom: 30px;
    text-align: left;
}

.back-button {
    display: inline-flex;
    align-items: center;
    color: var(--light-grey);
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    background-color: rgba(52, 73, 94, 0.8);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.back-button i {
    margin-right: 24px;
    font-size: 1.1em;
}

.back-button:hover {
    color: white;
    background-color: var(--primary-color);
    transform: translateX(-5px) translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3);
}

/* Ensure proper centering for desktop */
@media (min-width: 769px) {
    .container {
        padding: 0 20px;
        margin: 0 auto;
    }
    
    .section-content-container {
        margin: 0 60px 50px 60px; /* Tambah margin bawah untuk desktop */
        padding: 60px 50px; /* Padding lebih besar untuk desktop */
        text-align: center;
    }
    
    #contact .container,
    #about .container,
    #work .container {
        padding: 20px 20px;
        margin: 0 auto;
    }
}

/* Force full width on mobile - prevent right spacing */
@media (max-width: 768px) {
    html {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    body {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        padding-top: 100px !important;
        overflow-x: hidden !important;
    }
    
    header {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        padding: 5px 0 !important;
    }
    
    header .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    section {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
    }
    
    section .container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 5px 5px !important;
    }
}

/* Media Queries - Mobile Responsive */
@media (max-width: 768px) {
    /* Prevent horizontal scroll on mobile */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }
    
    /* Mobile container */
    .container {
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Mobile Header Layout - 3 rows */
    nav {
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 0 5px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        margin: 0;
    }
    
    /* Hide desktop logo, show mobile logo */
    .logo-desktop {
        display: none;
    }
    
    .logo-mobile,
    .nav-logo-row {
        display: flex;
        order: 1;
    }
    
    /* First row: Logo centered */
    .nav-logo-row {
        justify-content: center;
        align-items: center;
        width: 100%;
        padding: 2px 0;
    }
    
    /* Second row: Main navigation */
    .nav-main-row {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        order: 2;
    }
    
    /* Third row: Language and theme buttons */
    .nav-controls-row {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 15px;
        width: 100%;
        order: 3;
        padding: 0;
    }
    
    /* Mobile navigation list styling */
    nav ul {
        display: flex;
        gap: 12px;
        margin: 0;
        padding: 0;
        justify-content: center;
        overflow: hidden !important; /* Prevent scroll on mobile too */
        white-space: nowrap; /* Prevent wrapping */
    }
    
    nav ul li {
        margin: 0;
    }
    
    nav ul li a {
        font-size: 0.8em;
        padding: 4px 8px;
    }
    
    /* Adjust header height for mobile - 3 rows */
    header {
        min-height: 90px; /* Increased for 3 rows */
        padding: 5px 0;
    }
    
    /* Adjust body padding for new header height */
    body {
        padding-top: 100px; /* Increased padding for 3-row header */
    }
    
    /* Smaller logo for mobile */
    .logo-img {
        height: 26px;
    }
    
    /* Mobile button sizing */
    .theme-toggle,
    .language-toggle {
        height: 28px;
        font-size: 0.75em;
    }
    
    .theme-toggle {
        width: 28px;
    }
    
    .language-toggle {
        min-width: 45px;
        padding: 3px 6px;
    }
    
    /* Adjust navigation slider for mobile */
    .nav-slider {
        bottom: -2px;
        height: 1.5px;
    }
    
    /* Mobile project grid */
    .project-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 0px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        margin-bottom: 30px;
    }
    
    /* Ensure project items don't overflow */
    .project-item {
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
    }
    
    /* Reduce project image height for mobile */
    .project-item img {
        height: 150px; /* Reduced from 200px */
    }
    
    .project-info {
        padding: 15px; /* Slightly less padding */
    }
    
    .project-info h4 {
        font-size: 1.2em; /* Slightly smaller title */
    }
    
    .project-info .description {
        font-size: 0.85em; /* Smaller description text */
        line-height: 1.4;
    }
    
    /* Mobile project detail page */
    .main-detail-image {
        max-width: 100%;
        height: 200px; /* Fixed height for mobile */
        object-fit: contain;
        width: 100%;
        background-color: rgba(0, 0, 0, 0.15);
    }
    
    .project-title {
        font-size: 1.6em;
        margin-bottom: 8px;
    }
    
    .project-meta {
        font-size: 0.8em;
        margin-bottom: 20px;
    }
    
    .project-description-content {
        margin: 0 10px;
        padding: 15px;
    }
    
    .project-description-content h3 {
        font-size: 1.2em;
        margin-top: 20px;
        margin-bottom: 10px;
    }
    
    /* Mobile hero section */
    #hero {
        min-height: 30vh;
        padding: 20px 0;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    /* Mobile sections */
    .section-content-container {
        margin: 0 20px 35px 20px; /* Tambah margin bawah untuk mobile */
        padding: 40px 25px; /* Padding sesuai mobile */
        width: auto; /* Auto width dengan margin */
        max-width: none;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .contact-methods {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 30px;
    }
    
    .contact-item {
        justify-content: center;
        padding: 12px 20px;
    }
    
    /* Add spacing between sections on mobile only */
    section {
        margin-bottom: 50px !important;
    }

    section:last-of-type {
        margin-bottom: 0 !important;
    }

    /* Specific section spacing for mobile */
    #hero {
        margin-bottom: 40px !important;
        padding-bottom: 30px !important;
    }

    #work {
        margin-bottom: 60px !important;
    }

    #about {
        margin-bottom: 60px !important;
    }

    #contact {
        margin-bottom: 30px !important;
    }

    /* Mobile content spacing adjustments */
    .about-content,
    .contact-info {
        margin-top: 10px !important;
    }
    
    .project-grid {
        margin-top: 10px !important;
    }
}

/* Aggressive fix for mobile viewport issues */
@media (max-width: 768px) {
    /* Reset viewport settings */
    * {
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100vw !important;
    }
    
    /* Specific element fixes */
    .nav-main-row ul {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        justify-content: center !important;
    }
    
    .nav-controls-row {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .hero-content {
        margin: 0 !important;
        padding: 0 10px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .project-grid {
        margin: 0 !important;
        padding: 10px 5px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .project-item {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .about-content,
    .contact-info {
        margin: 0 !important;
        padding: 0 5px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    footer {
        margin: 0 !important;
        padding: 20px 5px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    footer .container {
        padding: 0 5px !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    footer p {
        margin: 0 !important;
        padding: 0 5px !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* Additional mobile fixes to prevent horizontal scroll */
@media (max-width: 768px) {
    /* Ensure all elements stay within viewport */
    * {
        max-width: 100vw !important;
        overflow-x: hidden;
    }
    
    /* Specific fixes for common overflow causes */
    nav ul {
        max-width: 100%;
        overflow-x: hidden;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .contact-methods {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .contact-item {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure project content doesn't overflow */
    .project-info {
        width: 100%;
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    .project-info h4,
    .project-info .description {
        width: 100%;
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
}

/* Light mode mobile styles */
@media (max-width: 768px) {
    /* Remove border styling for light mode as well */
}

/* Very small screens - phones in portrait */
@media (max-width: 480px) {
    /* Extra prevention for horizontal scroll */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }
    
    .container {
        padding: 0 5px;
        width: 100%;
        max-width: 100vw;
        margin: 0;
    }
    
    header {
        min-height: 95px;
        width: 100%;
        max-width: 100vw;
    }
    
    body {
        padding-top: 105px;
    }
    
    nav ul {
        gap: 8px;
    }
    
    nav ul li a {
        font-size: 0.75em;
        padding: 3px 6px;
    }
    
    .nav-logo-row {
        padding: 1px 0;
    }
    
    .logo-img {
        height: 24px;
    }
    
    /* Even smaller project images for very small screens */
    .project-item img {
        height: 120px; /* Further reduced for portrait phones */
    }
    
    .project-info {
        padding: 12px;
    }
    
    .project-info h4 {
        font-size: 1.1em;
    }
    
    .project-info .description {
        font-size: 0.8em;
        line-height: 1.3;
    }
    
    /* Very small screens - project detail */
    .main-detail-image {
        height: 160px; /* Even smaller height for portrait phones */
        object-fit: contain;
        background-color: rgba(0, 0, 0, 0.15);
    }
    
    .project-title {
        font-size: 1.4em;
    }
    
    .project-description-content {
        margin: 0 5px;
        padding: 12px;
    }
    
    .project-description-content h3 {
        font-size: 1.1em;
    }
    
    /* Very small screens - footer */
    footer {
        padding: 15px 3px !important;
        font-size: 0.8em !important;
    }
    
    footer .container {
        padding: 0 3px !important;
    }
    
    footer p {
        padding: 0 3px !important;
        text-align: center !important;
        line-height: 1.4 !important;
    }

    /* Very small screens - section titles */
    .section-title {
        margin-bottom: 25px;
        margin-top: 25px; /* Keep consistent with margin approach */
        padding: 0 5px;
    }
    
    .section-title i {
        margin-bottom: 10px;
        font-size: 1.6em;
    }
    
    .section-title h2 {
        font-size: 1.8em;
        margin-top: 10px;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .section-content-container {
        margin: 0 15px 30px 15px; /* Tambah margin bawah untuk very small */
        padding: 35px 20px; /* Padding sesuai very small screens */
        width: auto;
        max-width: none;
        box-sizing: border-box;
    }
}

/* Very small screens - contact methods spacing */
    .contact-methods {
        margin-bottom: 25px !important;
        gap: 12px !important;
    }

/* Ensure bottom elements don't cause horizontal scroll on mobile */
@media (max-width: 768px) {
    #contact {
        padding-right: 0 !important;
        margin-right: 0 !important;
    }

    #contact .container {
        padding-bottom: 20px !important;
        padding-right: 5px !important;
        margin-right: 0 !important;
    }

    .contact-methods {
        padding: 0 5px !important;
        margin: 0 !important;
        width: calc(100% - 10px) !important;
    }

    .contact-item {
        margin: 0 !important;
        padding: 12px 15px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Alternative approach: allow body to scroll to show footer on desktop */
@media (min-width: 769px) {
    body {
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    /* Make main content scrollable instead of body */
    main {
        min-height: calc(100vh - 60px); /* Use min-height instead of fixed height */
        overflow-x: hidden;
        scroll-behavior: smooth; /* Enable smooth scrolling */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    main::-webkit-scrollbar {
        display: none;
        width: 0;
        background: transparent;
    }
    
    /* Ensure sections fit properly */
    section {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Light mode footer styles */
body.light-mode footer {
    background-color: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    border-top: 1px solid rgba(231, 76, 60, 0.2);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
}

body.light-mode footer p {
    color: #2c3e50;
    font-weight: 600;
}

/* Exception: Keep spacing for contact item icons */
    .contact-item i {
        margin-right: 10px !important;
    }