/* [เพิ่ม] Import ฟอนต์ Kanit */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;700&display=swap');

/* === โค้ดที่เพิ่มเข้ามาสำหรับเมนูนำทาง === */
.main-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #4a382a;
}
.nav-link {
    color: #DAA520;
    text-decoration: none;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}
.nav-link:hover {
    color: #FFD700;
    background-color: rgba(218, 165, 32, 0.15);
    border-color: #DAA520;
}
.nav-link i {
    font-size: 1.5em;
    line-height: 1;
}
@media (max-width: 600px) {
    .nav-link span { display: none; }
    .main-nav { justify-content: center; }
}
/* === จบส่วนเมนูนำทาง === */

body {
    background-image: url('https://img5.pic.in.th/file/secure-sv1/bgs21.md.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #f0e6d2;
    font-family: 'Kanit', sans-serif;
    margin: 0;
    padding: 20px;
    font-weight: 300;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: rgba(10, 5, 2, 0.8);
    border: 2px solid #DAA520;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(218, 165, 32, 0.5);
    position: relative; /* [เพิ่ม] สำหรับเอฟเฟกต์ */
    z-index: 1;
}

h1, h2 {
    color: #FFD700;
    text-align: center;
    border-bottom: 1px solid #DAA520;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-weight: 700;
}

.status-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.status-legend span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-block;
}

.dot-green {
    background-color: #2E8B57; /* SeaGreen */
    box-shadow: 0 0 8px #2E8B57, 0 0 12px #3CB371;
}

.dot-red {
    background-color: #B22222; /* Firebrick */
    box-shadow: 0 0 8px #B22222, 0 0 12px #DC143C;
}

.npc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}

.npc-card {
    background-color: #2a1a0c;
    border: 1px solid #4a382a;
    border-radius: 8px;
    text-align: center;
    padding: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.npc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(218, 165, 32, 0.4);
}

.npc-image-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 15px auto;
}

.npc-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #DAA520;
}

.npc-status-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #f0e6d2;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

.npc-card h3 {
    margin: 0 0 15px 0;
    color: #f0e6d2;
    font-size: 1.2em;
    font-weight: 400;
}

.npc-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    display: inline-block;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid #DAA520;
    background-color: transparent;
    color: #DAA520;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    font-weight: 400;
}

.btn:hover {
    background-color: #DAA520;
    color: #1a120b;
}

.btn-profile {
    border-color: #6c757d;
    color: #adb5bd;
}

.btn-profile:hover {
    background-color: #6c757d;
    color: #fff;
}


/* Form Styles for manage_npc.php */
.form-container {
    background-color: #2a1a0c;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #4a382a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #FFD700;
    font-size: 1.1em;
    font-weight: 400;
}

.form-control {
    width: 100%;
    padding: 10px;
    background-color: #1a120b;
    border: 1px solid #DAA520;
    color: #f0e6d2;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: 'Kanit', sans-serif;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.time-group {
    display: flex;
    gap: 15px;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    font-size: 1.2em;
    font-weight: bold;
    background-color: #DAA520;
    color: #1a120b;
    border: none;
}
.btn-submit:hover {
    background-color: #FFD700;
}

.message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    font-size: 1.1em;
}
.message-success {
    background-color: #2E8B57;
    color: #fff;
}
.message-error {
    background-color: #B22222;
    color: #fff;
}

/* === [เพิ่ม] สไตล์สำหรับ Modal Popup === */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    -webkit-animation-name: fadeIn;
    animation-name: fadeIn;
    -webkit-animation-duration: 0.4s;
    animation-duration: 0.4s
}

.modal-content {
    position: relative;
    margin: 10% auto;
    padding: 30px;
    width: 80%;
    max-width: 600px;
    background-color: #2a1a0c;
    border: 2px solid #DAA520;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(218, 165, 32, 0.6);
    color: #f0e6d2;
    -webkit-animation-name: slideIn;
    animation-name: slideIn;
    -webkit-animation-duration: 0.4s;
    animation-duration: 0.4s
}

.modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    transition: 0.3s;
}

.modal-close:hover,
.modal-close:focus {
    color: #FFD700;
    text-decoration: none;
    cursor: pointer;
}

.modal-header h2 {
    margin-top: 0;
    color: #FFD700;
    border-bottom-color: #4a382a;
}

.modal-body {
    padding-top: 15px;
    line-height: 1.8;
}

.modal-body p {
    margin: 10px 0;
    font-size: 1.1em;
}

.modal-body strong {
    color: #DAA520;
    min-width: 80px;
    display: inline-block;
}

.modal-footer {
    margin-top: 25px;
    text-align: right;
}

@-webkit-keyframes fadeIn { from {opacity: 0} to {opacity: 1} }
@keyframes fadeIn { from {opacity: 0} to {opacity: 1} }
@-webkit-keyframes slideIn { from {top: -300px; opacity: 0} to {top: 0; opacity: 1} }
@keyframes slideIn { from {margin-top: 0; opacity: 0} to {margin: 10% auto; opacity: 1} }

/* === [เพิ่ม] สไตล์สำหรับหน้า Admin Dashboard === */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}
.admin-header h1 {
    margin: 0;
    border-bottom: none;
}
.btn.btn-add-npc {
    background-color: #2E8B57;
    border-color: #2E8B57;
    color: #fff;
    font-size: 1.1em;
}
.btn.btn-add-npc:hover {
    background-color: #3CB371;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.admin-table th, .admin-table td {
    padding: 12px 15px;
    border: 1px solid #4a382a;
    text-align: left;
    vertical-align: middle;
}
.admin-table th {
    background-color: #2a1a0c;
    color: #FFD700;
    font-weight: 700;
}
.table-npc-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #DAA520;
}
.status-tag {
    padding: 4px 8px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.9em;
    font-weight: bold;
}
.status-green { background-color: #2E8B57; }
.status-red { background-color: #B22222; }

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.action-buttons .btn {
    padding: 5px 10px;
}
.btn-edit { background-color: #DAA520; color: #1a120b; border-color: #DAA520;}
.btn-edit:hover { background-color: #FFD700; }

.btn-delete { background-color: transparent; color: #B22222; border-color: #B22222; }
.btn-delete:hover { background-color: #B22222; color: #fff; }

/* === [เพิ่ม] สไตล์สำหรับปุ่ม Toggle และ Checkbox === */
.inactive-schedule {
    opacity: 0.5;
    background-color: #20150b;
}
.inactive-schedule td {
    text-decoration: line-through;
    color: #a89a88;
}
.inactive-schedule a, .inactive-schedule .btn {
    text-decoration: none !important;
}

.btn-toggle-on, .btn-toggle-off {
    padding: 5px 10px;
    font-size: 0.9em;
    min-width: 80px;
    text-align: center;
}
.btn-toggle-on {
    background-color: transparent;
    color: #2E8B57;
    border-color: #2E8B57;
}
.btn-toggle-on:hover {
    background-color: #2E8B57;
    color: #fff;
}

.btn-toggle-off {
    background-color: transparent;
    color: #B22222;
    border-color: #B22222;
}
.btn-toggle-off:hover {
    background-color: #B22222;
    color: #fff;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}
.form-group-checkbox label {
    margin-bottom: 0;
    font-weight: normal;
    color: #f0e6d2;
    cursor: pointer;
}
.form-group-checkbox input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
}
.btn.btn-secondary {
    border-color: #6c757d;
    color: #adb5bd;
}
.btn.btn-secondary:hover {
    background-color: #6c757d;
    color: #fff;
}

