﻿/* ----------------------------------------------------
   CTEQUIZ – Global Styles
   Path: public/assets/css/style.css
   Font: Google Fonts (Itim)
---------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Itim&display=swap');

:root{
  --bg:         #f4f8fb;
  --card:       rgba(255, 255, 255, 0.9);
  --ring:       #dbe7f3;
  --text:       #0f172a;
  --muted:      #6b7280;

  --primary:    #18a4ad;   /* teal */
  --primary-2: #0ea5b1;
  --accent:     #60a5fa;   /* blue bar */
  --success:    #22c55e;   /* timer/ok */
  --danger:     #ef4444;

  --shadow:     0 10px 25px rgba(2,22,40,.1);
  --radius:     18px;
}

*{ box-sizing:border-box }
html,body{
  margin:0; padding:0;
  background-color:var(--bg);
  color:var(--text);
  /* ---- แก้ไข: เปลี่ยน Font เป็น Itim ---- */
  font-family: 'Itim', cursive, sans-serif;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  font-size: 24px;
}

/* ==========================================================
   <<<<           โค้ดพื้นหลังและส่วนหัว/ท้าย           >>>>
   ========================================================== */
body.bg-host, body.bg-player {
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
}
body.bg-host {
    background-image: url('/assets/wall1.png');
}
body.bg-player {
    background-image: url('/assets/wall2.png');
}

.page-header, .page-footer {
    background-color: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    padding: 12px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.page-header {
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.page-footer {
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 16px;
    font-size: 14px;
    text-align: center;
}
/* ---- แก้ไข: ทำให้ข้อความใน Header อ่านง่ายขึ้น ---- */
.page-header h1, .page-header h2 {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.page-header .muted {
    color: #e0e7ff; /* สีขาวอมฟ้าเล็กน้อย */
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
/* ========================================================== */


img{ max-width:100%; height:auto; display:block }
a{ color:var(--primary); text-decoration:none }
a:hover{ text-decoration:underline }

.container{ max-width:1200px; margin:18px auto; padding:0 12px }

.card{
  background: #fffde8;
  border-radius: 10px;
  padding: 16px;
  border: 2px solid #4a4a4a;
  box-shadow: 5px 5px 0px #4a4a4a;
  border-style: outset;
  margin-bottom: 24px;
}

.row{ display:flex; gap:8px; align-items:center; flex-wrap:wrap }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:8px }
@media (max-width:640px){ .grid2{ grid-template-columns:1fr } }

h1,h2,h3{ margin:.2rem 0 .6rem; color: #333; }
h1{ font-size:1.8em } h2{ font-size:1.5em } h3{ font-size:1.2em }
.muted{ color:var(--muted) }
.center{ text-align:center }
.text-right{ text-align:right }

.btn{
  background:var(--primary);
  color:#fff;
  border: 2px solid #4a4a4a;
  border-radius:12px;
  padding:10px 16px;
  cursor:pointer;
  transition: all 0.1s ease-in-out;
  box-shadow: 3px 3px 0px #4a4a4a;
  font-family: 'Itim', cursive, sans-serif;
  font-size: 1em;
  font-weight: 500;
  display: inline-block;
  text-decoration: none;
}
.btn:hover{ background:var(--primary-2); text-decoration: none; color: #fff; }
.btn:active{ transform:translate(3px, 3px); box-shadow: none; }
.btn:disabled{ opacity:.6; cursor:not-allowed }
.btn.secondary{
  background:#e2e8f0; color:#0f172a;
}
.btn.secondary:hover{ background:#dbe3ee; color:#0f172a; }
.btn.danger{ background:var(--danger) }
.btn.danger:hover{ filter:brightness(.95) }
.btn.success { background:var(--success) }
.btn.success:hover{ filter:brightness(.95) }


input,select,textarea{
  width:100%;
  padding:10px 12px;
  border:2px solid #4a4a4a;
  border-radius:12px;
  background:#fff;
  outline:none;
  font-family: 'Itim', cursive, sans-serif;
  font-size: 1em;
}
input:focus,select:focus,textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(14,165,177,.15);
}

.badge{
  display:inline-block;
  background:#e6f6f7;
  color:#0f6070;
  border-radius:10px;
  padding:2px 8px;
  font-size:14px;
}

.notice, .error{
  display:inline-block;
  border-radius:10px;
  padding:6px 10px;
  border: 2px solid #4a4a4a;
}
.notice{ background:#e8fbe9; color:#14532d; }
.error{ background:#fee2e2; color:#7f1d1d; }

.progress{
  width:100%; height:10px;
  background:#e5e7eb;
  border-radius:999px;
  overflow:hidden; margin-top:6px;
  border: 1px solid #ccc;
}
.progress>div{
  height:10px; background:var(--success);
  width:0%;
  transition:width .2s linear;
}

.bars .bar{
  background:#eef2f7;
  border-radius:999px;
  height:12px; overflow:hidden;
}
.bars .bar>div{
  height:12px; background:var(--accent);
  width:0%;
}

.layout{ display:grid; gap:18px }
@media (min-width:1024px){
  .layout{ grid-template-columns: 1fr 380px }
  .sidebar{ position:sticky; top:16px; height: calc(100vh - 32px); overflow:auto }
}
.brand{ display:flex; align-items:center; gap:10px; margin-bottom:8px }
.brand img{ width:48px; height:48px }
.brand .title{ font-weight:700; font-size:20px }
.kpi{ display:flex; gap:10px; flex-wrap:wrap }
.kpi .badge{ font-size:14px }

.timerHost{ font-size:14px }

.question-preview{
  border:1px solid #eef2f7;
  border-radius:12px;
  padding:8px; margin:8px 0;
  background:#fffde8;
}
.question-preview img{ border-radius:10px; margin-top:6px }

.leaderboard table{ width:100%; border-collapse:collapse }
.leaderboard th,.leaderboard td{
  padding:6px 8px; border-bottom:1px solid #eef2f7; font-size:14px;
}
.leaderboard th{ text-align:left; color:#374151 }

#timerbox p{ margin:.2rem 0 }
#feedback{ min-height:40px }

.hidden{ display:none !important }
.mt-8{ margin-top:8px } .mb-8{ margin-bottom:8px }
.mt-12{ margin-top:12px } .mb-12{ margin-bottom:12px }

.stickyHeader{
  display:flex; justify-content:space-between; align-items:center; margin-bottom:5px;
}
.audioCtrl{ display:flex; gap:8px; align-items:center }
/* ==========================================================
   <<<<           โค้ดที่เพิ่ม: สไตล์สำหรับ Profile Modal           >>>>
   ========================================================== */
.page-footer a {
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
}
.page-footer a:hover {
    color: #e0e7ff;
}

.profile-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: none; /* ซ่อนไว้ก่อน */
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}
.profile-panel {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    align-items: start;
    background: #fffde8;
    border-radius: 10px;
    padding: 24px;
    border: 2px solid #4a4a4a;
    box-shadow: 5px 5px 0px #4a4a4a;
    width: min(900px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
}
.profile-img {
    width: 200px;
    height: 200px;
    border-radius: 50%; /* ทำให้รูปเป็นวงกลม */
    border: 3px solid #4a4a4a;
    object-fit: cover;
}
.profile-content h2 {
    margin-top: 0;
}
.profile-content ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 0 0 16px 0;
}
.profile-content li {
    margin-bottom: 8px;
}
.profile-close-btn {
    grid-column: 1 / -1; /* ทำให้ปุ่มขยายเต็มความกว้าง */
    text-align: center;
    margin-top: 16px;
}

/* Responsive สำหรับมือถือ */
@media (max-width: 768px) {
    .profile-panel {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .profile-img {
        margin: 0 auto 16px;
    }
}