@import url('https://fonts.googleapis.com/css2?family=Itim&display=swap');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Itim', cursive;
    background-color: #fdf6e3;
    margin: 0; padding: 0;
    background-image: radial-gradient(#d4c4a8 1.5px, transparent 1.5px);
    background-size: 20px 20px;
    color: #333;
}

.container { max-width: 1100px; width: 90%; margin: 0 auto; padding-bottom: 60px; }
h1 { text-align: center; color: #ff6f61; font-size: clamp(1.8rem, 5vw, 2.5rem); margin: 30px 0; }
h2 { text-align: center; color: #555; font-size: 1.5rem; margin-bottom: 20px; }

/* --- Cover Image Styles (แก้ไขใหม่) --- */
.cover-container {
    position: relative;
    width: 100%;
    cursor: pointer;
}
.class-cover {
    width: 100%;
    height: auto;
    max-height: 450px;
    object-fit: cover;
    object-position: center;
    border-bottom: 5px solid #fff;
    transition: filter 0.3s;
    display: block;
}
.class-cover:hover { filter: brightness(90%); } /* ทำให้มืดลงนิดนึงเมื่อเอาเมาส์ชี้ */

.cover-text {
    position: absolute;
    bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    pointer-events: none;
}

/* --- Modal (Lightbox) Styles --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    padding-top: 50px; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.9); /* พื้นหลังสีดำโปร่งแสง */
}
.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 1200px;
    max-height: 90vh; /* สูงไม่เกิน 90% ของหน้าจอ */
    object-fit: contain;
    border: 2px solid white;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: zoom 0.3s;
}
@keyframes zoom {
    from {transform:scale(0)} to {transform:scale(1)}
}
.close {
    position: absolute;
    top: 20px; right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}
.close:hover { color: #bbb; }

/* Responsive Modal */
@media only screen and (max-width: 700px){
    .modal-content { width: 95%; }
    .close { top: 10px; right: 20px; font-size: 30px; }
}

/* --- Other Styles (Nav, Form, Grid) --- */
.room-nav { display: flex; justify-content: center; gap: 10px; margin: 25px 0; flex-wrap: wrap; }
.room-btn {
    text-decoration: none; background: #fff; color: #666; padding: 10px 25px;
    border-radius: 50px; border: 2px solid #ddd; font-weight: bold; transition: 0.3s;
}
.room-btn.active { background: #ff6f61; color: white; border-color: #ff6f61; }

.form-box { background: #fff; padding: 30px; border-radius: 20px; border: 3px dashed #ffb7b2; margin-bottom: 40px; }
.form-row { display: flex; gap: 15px; margin-bottom: 15px; }
.half-width { flex: 1; width: 100%; }
input, textarea { width: 100%; padding: 14px; border: 2px solid #eee; border-radius: 12px; font-family: 'Itim', cursive; font-size: 1rem; background: #fafafa; }
button { background: #ff6f61; color: white; border: none; padding: 15px; font-size: 1.2rem; border-radius: 50px; cursor: pointer; width: 100%; font-family: 'Itim', cursive; }

.entries-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; align-items: start; }
.card { background: white; padding: 25px 20px; border-radius: 15px; position: relative; border: 1px solid #f0f0f0; background-image: repeating-linear-gradient(#fff 0px, #fff 24px, #f1f8e9 25px); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.tape { background: rgba(255,255,255,0.6); border: 1px solid #ddd; width: 100px; height: 30px; position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-2deg); }
.card h3 { text-align: center; color: #00796b; margin: 10px 0 5px 0; }
.card small { display: block; text-align: center; color: #888; margin-bottom: 10px; }
.card p { background: rgba(255,255,255,0.8); padding: 5px; border-radius: 5px; color: #444; line-height: 1.6; word-wrap: break-word; }
.dob-info { text-align: center; color: #d81b60; font-weight: bold; font-size: 0.9rem; }
.quote-box { background: #fff9c4; padding: 8px; border-radius: 8px; text-align: center; font-style: italic; color: #555; margin: 10px 0; font-size: 0.9rem; }
.contact-info { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 15px; border-top: 1px dashed #eee; padding-top: 10px; }
.contact-item { font-size: 0.8rem; background: #e0f2f1; padding: 3px 8px; border-radius: 10px; color: #00695c; }
.timestamp { font-size: 0.7rem; color: #aaa; text-align: right; margin-top: 10px; }

@media screen and (max-width: 768px) {
    .form-row { flex-direction: column; gap: 0; }
    input, textarea, .half-width { margin-bottom: 15px; }
    .room-btn { flex: 1 1 40%; }
    .entries-grid { grid-template-columns: 1fr; }
}