/* /css/style.css */

/* --- การตั้งค่าโดยรวมและตัวแปรสี --- */
:root {
    --primary-color: #007BFF; /* สีน้ำเงินหลัก */
    --secondary-color: #0056b3; /* สีน้ำเงินเข้ม */
    --light-blue-color: #E3F2FD; /* สีฟ้าอ่อน */
    --white-color: #FFFFFF;
    --text-color: #333;
    --light-gray-color: #f8f9fa;
    --border-color: #dee2e6;
}

body {
    font-family: 'Poppins', sans-serif; /* แนะนำให้ใช้ Google Font เพื่อความทันสมัย */
    margin: 0;
    background-color: var(--light-gray-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

/* --- Header & Navigation --- */
.main-header {
    background-color: var(--white-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

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

.main-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-nav li {
    display: inline-block;
    margin-left: 25px;
}

.main-nav a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--secondary-color);
}

/* --- Footer --- */
.main-footer {
    background-color: var(--primary-color);
    color: var(--white-color);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 40px;
}

/* --- หน้าหลัก (index.html) --- */
.page-title {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 40px;
    color: var(--secondary-color);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.app-card {
    background-color: var(--white-color);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    text-align: center;
    padding: 20px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

.app-card img {
    max-width: 100px;
    height: auto;
    margin-bottom: 15px;
    border-radius: 20px;
}

.app-card h3 {
    margin: 0;
    color: var(--primary-color);
}

/* --- หน้ารายละเอียดแอป (app_details.html) --- */
.app-detail-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white-color);
    border-radius: 10px;
}

.app-detail-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
}

.app-content {
    background-color: var(--white-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.responsive-img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.features-section h2 {
    color: var(--secondary-color);
    border-bottom: 2px solid var(--light-blue-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.features-section ul {
    list-style: none;
    padding: 0;
}

.features-section li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.features-section li:before {
    content: '✓';
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 15px;
    font-size: 1.2rem;
}

/* --- หน้า Privacy Policy --- */
.policy-content {
    background-color: var(--white-color);
    padding: 30px 40px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.policy-content h2 {
    color: var(--secondary-color);
}

/* --- เพิ่มเติมสำหรับหน้ารายละเอียดแอป และปุ่มเปลี่ยนภาษา --- */

/* สไตล์สำหรับปุ่มเปลี่ยนภาษาใน Header */
.language-toggle {
    margin-left: 20px;
}

.language-toggle button {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
}

.language-toggle button:hover {
    background-color: var(--light-blue-color);
}

.language-toggle button:disabled {
    background-color: var(--primary-color);
    color: var(--white-color);
    cursor: default;
}

/* สไตล์สำหรับส่วนแสดง Screenshot */
.screenshots-container h3 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

.screenshots {
    display: grid;
    /* แสดง 3 รูปในแถวบน Desktop และปรับลดลงตามขนาดจอ */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.screenshots img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.screenshots img:hover {
    transform: scale(1.05);
}

/* --- ปรับปรุงสไตล์สำหรับ Modal แสดงรูปภาพ --- */
/* พื้นหลังของ Modal พร้อม Animation */
.modal {
    display: flex; /* ใช้ Flexbox เพื่อจัดกลาง */
    justify-content: center;
    align-items: center;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* ป้องกันการเลื่อนหน้าหลัก */
    background-color: rgba(0, 0, 0, 0.85);
    
    /* สถานะเริ่มต้น (ซ่อน) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s; /* Fade out effect */
}

/* คลาสสำหรับสั่งให้ Modal แสดงผล */
.modal.modal-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease; /* Fade in effect */
}

/* รูปภาพใน Modal (สำคัญ!) */
#modalImage {
    /* ทำให้รูปภาพพอดีกับหน้าจอ โดยไม่เสียสัดส่วน */
    max-width: 90vw;   /* กว้างไม่เกิน 90% ของความกว้างหน้าจอ */
    max-height: 85vh;  /* สูงไม่เกิน 85% ของความสูงหน้าจอ */
    width: auto;
    height: auto;
    display: block;
    margin: auto;
    border-radius: 8px; /* ทำให้ขอบมนเล็กน้อย */
}

/* ปุ่มปิด (Close) */
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

/* ปุ่ม Prev/Next */
.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    transition: background-color 0.3s ease;
    border-radius: 0 5px 5px 0;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.3); /* เพิ่มพื้นหลังให้เห็นชัดขึ้น */
}

.prev {
    left: 0;
    border-radius: 5px 0 0 5px;
}

.next {
    right: 0;
    border-radius: 0 5px 5px 0;
}

.prev:hover, .next:hover, .close:hover {
    background-color: rgba(0, 123, 255, 0.7); /* ใช้สี Primary ของธีมเมื่อ Hover */
    color: #fff;
}

/* เพิ่มส่วนแสดงตัวนับรูปภาพ */
#caption {
    text-align: center;
    color: #ccc;
    padding-top: 15px;
    font-size: 1.1rem;
    position: absolute;
    bottom: 20px;
    width: 100%;
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
    }

    .main-nav ul {
        margin-top: 15px;
    }

    .main-nav li {
        margin: 0 10px;
    }

    .app-detail-header h1 {
        font-size: 2rem;
    }
}