@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #333;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---- Layout ---- */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}

.page-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: 200px;
  min-width: 200px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  padding: 16px;
  flex-shrink: 0;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Date nav bar（表の真上） ---- */

.date-nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.date-nav-bar span {
  font-size: 15px;
  font-weight: 600;
  min-width: 160px;
  text-align: center;
}

/* ---- Mini Calendar ---- */

.mini-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mini-cal-header span {
  font-size: 13px;
  font-weight: 600;
}

.cal-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 16px;
  color: #555;
  border-radius: 4px;
  line-height: 1;
}

.cal-nav-btn:hover {
  background: #f0f0f0;
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  padding: 4px 0;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 50%;
  cursor: pointer;
}

.cal-cell:hover {
  background: #f0f0f0;
}

.cal-cell.today {
  color: #2563eb;
  font-weight: 700;
}

.cal-cell.selected {
  background: #2563eb;
  color: #fff;
}

.cal-cell.selected:hover {
  background: #1d4ed8;
}

.cal-cell.empty {
  cursor: default;
}

.cal-cell.empty:hover {
  background: none;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

.btn-secondary { background: #e5e7eb; color: #333; }
.btn-secondary:hover { background: #d1d5db; }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 4px 12px; font-size: 13px; }

/* ---- Forms ---- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

input, select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: #fff;
}

input:focus, select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* ---- Modal ---- */

dialog {
  border: none;
  border-radius: 12px;
  padding: 28px;
  width: 440px;
  max-width: 94vw;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  margin: auto;
}

/* ---- 閲覧モーダル ---- */

.view-info-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.view-info-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.view-info-label {
  font-size: 12px;
  color: #888;
  min-width: 56px;
  flex-shrink: 0;
}

.view-info-value {
  font-size: 14px;
  font-weight: 500;
  color: #222;
}

.dept-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

dialog h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ---- Timeline ---- */

.timeline-wrap {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  overflow-x: auto;
}

.timeline-header,
.timeline-row {
  display: flex;
  align-items: stretch;
  min-width: max-content;
}

.timeline-header {
  border-bottom: 2px solid #e0e0e0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.timeline-header .room-col {
  z-index: 11;
}

.room-col {
  min-width: 120px;
  width: 120px;
  border-right: 1px solid #e0e0e0;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}

.time-labels {
  display: flex;
}

.time-label {
  min-width: 60px;
  width: 60px;
  font-size: 11px;
  color: #888;
  padding: 6px 0;
  border-right: 1px solid #f0f0f0;
  text-align: center;
  flex-shrink: 0;
}

.timeline-row {
  border-bottom: 1px solid #f0f0f0;
}

.timeline-row:last-child {
  border-bottom: none;
}

.timeline-cells {
  flex: 1;
  position: relative;
  height: 56px;
}

.time-slot {
  position: absolute;
  top: 0;
  bottom: 0;
  border-right: 1px solid #f0f0f0;
  cursor: pointer;
}

.time-slot:hover {
  background: rgba(37, 99, 235, 0.06);
}

.booking-bar {
  position: absolute;
  top: 6px;
  bottom: 6px;
  background: #2563eb;
  color: #fff;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  display: flex;
  align-items: center;
  z-index: 1;
}

.booking-bar:hover {
  background: #1d4ed8;
}

.drag-highlight {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: rgba(37, 99, 235, 0.15);
  border: 2px solid #2563eb;
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
}

/* ---- Date nav ---- */

.date-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-nav span {
  font-size: 15px;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

/* ---- Index page ---- */

.index-card {
  background: #fff;
  border-radius: 10px;
  padding: 40px;
  max-width: 480px;
  margin: 80px auto;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.index-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.index-card p {
  color: #666;
  margin-bottom: 28px;
  line-height: 1.6;
}

.created-url {
  margin-top: 20px;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.8;
  word-break: break-all;
}

.created-url a {
  color: #16a34a;
  font-weight: 600;
}

/* ---- Kanri page ---- */

.kanri-section {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  padding: 24px;
  margin-bottom: 24px;
}

.kanri-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.kanri-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.room-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.room-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.room-name { font-weight: 500; }
.room-capacity { font-size: 12px; color: #888; margin-top: 2px; }

.room-actions { display: flex; gap: 6px; }

.add-room-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.add-room-form .form-group {
  margin-bottom: 0;
}

/* ---- レスポンシブ ---- */

.cal-toggle-btn {
  display: none;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}

.sidebar-overlay.open {
  display: block;
}

@media (max-width: 1024px) {
  .cal-toggle-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -220px;
    bottom: 0;
    z-index: 100;
    transition: left 0.25s ease;
    box-shadow: none;
    padding-top: 62px;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.18);
  }

  .room-col {
    min-width: 80px;
    width: 80px;
    font-size: 12px;
  }

  .main-content {
    padding: 12px;
  }

  dialog {
    width: 92vw;
    padding: 20px 16px;
  }
}
