* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

/* 배경을 투명하게 하고 외부 여백 제거 (임베드 최적화) */
body { padding: 0; background-color: transparent; color: #333; }

/* 그림자, 둥근 테두리, 배경색 제거 및 폭 100% 확장 */
.calendar-container { 
    width: 100%; 
    max-width: none; 
    margin: 0; 
    background: transparent; 
    border-radius: 0; 
    padding: 0; 
    box-shadow: none; 
    display: flex; 
    flex-direction: column; 
}

.admin-control-panel { order: 1; display: none; width: 100%; gap: 8px; margin-bottom: 20px; }
.admin-control-panel > * { flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px 5px; font-size: 0.9rem; font-weight: bold; border-radius: 6px; text-align: center; white-space: nowrap; border: none; cursor: pointer; transition: filter 0.2s; box-sizing: border-box; }
.admin-control-panel > *:hover { filter: brightness(0.9); }

.admin-badge-cell { background: #dc2626; color: white; cursor: default !important; box-shadow: 0 2px 4px rgba(220,38,38,0.3); }
.account-btn { background: #f59e0b; color: white; }
.admin-btn { background: #16a34a; color: white; margin: 0; }
.auth-btn { background: #475569; color: white; }

.calendar-header { order: 2; display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; }

/* 3번 탭(클릭)을 원활하게 하기 위한 CSS 추가 */
.calendar-header h2 { 
    font-size: 1.6rem; color: #1a202c; margin: 0 10px; text-align: center; width: 100%; white-space: nowrap; 
    -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; 
    cursor: pointer;
    touch-action: manipulation; 
}

.nav-btn { background: #0073aa; color: white; border: none; padding: 8px 14px; border-radius: 5px; cursor: pointer; font-weight: bold; font-size: 0.85rem; }
.nav-btn:hover { background: #005177; }

.calendar-scroll-wrapper { order: 3; width: 100%; border-radius: 6px; }
.calendar-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 1px; 
    background: #e2e8f0; 
    border: 1px solid #e2e8f0; 
    width: 100%;
}

.bottom-nav-controls { order: 4; display: none; width: 100%; gap: 8px; margin-top: 15px; }
.bottom-nav-controls > * { flex: 1; padding: 12px 5px; font-size: 0.95rem; font-weight: bold; text-align: center; border-radius: 6px; border: none; cursor: pointer; }

.day-header { background: #f1f5f9; padding: 10px; text-align: center; font-weight: bold; font-size: 0.95rem; color: #475569; }
.day-header.sun { color: #dc2626; }
.day-header.sat { color: #2563eb; }

/* 셀 내부 배경색은 흰색으로 유지하여 가독성 확보 */
.day-cell { background: #fff; min-height: 12vh; padding: 6px; position: relative; display: flex; flex-direction: column; cursor: pointer; transition: background 0.2s; overflow: hidden; }
.day-cell:hover { background: #f8fafc; }

.empty-cell { background: #fcfcfc; cursor: default; }
.empty-cell.admin-mode:hover { background: #f1f5f9; cursor: pointer; }
.memo-content { white-space: pre-wrap; font-size: 0.85rem; color: #475569; padding: 6px; line-height: 1.4; word-break: break-all; }
.memo-placeholder { color: #94a3b8; font-size: 0.8rem; border: 1px dashed #cbd5e1; padding: 6px; border-radius: 4px; text-align: center; }

.day-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid #e2e8f0; gap: 4px; }
.day-number { font-weight: 600; font-size: 0.85rem; color: #64748b; flex-shrink: 0; }
.day-number.red-text { color: #dc2626 !important; }
.day-number.blue-text { color: #2563eb !important; }

.holiday-name { font-size: 0.75rem; font-weight: bold; text-align: right; word-break: keep-all; line-height: 1.2; overflow-wrap: break-word; }
.holiday-name.red-text { color: #dc2626; }
.holiday-name.blue-text { color: #2563eb; }

.schedule-container { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.schedule-item { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; font-size: 0.8rem; text-decoration: none; font-weight: 500; color:#333; overflow: hidden; }
.schedule-item:hover { filter: brightness(0.92); }
.schedule-item.admin-mode:hover { outline: 2px dashed #f87171; outline-offset: -2px; } 

.schedule-thumb { width: 28px; height: 28px; border-radius: 3px; object-fit: cover; flex-shrink: 0; background: #ccc; }
.schedule-info { display: flex; flex-direction: column; width: 100%; overflow: hidden; }
.schedule-time { font-size: 0.7rem; font-weight: 600; line-height: 1.2; margin-bottom: 2px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; line-height: 1.25; word-break: break-word; }
.schedule-info.has-time .schedule-title { -webkit-line-clamp: 1; }

.bg-rainbow-0 { background-color: #ffe4e6; color: #be123c; } 
.bg-rainbow-1 { background-color: #ffedd5; color: #c2410c; } 
.bg-rainbow-2 { background-color: #fef9c3; color: #a16207; } 
.bg-rainbow-3 { background-color: #dcfce7; color: #15803d; } 
.bg-rainbow-4 { background-color: #dbeafe; color: #1d4ed8; } 
.bg-rainbow-5 { background-color: #e0e7ff; color: #4338ca; } 
.bg-rainbow-6 { background-color: #f3e8ff; color: #7e22ce; } 

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; padding: 10px; }
.modal-content { background: #fff; padding: 24px; border-radius: 8px; width: 100%; max-width: 500px; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 12px; right: 16px; font-size: 1.5rem; cursor: pointer; border: none; background: none; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 0.9rem; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 16px; }
.form-group select option[disabled] { color: #aaa; background-color: #f1f1f1; }

.flex-group { display: flex; gap: 10px; margin-bottom: 15px; }
.flex-group .form-group { margin-bottom: 0; flex: 1; }

.time-picker { display: flex; gap: 4px; }
.time-picker select { padding: 8px 4px; font-size: 16px; flex: 1; }

.help-text { font-size: 0.75rem; color: #64748b; margin-top: 4px; display: block; }

.btn-group { display: flex; gap: 10px; margin-top: 20px; }
.submit-btn { flex: 2; background: #0073aa; color: white; border: none; padding: 12px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.delete-btn { flex: 1; background: #dc2626; color: white; border: none; padding: 12px; border-radius: 4px; font-weight: bold; cursor: pointer; display: none; font-size: 0.85rem;}
.delete-single-btn { flex: 1; background: #f59e0b; color: white; border: none; padding: 12px; border-radius: 4px; font-weight: bold; cursor: pointer; display: none; font-size: 0.85rem;}

.brochure-img { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto; border-radius: 4px; }

.popup-header { border-bottom: 1px solid #e2e8f0; padding-bottom: 15px; margin-bottom: 15px; }
.popup-title { font-size: 1.3rem; color: #0f172a; margin-bottom: 8px; font-weight: bold; }
.popup-meta-row { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 6px; font-size: 0.9rem; color: #475569; }
.popup-meta-item { display: inline-flex; align-items: center; gap: 6px; }

.tab-container { display: flex; margin-bottom: 15px; border-bottom: 2px solid #e2e8f0; }
.tab-btn { flex: 1; padding: 10px; border: none; background: none; font-size: 1rem; font-weight: bold; cursor: pointer; color: #64748b; }
.tab-btn.active { color: #0073aa; border-bottom: 2px solid #0073aa; margin-bottom: -2px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

#loadingSpinner { text-align: center; padding: 40px; color: #64748b; font-weight: bold; font-size: 1.1rem; }

.calendar-container.bottom-layout .calendar-header { order: 1; justify-content: center; border-bottom: none; padding-bottom: 5px; margin-bottom: 15px; }
.calendar-container.bottom-layout .top-nav-btn { display: none; }
.calendar-container.bottom-layout .calendar-scroll-wrapper { order: 2; }
.calendar-container.bottom-layout .bottom-nav-controls { display: flex; }

/* 모바일 폰트 및 여백 자동 축소 설정 (임베드 시 여백 추가 방지) */
@media (max-width: 900px) {
  .calendar-container { width: 100%; padding: 0; border-radius: 0; }
  .day-header { padding: 8px 4px; font-size: 0.85rem; }
  .day-cell { min-height: 80px; padding: 4px; }
  .schedule-item { flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px; }
  .schedule-thumb { width: 100%; height: 24px; border-radius: 2px; }
}

@media (max-width: 600px) {
  body { padding: 0; }
  .calendar-container { padding: 0; }
  
  .admin-control-panel { flex-wrap: wrap; gap: 4px; margin-bottom: 15px; }
  .admin-control-panel > * { font-size: 0.75rem; padding: 8px 2px; }
  .bottom-nav-controls { gap: 4px; }
  .bottom-nav-controls > * { font-size: 0.85rem; padding: 12px 2px; }
  .calendar-header h2 { font-size: 1.2rem; margin-bottom: 5px; }
  
  .day-header { font-size: 0.7rem; padding: 6px 0; }
  .day-cell { min-height: 70px; padding: 2px; }
  .day-number { font-size: 0.75rem; }
  
  .day-top { flex-direction: column; align-items: flex-start; gap: 1px; }
  .holiday-name { font-size: 0.6rem; text-align: left; width: 100%; margin-top: 2px; }
  
  .schedule-item { padding: 3px 2px; }
  .schedule-thumb { display: none; } 
  .schedule-title { font-size: 0.65rem; line-height: 1.1; }
  .schedule-time { font-size: 0.6rem; }
  .memo-content { font-size: 0.65rem; padding: 2px; }
  
  .flex-group { flex-direction: column; gap: 0; }
  .flex-group .form-group { margin-bottom: 15px; }
  .modal-content { padding: 20px 15px; }
  .popup-meta-row { flex-direction: column; gap: 8px; }
  .time-picker { gap: 2px; }
  .time-picker select { padding: 8px 2px; font-size: 14px; }
}