/* css/style.css */

/* =========================================
   1. CORE STYLES (พื้นฐาน)
   ========================================= */
body { 
    font-family: 'Sarabun', 'Prompt', sans-serif; 
    background: #f0f2f5; 
    margin: 0; 
    padding: 20px; 
    color: #333;
}

.container { 
    max-width: 800px; 
    margin: 0 auto; 
    background: white; 
    padding: 40px; 
    border-radius: 20px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); 
    box-sizing: border-box;
}

h1 { text-align: center; color: #46178f; margin-bottom: 5px; }
.subtitle { text-align: center; color: #666; margin-top: 0; margin-bottom: 20px; }

.separator { margin: 25px 0; border: 0; border-top: 1px solid #eee; }
.preview-link { color: #2196F3; text-decoration: none; font-weight: bold; transition: 0.2s; }
.preview-link:hover { text-decoration: underline; color: #1565c0; }

/* =========================================
   2. PLAYER REGISTRATION (ส่วนผู้เล่น - เพิ่มใหม่)
   ========================================= */
.player-section {
    background: #fff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    border-left: 6px solid #2196F3; /* แถบสีฟ้า */
    border: 1px solid #eee;
    border-left-width: 6px;
}

.player-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.player-input-group input {
    margin-bottom: 0; /* ล้างค่าเดิม */
}

/* ป้ายชื่อผู้เล่น (Tag) */
.player-tag {
    background: #e3f2fd;
    color: #1565c0;
    padding: 8px 15px;
    border-radius: 50px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 5px;
    margin-bottom: 8px;
    border: 1px solid #bbdefb;
    animation: fadeIn 0.3s;
}

.player-tag .remove {
    cursor: pointer;
    color: #ef5350;
    font-size: 12px;
    background: rgba(255,255,255,0.7);
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.player-tag .remove:hover { background: #ffcdd2; }

/* =========================================
   3. QUESTION FORM STYLES (การ์ดโจทย์)
   ========================================= */
.question-card {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 12px;
    position: relative;
    transition: 0.2s;
}

.question-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    background: #fff;
    border-color: #ddd;
}

label {
    font-weight: bold;
    font-size: 14px;
    color: #555;
    display: block;
    margin-bottom: 8px;
    margin-top: 15px;
}
label:first-child { margin-top: 0; }

input[type="text"], select {
    width: 100%;
    padding: 12px;
    margin-bottom: 5px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    transition: 0.2s;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #46178f;
    background: #fdfbff;
}

/* =========================================
   4. BUTTONS (ปุ่มต่างๆ)
   ========================================= */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: transform 0.1s, box-shadow 0.2s;
    display: block;
    width: 100%;
    text-align: center;
}

.btn:active { transform: translateY(2px); }

.btn-secondary { 
    background: #fff; 
    color: #46178f; 
    border: 2px solid #46178f;
    margin-bottom: 10px; 
}
.btn-secondary:hover { background: #f3e5f5; }

.btn-primary { 
    background: #4CAF50; color: white; 
    font-size: 20px; padding: 15px; 
    box-shadow: 0 4px 0 #388E3C;
    margin-top: 20px;
}
.btn-primary:hover { 
    background: #43A047; 
}

.btn-delete {
    background: #ffcdd2;
    color: #c62828;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    float: right;
}
.btn-delete:hover { background: #ef9a9a; }

/* =========================================
   5. FLOATING ANSWERS (สำหรับโหมดใหม่)
   ========================================= */
.answer-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.answer-row input[type="checkbox"] {
    width: 20px; height: 20px; cursor: pointer;
}

.answer-row input[type="text"] {
    margin-bottom: 0;
    border: none;
    background: transparent;
    font-weight: normal;
}
.answer-row input[type="text"]:focus { border-bottom: 2px solid #2196F3; border-radius: 0; }

.btn-add-ans {
    background: #e1f5fe;
    color: #0277bd;
    border: 1px dashed #0277bd;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    width: 100%;
}
.btn-add-ans:hover { background: #b3e5fc; }

.btn-remove-ans {
    background: transparent; color: #999;
    border: none; width: 30px; height: 30px;
    cursor: pointer; font-size: 18px;
}
.btn-remove-ans:hover { color: red; }

/* =========================================
   6. MODAL STYLES (หน้าต่างแจ้งเตือน)
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
    opacity: 0; visibility: hidden;
    transition: all 0.3s ease;
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal-box {
    background: white;
    width: 90%; max-width: 400px;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.show .modal-box { transform: scale(1); }

.modal-icon {
    font-size: 60px; margin-bottom: 20px; display: block;
    animation: bounce 1s infinite alternate;
}

.modal-title { font-size: 24px; color: #333; margin: 10px 0; font-weight: bold; }
.modal-desc { color: #666; margin-bottom: 30px; font-size: 16px; line-height: 1.5; }

.modal-btn {
    background: #4CAF50; color: white; border: none;
    padding: 12px 30px; font-size: 18px; border-radius: 50px;
    cursor: pointer; width: 100%; transition: transform 0.2s;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
    font-weight: bold;
}
.modal-btn:hover { transform: scale(1.05); }

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}