/* 면학실 출석 관리 - 스타일 */
body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
}

header {
  background: #2c3e50;
  color: white;
  padding: 1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .menu {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
}

.container {
  padding: 1em;
}

html, body {
  overscroll-behavior-y: contain;
  overscroll-behavior: none;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.container, #homeScreen, #classroomView, #statsView, #guideView, #tutorialView {
  min-height: calc(100vh - 60px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body {
  touch-action: pan-y pan-x;
}

.floor-plan-container {
  position: relative;
  margin: 0 auto 20px auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 20px;
  width: 90%;
  max-width: 800px;
  aspect-ratio: 16 / 10;
}

.floor-plan {
  width: 100%;
  height: 100%;
  position: relative;
}

.classroom-area {
  position: absolute;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  font-weight: bold;
  color: #333;
  border: 2px solid #333;
  border-radius: 8px;
}

.classroom-area:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.classroom-4a {
  background: #FFB6C1;
  left: 2%;
  top: 40%;
  width: 35%;
  height: 56%;
}

.classroom-4b {
  background: #C0C0C0;
  left: 2%;
  top: 3%;
  width: 47%;
  height: 35%;
}

.classroom-4c {
  background: #87CEEB;
  left: 51%;
  top: 3%;
  width: 47%;
  height: 35%;
}

.classroom-4d {
  background: #FFDAB9;
  left: 68%;
  top: 40%;
  width: 30%;
  height: 56%;
}

.corridor {
  position: absolute;
  background: white;
}

.corridor-central {
  left: 37%;
  top: 40%;
  width: 31%;
  height: 56%;
}

.corridor-top {
  left: 51%;
  top: 38%;
  width: 47%;
  height: 4%;
}

.main-entrance {
  position: absolute;
  background: #FFD700;
  border: 2px solid #333;
  left: 38%;
  bottom: 3%;
  width: 29%;
  height: 5%;
}

.other-classrooms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 0 auto;
  width: 90%;
  max-width: 800px;
}

.other-classroom-btn {
  padding: 30px;
  font-size: 1.5em;
  background: #e0e0e0;
  border: 2px solid #999;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.other-classroom-btn:hover {
  background: #d0d0d0;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button {
  padding: 8px;
  margin: 4px;
  border: none;
  border-radius: 6px;
  font-size: 0.9em;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#seatGrid {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seat-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  margin-bottom: 10px;
}

.spacer {
  width: 40px;
}

#headerAttendanceButtons {
  margin-left: 1em;
  padding-left: 1em;
  border-left: 2px solid rgba(255,255,255,0.3);
}

#headerAttendanceButtons button {
  font-weight: bold;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

#headerAttendanceButtons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

@media (max-width: 1200px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  #headerAttendanceButtons {
    margin-left: 0;
    margin-top: 0.5em;
    padding-left: 0;
    border-left: none;
    width: 100%;
  }

  #headerAttendanceButtons button {
    width: calc(25% - 6px);
    font-size: 0.85em;
    padding: 6px 8px;
  }
}

.seat {
  min-width: 85px;
  height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 0.75em;
  line-height: 1.2;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  padding: 3px 5px;
}

.seat .seatNumber {
  font-weight: bold;
  font-size: 0.85em;
  color: #333;
}

.seat span {
  margin: 0;
  padding: 0;
}

.seat.empty-seat {
  visibility: hidden !important;
}

.seat[data-status="unchecked"] {
  background-color: #fff3cd !important;
}

.seat[data-status="present"] {
  background-color: #a5d8ff !important;
}

.seat[data-status="absent"] {
  background-color: #ccc !important;
}

/* Development room student - light pink background like GAS */
.seat.dev-room-student {
  background-color: #ffcccc !important;
  cursor: not-allowed;
  opacity: 0.85;
  border: 2px dashed #e57373 !important;
}

.seat.dev-room-student:hover {
  background-color: #ffb3b3 !important;
}

.seat.dev-room-student .seatNumber {
  color: #c62828;
}

.seat.dev-room-student .studentName {
  color: #b71c1c;
  font-weight: 500;
}

.seat.dev-room-student .seatStatus {
  color: #c62828;
  font-weight: bold;
  font-size: 0.85em;
}

.seat[data-status="dev_room"] {
  background-color: #ffcccc !important;
  border: 2px dashed #e57373 !important;
}

/* Pending violation student - orange indicator */
.seat.pending-violation {
  border: 2px solid #ff9800 !important;
}

.seat.pending-violation .seatStatus {
  color: #e65100;
  font-weight: bold;
}

#sleepPostItBtn.using {
  background: #ff6b6b !important;
  color: white !important;
}

#sleepPostItBtn.available {
  background: #ffeb3b !important;
  color: #333 !important;
}

.modal {
  display: none;
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.1s ease-out;
}

.modal-content {
  background: white;
  margin: 0;
  padding: 20px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 10px;
}

.modal-content h3, .modal-content h4 {
  color: #2c3e50;
}

.time-btn {
  padding: 6px 12px;
  margin-right: 4px;
  background: #eee;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
}

.time-btn.active {
  background: #2c3e50;
  color: white;
}

.classroom-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 1em auto;
  max-width: 900px;
  padding: 0 1em;
}

.classroom-grid button {
  width: 100%;
  height: 150px;
  font-size: 1.8em;
  border-radius: 16px;
  background: #f0f0f0;
  border: 2px solid #ccc;
  transition: background 0.2s;
}

.classroom-grid button:hover {
  background: #d0ebff;
}

#feedbackModal .modal-content {
  max-width: 500px;
}

#feedbackModal input,
#feedbackModal textarea {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
}

#feedbackModal input:focus,
#feedbackModal textarea:focus {
  outline: none;
  border-color: #2c3e50;
}

#infoModal .modal-content {
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  margin: 5vh auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

#infoModal .modal-content {
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
}

#infoModal .modal-content::-webkit-scrollbar {
  width: 12px;
}

#infoModal .modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 6px;
}

#infoModal .modal-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 6px;
  border: 2px solid #f1f1f1;
}

#infoModal .modal-buttons {
  position: sticky;
  bottom: 0;
  background: white;
  padding: 15px 0;
  border-top: 2px solid #ddd;
  margin-top: 15px;
  z-index: 10;
  box-shadow: 0 -3px 8px rgba(0,0,0,0.15);
  touch-action: manipulation;
}

#infoModal .modal-buttons button {
  margin: 0 5px;
  padding: 12px 24px;
  min-height: 44px;
  touch-action: manipulation;
  font-size: 16px;
  background: #2c3e50;
  color: white;
  border: none;
  border-radius: 6px;
}

#infoModal .modal-buttons button:last-child {
  background: #666;
}

@media (max-height: 700px) {
  .modal-content {
    max-height: 95vh;
  }
}

#feedbackModal button {
  min-width: 80px;
  padding: 10px 20px;
  margin-right: 10px;
}

@media (max-width: 600px) {
  .seat-row {
    flex-wrap: wrap;
  }

  .classroom-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .classroom-grid button {
    height: 120px;
    font-size: 1.5em;
  }

  #seatGrid {
    padding: 0 10px;
  }
}

/* Sleep Post-it: Red border */
.sleep-postit {
  border: 4px solid #d32f2f !important;
  box-shadow: 0 0 10px rgba(211, 47, 47, 0.5) !important;
}

/* Pre-absence (after school, etc.): Yellow border */
.pre-absence {
  border: 4px solid #ffc107 !important;
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.5) !important;
}

/* Commuter departure (통학생 귀가): Gray background - high specificity to override status colors */
.seat.commuter-departure,
.seat.commuter-departure[data-status="unchecked"],
.seat.commuter-departure[data-status="present"],
.seat.commuter-departure[data-status="absent"] {
  background-color: #9e9e9e !important;
  opacity: 0.85;
}

.seat.commuter-departure .seatStatus {
  color: #333;
  font-weight: bold;
}

/* Both sleep post-it and pre-absence: Orange border */
.sleep-and-absence {
  border: 4px solid #ff5722 !important;
  box-shadow: 0 0 12px rgba(255, 87, 34, 0.6) !important;
}

#sleepPostItBtn:disabled {
  background: #ccc !important;
  cursor: not-allowed !important;
}

/* Loading overlay */
#loadingOverlay {
  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;
}

#loadingOverlay .loading-content {
  background: white;
  padding: 20px 40px;
  border-radius: 10px;
  font-size: 1.2em;
}

/* Toast notification */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 8px;
  color: white;
  font-weight: bold;
  z-index: 10000;
  animation: slideDown 0.3s ease-out;
}

.toast.success {
  background: #4CAF50;
}

.toast.error {
  background: #f44336;
}

.toast.warning {
  background: #ff9800;
}

@keyframes slideDown {
  from {
    top: -50px;
    opacity: 0;
  }
  to {
    top: 20px;
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    top: 20px;
    opacity: 1;
  }
  to {
    top: -50px;
    opacity: 0;
  }
}

/* Quick classroom buttons */
.quick-classroom-buttons button {
  padding: 4px 8px;
  font-size: 0.8em;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}

.quick-classroom-buttons button:hover {
  background: rgba(255,255,255,0.3);
}

/* Admin page styles */
.admin-tab {
  padding: 12px 20px;
  font-size: 1em;
  background: #e0e0e0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab:hover {
  background: #d0d0d0;
}

.admin-tab.active {
  background: #014099;
  color: white;
}

.admin-tab-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(33, 150, 243, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); }
}

/* Layout editor grid */
.layout-grid {
  display: inline-block;
  border: 2px solid #ccc;
  background: #f9f9f9;
  padding: 10px;
  border-radius: 8px;
}

.layout-row {
  display: flex;
}

.layout-cell {
  width: 40px;
  height: 40px;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8em;
  transition: all 0.2s;
}

.layout-cell:hover {
  border-color: #014099;
}

.layout-cell.seat {
  background: #a5d8ff;
}

.layout-cell.spacer {
  background: #f0f0f0;
  color: #999;
}

.layout-cell.empty {
  background: white;
  color: #ccc;
}

.layout-cell.break-row {
  background: #ffeb3b;
  width: 100%;
}

/* Development Room Tab Styles */
.dev-room-tab {
  padding: 10px 20px;
  background: #e0e0e0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  transition: all 0.2s;
}

.dev-room-tab:hover {
  background: #d0d0d0;
}

.dev-room-tab.active {
  background: #014099;
  color: white;
}

/* Development Room 5x6 Grid */
.dev-room-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  max-width: 100%;
  margin: 0 auto;
}

.dev-room-seat {
  height: 90px;
  border: 2px solid #ddd;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 3px 2px;
  text-align: center;
  font-size: 0.75em;
  overflow: hidden;
  box-sizing: border-box;
}

.dev-room-seat:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dev-room-seat.empty {
  background: #f5f5f5;
  border-style: dashed;
  color: #999;
}

.dev-room-seat.empty .empty-text {
  font-size: 0.75em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Pending (소명중): Light blue tint to distinguish from empty */
.dev-room-seat.pending {
  background: #e3f2fd;
  border-color: #1976d2;
  border-width: 2px;
}

/* Confirmed (확정): Yellow fill */
.dev-room-seat.confirmed {
  background: #ffeb3b;
  border-color: #fbc02d;
}

/* Permanent (영구 확정): Yellow fill with RED BORDER */
.dev-room-seat.permanent {
  background: #ffeb3b;
  border: 2px solid #f44336;
}

.dev-room-seat .seat-num {
  font-weight: bold;
  font-size: 1.1em;
  color: #333;
  margin-bottom: 3px;
}

.dev-room-seat .student-name {
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dev-room-seat .student-id {
  font-size: 0.8em;
  color: #666;
}

.dev-room-seat .status-label {
  font-size: 0.75em;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(0,0,0,0.1);
}

/* Status label variations for dev room seats */
.dev-room-seat.pending .status-label {
  background: #e0e0e0;
  color: #666;
}

.dev-room-seat.confirmed .status-label {
  background: rgba(0,0,0,0.15);
  color: #333;
}

.dev-room-seat.permanent .status-label {
  background: #f44336;
  color: #fff;
  font-weight: bold;
}

/* Dev Room Student Info Modal */
#devRoomStudentModal .modal-content {
  max-width: 400px;
}

#devRoomStudentModal .info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

#devRoomStudentModal .info-row:last-child {
  border-bottom: none;
}

#devRoomStudentModal .info-label {
  color: #666;
  font-weight: 500;
}

#devRoomStudentModal .info-value {
  font-weight: 600;
  color: #333;
}

@media (max-width: 500px) {
  .dev-room-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }

  .dev-room-seat {
    min-height: 60px;
    font-size: 0.75em;
  }

  .dev-room-seat .seat-num {
    font-size: 1em;
  }
}
