/* --- Base Styles --- */
body {
    font-family: 'Sarabun', sans-serif;
    background-color: #f0f2f5;
    background-image: url(https://lh3.googleusercontent.com/p/AF1QipMEL-fbE842GT9Y7X7PW3E8pKaDdCVcvps38-Y8=s1080);
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
    color: #333;
    line-height: 1.7;
    margin: 0;
    padding-top: 70px;
}

/* --- Navbar --- */
.navbar {
    background-color: #1f618d;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 999;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    width: 100%;
    max-width: 1100px;
    padding: 0 20px;
    position: relative;
}
.navbar-logo {
    color: #fff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}
.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    text-align: center;
    margin: 0;
    padding: 0;
}
.nav-item {
    height: 70px;
}
.nav-link {
    color: #fff;
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 0 1rem;
    height: 100%;
    transition: all 0.2s ease-out;
}
.nav-link:hover {
    color: #aed6f1;
}
.nav-link.active {
    border-bottom: 4px solid #f1c40f;
    color: #f1c40f;
}

/* --- Menu Toggle (Hamburger) --- */
.menu-toggle {
    display: none; /* Hidden on desktop */
    font-size: 2rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
}

/* --- Container & Card --- */
.container {
    width: 95%;
    max-width: 1000px;
    margin: 20px auto;
    padding: 10px;
    background-color: #ffffff80;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}
.card {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    padding: 30px;
}

/* --- Headings --- */
h1, h2, h3 {
    text-align: center;
    color: #1a5276;
}
h2, h3 {
    margin-top: 0;
}
h2 {
    border-bottom: 2px solid #aed6f1;
    padding-bottom: 10px;
}

/* --- Lists --- */
.achievement-list {
    list-style: none;
    padding-left: 0;
}
.achievement-list li {
    padding: 10px;
    border-bottom: 1px solid #e5e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.achievement-list li:last-child {
    border-bottom: none;
}
.icon {
    margin-right: 15px;
    font-size: 1.2rem;
}
.major-project-list li {
    margin-bottom: 10px;
}
.major-project {
    background-color: #fef9e7;
}

/* --- Cite Link --- */
.cite-link {
    cursor: pointer;
    color: #3498db;
    text-decoration: underline;
    font-weight: bold;
    font-size: 0.8rem;
    margin-left: 8px;
    white-space: nowrap;
}
.cite-link:hover {
    color: #2980b9;
}

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 20px;
}
table, .summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0; /* Adjusted from 20px since wrapper has it now */
}
th, td, .summary-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    white-space: nowrap; /* Prevent text wrapping in table cells */
}
th {
    background-color: #eaf2f8;
}
td:nth-child(2), .summary-table td:last-child {
    text-align: right;
    font-weight: bold;
}
.total-row td, .total-row {
    font-weight: bold;
    font-size: 1.1rem;
    border-top: 2px solid #1a5276;
}
.summary-table {
    margin-top: 20px;
}
.table-responsive .summary-table {
    margin-top: 0;
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    padding-top: 20px;
}
.modal-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 800px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
#modalImage, #modalImageContainer img {
    width: 100%;
    border-radius: 5px;
    display: block;
    margin-bottom: 15px;
}
.modal-close-button {
    position: absolute;
    top: -5px;
    right: 5px;
    color: #fff;
    font-size: 35px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}
.modal-close-button:hover,
.modal-close-button:focus {
    color: #bbb;
    text-decoration: none;
}

/* --- Slider & Switch --- */
.slider-container, .risk-container {
    margin: 20px 0;
    text-align: center;
}
input[type=range] {
    width: 80%;
    cursor: pointer;
}
.rate-display {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2980b9;
}
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider-toggle:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked+.slider-toggle {
    background-color: #e74c3c;
}
input:checked+.slider-toggle:before {
    transform: translateX(26px);
}

/* --- Results & Recommendations --- */
.results-card {
    margin-top: 20px;
    padding: 20px;
    background-color: #f8f9f9;
    border-top: 5px solid #2980b9;
    border-radius: 5px;
}
.personal-cost-card {
    border-top-color: #16a085;
}
.personal-cost-card p {
    margin: 10px 0;
    font-size: 1.2rem;
    text-align: center;
}
.surplus {
    color: #27ae60;
}
.deficit {
    color: #c0392b;
}
.risk-info {
    border-left: 5px solid #f39c12;
    border-top: none;
}
.risk-info li {
    list-style-position: inside;
}
.recommendations ul {
    list-style-type: '✅';
    padding-left: 20px;
}
.recommendations li {
    padding-left: 10px;
    margin-bottom: 8px;
}

/* --- Responsive Design for Mobile --- */
@media screen and (max-width: 800px) {
    .menu-toggle {
        display: block; /* Show hamburger */
    }

    .nav-menu {
        display: none; /* Hide nav links by default */
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 70px;
        left: 0;
        background-color: #1f618d;
        box-shadow: 0 3px 5px rgba(0,0,0,0.2);
    }

    .nav-menu.active {
        display: flex; /* Show menu when active */
    }

    .nav-item {
        width: 100%;
        height: auto;
        border-top: 1px solid #aed6f140;
    }
    
    .nav-link {
        padding: 1rem;
        width: 100%;
        justify-content: center;
    }
    
    .nav-link.active {
        border-bottom: none;
        background-color: #f1c40f;
        color: #1a5276;
    }
    
    .container {
        width: 100%;
        margin-top: 10px;
        padding: 5px;
        border-radius: 0;
    }
    
    .card {
        padding: 15px;
        margin-bottom: 20px;
    }

    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    .rate-display {
        font-size: 2rem;
    }
    
    .personal-cost-card p {
        font-size: 1.1rem;
    }

    .achievement-list li {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .cite-link {
       display: inline-block;
       margin-top: 5px;
       margin-left: 0;
    }
}