/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;700&display=swap');

/* --- General Styles --- */
body {
    font-family: 'Sarabun', sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px; /* ขยายความกว้างสูงสุดสำหรับ 2 คอลัมน์ */
    margin: 0 auto;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px S20px rgba(0, 0, 0, 0.08);
}

header {
    text-align: center;
    border-bottom: 2px solid #e0e6ed;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin: 0;
}

/* --- Editor Layout (หัวใจของหน้าตาใหม่) --- */
.editor-layout {
    display: flex;
    gap: 20px; /* ระยะห่างระหว่าง 2 panel */
}

.panel {
    flex: 1; /* ทำให้ทั้ง 2 panel แบ่งพื้นที่เท่าๆ กัน */
    min-width: 0; /* ป้องกัน flexbox บีบเนื้อหา */
}

.panel h2 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.2rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e6ed;
}

/* --- Code Panel Styling --- */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: -12px; /* trick เล็กน้อยให้ปุ่มดูสวย */
}

.code-header h2 {
    border-bottom: none; /* เอาเส้นใต้ออกเพราะจะใช้ปุ่มจัด layout */
}

#copy-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

#copy-btn:hover {
    background-color: #2980b9;
}

/* แปลงโฉม Textarea ให้เหมือน Code Editor */
#html-output {
    width: 100%;
    height: 600px; /* กำหนดความสูงให้เท่าๆ กับ TinyMCE */
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
    line-height: 1.5;
    background-color: #2d3436; /* พื้นหลังสีเข้ม */
    color: #dfe6e9; /* ตัวอักษรสีอ่อน */
    resize: vertical; /* อนุญาตให้ผู้ใช้ยืด-หดได้แค่แนวตั้ง */
    border: 1px solid #444;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #e0e6ed;
    color: #95a5a6;
}

.back-home-btn {
  display: inline-block;
  background: #1e88e5;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.2s;
}
.back-home-btn:hover {
  background: #1565c0;
}


/* --- Mobile Responsiveness --- */
@media (max-width: 900px) {
    .editor-layout {
        flex-direction: column; /* เปลี่ยนเป็นเรียงบน-ล่างในจอมือถือ */
    }
}