/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'メイリオ', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #f5f5f5;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

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

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #6b7280;
  color: #fff;
}

.btn-secondary:hover {
  background: #4b5563;
}

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

.btn-danger:hover {
  background: #b91c1c;
}

.btn-warning {
  background: #f59e0b;
  color: #fff;
}

.btn-warning:hover {
  background: #d97706;
}

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

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* Auth Pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 24px;
}

.auth-form .btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

.auth-links {
  margin-top: 16px;
  text-align: center;
}

.error-message {
  background: #fef2f2;
  color: #dc2626;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

/* Header */
.app-header {
  background: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

.user-name {
  font-weight: 500;
}

.logout-link {
  color: #6b7280;
  font-size: 13px;
}

.admin-nav {
  display: flex;
  gap: 16px;
}

.admin-nav a {
  color: #6b7280;
  font-size: 13px;
}

.admin-nav a.active,
.admin-nav a:hover {
  color: #2563eb;
}

/* Main Content */
.main-content {
  padding: 16px;
  padding-bottom: 80px;
}

.admin-main {
  max-width: 1200px;
  margin: 0 auto;
}

.page-title {
  font-size: 20px;
  margin-bottom: 16px;
}

/* Month Navigation */
.month-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.month-link {
  padding: 8px 16px;
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
  color: #6b7280;
}

.month-link.active {
  background: #2563eb;
  color: #fff;
}

.month-select {
  margin-bottom: 16px;
}

.month-select select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

/* Calendar */
.calendar {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.calendar-header .calendar-cell {
  text-align: center;
  padding: 8px;
  font-weight: 600;
  font-size: 12px;
  color: #6b7280;
}

.calendar-header .sat {
  color: #2563eb;
}

.calendar-header .sun {
  color: #dc2626;
}

.calendar-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-cell.day {
  min-height: 70px;
  padding: 4px;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background 0.2s;
}

.calendar-cell.day:hover {
  background: #f9fafb;
}

.calendar-cell.day:nth-child(7n) {
  border-right: none;
}

.calendar-cell.day.other-month {
  background: #f9fafb;
  color: #9ca3af;
}

.calendar-cell.day.closed {
  background: #f3f4f6;
  cursor: default;
}

.calendar-cell.day.has-entry {
  background: #eff6ff;
}

.calendar-cell.day.my-shift {
  background: #fef3c7;
}

.calendar-cell.day.warning {
  background: #fef2f2;
}

.calendar-cell.day .day-num {
  font-weight: 600;
  font-size: 13px;
}

.calendar-cell.day.sat .day-num {
  color: #2563eb;
}

.calendar-cell.day.sun .day-num {
  color: #dc2626;
}

.calendar-cell.day .entry-time {
  display: block;
  font-size: 10px;
  color: #2563eb;
  margin-top: 2px;
}

.calendar-cell.day .closed-mark {
  display: inline-block;
  background: #9ca3af;
  color: #fff;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
}

.calendar-cell.day .warning-mark {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
}

/* Schedule Preview */
.schedule-preview {
  margin-top: 4px;
}

.schedule-item {
  font-size: 10px;
  padding: 1px 2px;
  background: #e0e7ff;
  border-radius: 2px;
  margin-bottom: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-item.me {
  background: #fef3c7;
  font-weight: 600;
}

.schedule-more {
  font-size: 9px;
  color: #6b7280;
}

/* Bottom Tabs (Staff) */
.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  z-index: 100;
}

.bottom-tabs .tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
}

.bottom-tabs .tab.active {
  color: #2563eb;
  background: #eff6ff;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal.large .modal-content {
  max-width: 600px;
}

.modal-content h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.modal-content h4 {
  margin-bottom: 8px;
  font-size: 14px;
  color: #6b7280;
}

.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Detail List */
.detail-list {
  margin-bottom: 16px;
}

.detail-item {
  display: flex;
  gap: 12px;
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  align-items: center;
}

.detail-item.editable {
  cursor: pointer;
}

.detail-item.editable:hover {
  background: #f9fafb;
}

.detail-item .name {
  font-weight: 500;
  min-width: 80px;
}

.detail-item .time {
  color: #6b7280;
}

.detail-item .note {
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
}

.detail-item.me {
  background: #fef3c7;
}

.empty {
  color: #9ca3af;
  padding: 8px;
  text-align: center;
}

/* Day Detail Container */
.day-detail-container {
  display: grid;
  gap: 16px;
}

.detail-section {
  background: #f9fafb;
  padding: 12px;
  border-radius: 8px;
}

/* Admin Toolbar */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.publish-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.status.published {
  background: #dcfce7;
  color: #16a34a;
}

.status.unpublished {
  background: #fef3c7;
  color: #d97706;
}

/* Email Errors */
.email-errors {
  background: #fef2f2;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.email-errors p {
  font-weight: 500;
  color: #dc2626;
  margin-bottom: 8px;
}

.email-errors ul {
  margin-left: 20px;
  margin-bottom: 8px;
  font-size: 13px;
}

/* Staff Results */
.staff-results {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.staff-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #e5e7eb;
}

.staff-item:last-child {
  border-bottom: none;
}

.staff-item:hover {
  background: #f9fafb;
}

.staff-item.has-avail {
  background: #eff6ff;
}

.staff-item.no-avail {
  color: #9ca3af;
}

.staff-item .badge {
  font-size: 10px;
  background: #2563eb;
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
}

/* Staff Table */
.staff-table-container {
  overflow-x: auto;
}

.staff-table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
}

.staff-table th,
.staff-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.staff-table th {
  background: #f9fafb;
  font-weight: 600;
}

.staff-table tr.stopped {
  background: #f3f4f6;
  color: #9ca3af;
}

/* Closed Days */
.closed-sections {
  display: grid;
  gap: 24px;
}

.closed-section {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
}

.closed-section h3 {
  margin-bottom: 16px;
}

.weekday-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.weekday-btn {
  width: 44px;
  height: 44px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.weekday-btn.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.weekday-btn:hover {
  border-color: #dc2626;
}

.temp-closed-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.temp-closed-form input {
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.temp-closed-list {
  list-style: none;
}

.temp-closed-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.temp-closed-list .date {
  font-weight: 500;
}

.temp-closed-list .note {
  color: #6b7280;
  font-size: 13px;
}

.temp-closed-list .btn {
  margin-left: auto;
}

/* Notice */
.notice {
  padding: 24px;
  text-align: center;
  border-radius: 12px;
  margin-bottom: 16px;
}

.notice.unpublished {
  background: #fef3c7;
  color: #92400e;
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 300;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-nav {
    display: none;
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-cell.day {
    min-height: 60px;
    padding: 2px;
  }

  .day-num {
    font-size: 11px;
  }

  .schedule-item {
    font-size: 8px;
  }
}

/* Admin Calendar */
.admin-calendar .calendar-cell.day {
  min-height: 80px;
}
