/* ===========================================
   Event Search System Styles
   =========================================== */

/* -------------------------------------------
   Calendar Component
   ------------------------------------------- */
.event-calendar-wrapper {
  max-width: 700px;
  margin: 0 auto 40px;
  background: #f8f9fa;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 5px 2px 5px 4px
    rgba(104, 95, 95, 0.25);
}

/* Calendar Header */
.event-calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.event-calendar-header .month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4a90d9;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.2s;
}

.event-calendar-header .month-nav:hover {
  opacity: 0.7;
}

.event-calendar-header .month-nav i {
  width: 28px;
  height: 28px;
  border: 2px solid #4a90d9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.event-calendar-header .current-month {
  text-align: center;
}

.event-calendar-header .current-month .month {
  font-size: 32px;
  font-weight: bold;
  color: #333;
  display: block;
}

.event-calendar-header .current-month .year {
  font-size: 14px;
  color: #666;
}

/* Calendar Table */
.event-calendar-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.event-calendar-table th,
.event-calendar-table td {
  text-align: center;
  padding: 8px 4px;
  border: 1px solid #e9ecef;
}

.event-calendar-table th {
  background: #f8f9fa;
  font-weight: normal;
  font-size: 14px;
  color: #666;
  padding: 12px 4px;
}

.event-calendar-table th.sunday {
  color: #dc3545;
}

.event-calendar-table th.saturday {
  color: #4a90d9;
}

/* Calendar Cells */
.event-calendar-table td {
  height: 70px;
  vertical-align: top;
  padding: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.event-calendar-table td:hover {
  background-color: #e8f4fc;
}

.event-calendar-table td.empty {
  background: #fafafa;
  cursor: default;
}

.event-calendar-table td.empty:hover {
  background: #fafafa;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.calendar-day .day-number {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.calendar-day.sunday .day-number {
  color: #dc3545;
}

.calendar-day.saturday .day-number {
  color: #4a90d9;
}

.calendar-day .event-count {
  font-size: 12px;
  color: #4a90d9;
  text-decoration: underline;
}

/* Calendar Container - 固定高さでガタつき防止 */
#event-calendar-container {
  min-height: 520px; /* 6週分の高さを確保 */
}

/* Loading Spinner */
.event-calendar-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 520px;
}

.event-calendar-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e9ecef;
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Show All Events Button */
.event-calendar-show-all {
  display: block;
  width: 100%;
  padding: 16px;
  background: #c8d8e8;
  color: #4a6b8a;
  text-align: center;
  border-radius: 8px;
  font-size: 15px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.event-calendar-show-all:hover {
  background: #b8c8d8;
  color: #3a5b7a;
}

.event-calendar-show-all i {
  margin-left: 8px;
}

/* -------------------------------------------
   Responsive
   ------------------------------------------- */
@media (max-width: 600px) {
  .event-calendar-wrapper {
    padding: 16px;
    margin: 0 3% 30px;
    border-radius: 12px;
  }

  .event-calendar-header .month-nav span {
    display: none;
  }

  .event-calendar-header .current-month .month {
    font-size: 24px;
  }

  .event-calendar-table th,
  .event-calendar-table td {
    padding: 4px 2px;
    font-size: 12px;
  }

  .event-calendar-table td {
    height: 55px;
  }

  #event-calendar-container {
    min-height: 420px;
  }

  .event-calendar-loading {
    height: 420px;
  }

  .calendar-day .day-number {
    font-size: 14px;
  }

  .calendar-day .event-count {
    font-size: 10px;
  }
}

/* -------------------------------------------
   Ongoing Events List Component
   ------------------------------------------- */
.event-list-ongoing-wrapper {
  max-width: 700px;
  margin: 0 auto 40px;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 5px 2px 5px 4px
    rgba(104, 95, 95, 0.25);
}

.event-list-ongoing-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.event-list-ongoing-title i {
  color: #4a90d9;
  font-size: 24px;
}

/* Scrollable Container */
.event-list-ongoing-container {
  max-height: 400px;
  overflow-y: auto;
  border-top: 1px solid #e9ecef;
}

/* Event Item */
.event-list-ongoing-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #e9ecef;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s;
}

.event-list-ongoing-item:hover {
  background-color: #f8f9fa;
}

.event-list-ongoing-item:last-child {
  border-bottom: none;
}

/* Thumbnail */
.event-list-ongoing-thumbnail {
  flex-shrink: 0;
  width: 120px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
}

.event-list-ongoing-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Info */
.event-list-ongoing-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.event-list-ongoing-item-title {
  font-size: 15px;
  font-weight: bold;
  color: #333;
  margin: 0 0 8px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-list-ongoing-date,
.event-list-ongoing-area {
  font-size: 13px;
  color: #666;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.event-list-ongoing-date i,
.event-list-ongoing-area i {
  color: #999;
  width: 14px;
  text-align: center;
}

/* More Button */
.event-list-ongoing-more {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: #4a90d9;
  color: #fff;
  text-align: center;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.event-list-ongoing-more:hover {
  background: #3a7bc8;
  color: #fff;
}

.event-list-ongoing-more i {
  margin-left: 8px;
}

/* Empty State */
.event-list-ongoing-empty {
  text-align: center;
  color: #999;
  padding: 40px 0;
  margin: 0;
}

/* -------------------------------------------
   Ongoing Events List - Responsive
   ------------------------------------------- */
@media (max-width: 600px) {
  .event-list-ongoing-wrapper {
    padding: 16px;
    margin: 0 3% 30px;
    border-radius: 12px;
  }

  .event-list-ongoing-title {
    font-size: 18px;
  }

  .event-list-ongoing-container {
    max-height: 350px;
  }

  .event-list-ongoing-item {
    gap: 12px;
    padding: 12px 0;
  }

  .event-list-ongoing-thumbnail {
    width: 100px;
    height: 70px;
  }

  .event-list-ongoing-item-title {
    font-size: 14px;
  }

  .event-list-ongoing-date,
  .event-list-ongoing-area {
    font-size: 12px;
  }
}

/* -------------------------------------------
   Search Box Component
   ------------------------------------------- */
.event-search-box-wrapper {
  max-width: 700px;
  margin: 0 auto 40px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 5px 2px 5px 4px rgba(104, 95, 95, 0.25);
}

/* Header */
.event-search-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #e8f0f8;
  cursor: pointer;
  transition: background-color 0.2s;
}

.event-search-box-header:hover {
  background: #dde8f2;
}

.event-search-box-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.event-search-box-title i {
  color: #4a90d9;
}

.event-search-box-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.3s;
}

.event-search-box-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.event-search-box-wrapper.collapsed .event-search-box-close {
  transform: rotate(45deg);
}

/* Content */
.event-search-box-content {
  padding: 24px;
  display: block;
}

.event-search-box-wrapper.collapsed .event-search-box-content {
  display: none;
}

/* Form Rows */
.event-search-row {
  margin-bottom: 20px;
}

.event-search-label {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

/* Keyword Input */
.event-search-keyword {
  display: flex;
  gap: 8px;
}

.event-search-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.event-search-input:focus {
  border-color: #4a90d9;
}

.event-search-keyword-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: #4a90d9;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s;
}

.event-search-keyword-btn:hover {
  background: #3a7bc8;
}

/* Checkboxes */
.event-search-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.event-search-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
}

.event-search-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #4a90d9;
  cursor: pointer;
}

/* Date Range */
.event-search-date-range {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.event-search-date-label {
  font-size: 14px;
  color: #666;
}

.event-search-date-input {
  width: 140px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>') no-repeat right 12px center;
  background-size: 16px;
  cursor: pointer;
}

.event-search-date-input:focus {
  border-color: #4a90d9;
}

.event-search-date-separator {
  font-size: 16px;
  color: #666;
}

/* Buttons */
.event-search-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.event-search-clear-btn {
  padding: 14px 32px;
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.event-search-clear-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.event-search-submit-btn {
  padding: 14px 32px;
  border: none;
  background: #4a90d9;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s;
}

.event-search-submit-btn:hover {
  background: #3a7bc8;
}

/* -------------------------------------------
   Search Box - Responsive
   ------------------------------------------- */
@media (max-width: 600px) {
  .event-search-box-wrapper {
    margin: 0 3% 30px;
    border-radius: 12px;
  }

  .event-search-box-header {
    padding: 14px 16px;
  }

  .event-search-box-title {
    font-size: 14px;
  }

  .event-search-box-content {
    padding: 16px;
  }

  .event-search-row {
    margin-bottom: 16px;
  }

  .event-search-checkboxes {
    gap: 10px 16px;
  }

  .event-search-checkbox {
    font-size: 13px;
  }

  .event-search-date-range {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .event-search-date-input {
    width: 100%;
  }

  .event-search-date-separator {
    display: none;
  }

  .event-search-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .event-search-clear-btn,
  .event-search-submit-btn {
    width: 100%;
    justify-content: center;
  }
}

/* -------------------------------------------
   Search Results Component (AJAX)
   ------------------------------------------- */
.event-search-results {
  border-top: 1px solid #e9ecef;
  padding: 20px 24px;
  background: #fff;
}

.event-search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9ecef;
}

.event-search-results-count {
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

.event-search-results-close {
  width: 28px;
  height: 28px;
  border: none;
  background: #f5f5f5;
  color: #666;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.event-search-results-close:hover {
  background: #e9ecef;
}

.event-search-results-list {
  max-height: 500px;
  overflow-y: auto;
}

.event-search-results-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}

/* Result Item */
.event-search-result-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #e9ecef;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s;
}

.event-search-result-item:hover {
  background-color: #f8f9fa;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
}

.event-search-result-item:last-child {
  border-bottom: none;
}

/* Thumbnail */
.event-search-result-thumbnail {
  flex-shrink: 0;
  width: 120px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
}

.event-search-result-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Info */
.event-search-result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.event-search-result-title {
  font-size: 15px;
  font-weight: bold;
  color: #333;
  margin: 0 0 8px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-search-result-date,
.event-search-result-area {
  font-size: 13px;
  color: #666;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.event-search-result-date i,
.event-search-result-area i {
  color: #999;
  width: 14px;
  text-align: center;
}

/* Empty State */
.event-search-results-empty {
  text-align: center;
  color: #999;
  padding: 40px 0;
  margin: 0;
}

/* -------------------------------------------
   Search Results - Responsive
   ------------------------------------------- */
@media (max-width: 600px) {
  .event-search-results {
    padding: 16px;
  }

  .event-search-results-list {
    max-height: 400px;
  }

  .event-search-result-item {
    gap: 12px;
    padding: 12px 0;
  }

  .event-search-result-item:hover {
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .event-search-result-thumbnail {
    width: 100px;
    height: 70px;
  }

  .event-search-result-title {
    font-size: 14px;
  }

  .event-search-result-date,
  .event-search-result-area {
    font-size: 12px;
  }
}
