/* =============================================== */
/* === Root Variables & Body Styles === */
/* =============================================== */
:root {
    --primary-color: #00b4d8;
    --secondary-color: #005f73;
    --bg-light: #f0f8ff;
    --bg-white: #ffffff;
    --border-color: #ade8f4;
    --text-color: #333;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    margin: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.7;
    font-size: 17px;
}

/* =============================================== */
/* === Navbar & Header Styles === */
/* =============================================== */
.navbar {
    background-color: var(--bg-white);
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.navbar .logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--secondary-color);
}

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

.nav-links a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 18px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: #eaf6ff;
}

header h1 {
    color: var(--secondary-color);
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 32px;
    font-weight: 700;
}

h2 { 
    font-size: 24px; 
    margin-bottom: 15px; 
    font-weight: 600; 
}

p { 
    margin-bottom: 1rem; 
}

/* =============================================== */
/* === Main Content & Scanner Section === */
/* =============================================== */
main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    box-sizing: border-box;
}

.container {
    background-color: var(--bg-white);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
    box-sizing: border-box;
}

.upload-section .btn {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin: 8px;
    transition: background-color 0.3s;
}

.upload-section .btn:hover { 
    background-color: #0077b6; 
}

.image-preview {
    margin-top: 30px;
    min-height: 150px;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    position: relative;
}

#preview {
    max-width: 100%;
    max-height: 250px;
    display: none;
}

.result-section { 
    margin-top: 20px; 
}

.result-section h2 { 
    color: var(--secondary-color); 
}

.scan-status {
    font-weight: 300;
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    min-height: 1.5em; 
    transition: color 0.3s ease-in-out;
    font-size: 12px;
}

.status-success {
    color: #28a745; 
}

.status-error {
    color: #dc3545;
}

/* =============================================== */
/* === CORRECTED QR Code Result Display Styles === */
/* =============================================== */

/* The main container box. It's the box that's visible when empty. */
.decoded-content-box {
    background-color: #f8f9fa; /* Light grey background for the whole area */
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px; /* Padding around the results */
    min-height: 100px; /* This makes the box visible when empty */
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Space between each result row */
}

/* A single result row: contains the text box and the icon */
.result-row {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between the text box and the icon */
}

/* The actual "text box" with its own style */
.decoded-text {
    flex-grow: 1;
    background-color: var(--bg-white); /* White background to stand out */
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 15px;
    word-break: break-all;
    text-align: left;
    font-size: 1rem;
    color: var(--text-color);
}

a.decoded-text {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

a.decoded-text:hover {
    text-decoration: underline;
}

/* The copy button, styled as an icon */
.copy-button {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease-in-out;
}

.copy-button:hover {
    background-color: #e9e9e9;
}

/* ในไฟล์ styles.css */

.copy-button svg {
    width: 22px;
    height: 22px;
    /* [เปลี่ยน] ไม่เติมสีทึบ แต่ให้เป็นสีของเส้นขอบแทน */
    fill: none;
    stroke: var(--text-color);
}

.copy-button:disabled svg {
    fill: var(--text-color);
    stroke: none;
}

/* ================================================= */
/* === NEW: Tooltip for Copy Button === */
/* ================================================= */

/* 1. ตั้งค่าให้ตัวปุ่มเป็นจุดอ้างอิงสำหรับตำแหน่งของ Tooltip */
.copy-button {
    position: relative; /* สำคัญมาก! */
}

/* 2. สร้างและออกแบบ Tooltip ด้วย pseudo-element ::after */
.copy-button::after {
    content: 'Copy'; /* ข้อความที่จะแสดงใน Tooltip */
    position: absolute;
    bottom: calc(100% + 5px); /* ตำแหน่ง: อยู่เหนือปุ่ม 5px */
    left: 50%; /* จัดให้อยู่กึ่งกลางแนวนอนของปุ่ม */
    transform: translateX(-50%); /* เทคนิคจัดกลางให้สมบูรณ์ */
    
    background-color: var(--text-color); /* สีพื้นหลัง (เทาเข้ม) */
    color: white; /* สีข้อความ */
    padding: 4px 8px; /* ระยะห่างภายใน */
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap; /* ป้องกันไม่ให้ข้อความขึ้นบรรทัดใหม่ */
    
    /* ซ่อน Tooltip ไว้เป็นค่าเริ่มต้น */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    z-index: 10; /* ทำให้ Tooltip อยู่เหนือองค์ประกอบอื่น */
}

/* 3. ทำให้ Tooltip แสดงขึ้นมาเมื่อผู้ใช้ hover ที่ปุ่ม */
.copy-button:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 4. [สำคัญ] ซ่อน Tooltip เมื่อปุ่มถูกกดไปแล้ว (disabled) */
.copy-button:disabled::after {
    display: none;
}


/* =============================================== */
/* === How To Guide Section === */
/* =============================================== */
.how-to-section {
    background-color: var(--bg-white);
    padding: 60px 20px;
    box-shadow: 0 -4px 8px -2px rgba(0,0,0,0.05);
}

.how-to-container {
    max-width: 800px;
    margin: 0 auto;
}

.how-to-container h2 {
    text-align: center;
    color: var(--secondary-color);
    margin-top: 0;
    margin-bottom: 40px;
    font-size: 28px;
}

.how-to-steps {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
}

.step-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    margin-right: 20px;
}

.step-text h3 {
    margin: 0 0 5px 0;
    color: var(--secondary-color);
    font-size: 20px;
}

.step-text p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.6;
}

.how-to-footer {
    text-align: center;
    margin-top: 40px;
    font-style: italic;
    color: var(--secondary-color);
}

/* =============================================== */
/* === Footer Section === */
/* =============================================== */
.footer-section {
    background-color: var(--secondary-color);
    color: white;
    padding: 25px 20px;
    text-align: center;
}

.footer-section a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 5px;
}

.footer-section a:hover {
    text-decoration: underline;
}

.footer-content p {
    margin: 5px 0;
}

/* =============================================== */
/* === Utility & Section Backgrounds === */
/* =============================================== */
.content-box { max-width: 700px; margin: 0 auto; }
.text-center { text-align: center; }
.section-light { background-color: var(--bg-light); padding: 40px 20px; }
.section-white { background-color: var(--bg-white); padding: 40px 20px; }
.section-blue { background-color: #e0f7fa; padding: 40px 20px; }

/* =============================================== */
/* === Responsive & Hamburger Menu === */
/* =============================================== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.hamburger-line {
    width: 30px;
    height: 3px;
    background-color: var(--secondary-color);
    border-radius: 3px;
    transition: all 0.3s linear;
}

@media (max-width: 768px) {
    .nav-links {
        display: block;
        position: absolute;
        top: 60px; /* Adjust based on your navbar height */
        left: 0;
        width: 100%;
        background-color: var(--bg-white);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    .nav-links a {
        text-align: center;
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
        display: block;
        border-top: 1px solid #eaf6ff;
    }

    .nav-links a:first-child {
        border-top: none;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }

    .hamburger.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
}

.center-list {
  list-style-type: none;   /* เอา bullet ออก */
  padding-left: 0;         /* ลบช่องว่างด้านซ้าย */
  text-align: center;      /* ถ้าต้องการให้อยู่ตรงกลาง */
}
