/* ============================================================
   Coser Map - 全局樣式
   ============================================================ */

:root {
  --primary-color: #e91e63;
  --secondary-color: #2196f3;
  --accent-color: #ffc107;
  --dark-bg: #1a1a1a;
  --light-bg: #ffffff;
  --border-color: #e0e0e0;
  --text-primary: #333333;
  --text-secondary: #666666;
  --success-color: #4caf50;
  --error-color: #f44336;

  --sidebar-width: 350px;
  --sidebar-width-mobile: 90vw;
  --navbar-height: 60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--light-bg);
  color: var(--text-primary);
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ============================================================
   Navbar (頂部導覽列)
   ============================================================ */

.navbar {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  padding: 10px 20px;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 15px;
}

.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.3s ease;
}

.menu-btn span {
  width: 25px;
  height: 3px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.navbar-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

/* ============================================================
   語言切換下拉菜單
   ============================================================ */

.language-switcher {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.language-select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--light-bg);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.language-select:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(233, 30, 99, 0.1);
}

.language-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.language-select option {
  padding: 8px;
  color: var(--text-primary);
  background-color: var(--light-bg);
}

/* ============================================================
   Sidebar (側邊欄)
   ============================================================ */

.sidebar {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--light-bg);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: var(--navbar-height);
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.panel {
  display: none;
}

.panel.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 18px;
  margin: 0;
}

.back-btn,
.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-primary);
  padding: 5px;
  transition: color 0.2s ease;
}

.back-btn:hover,
.close-btn:hover {
  color: var(--primary-color);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ============================================================
   Filter Panel (篩選面板)
   ============================================================ */

.filter-section {
  margin-bottom: 25px;
}

.filter-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 8px;
  transition: border-color 0.2s ease;
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.tags-list,
.cosplayers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tag-item,
.cosplayer-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag-item:hover,
.cosplayer-item:hover {
  background-color: rgba(233, 30, 99, 0.05);
  border-color: var(--primary-color);
}

.tag-item input[type='checkbox'],
.cosplayer-item input[type='checkbox'] {
  margin-right: 10px;
  cursor: pointer;
}

.tag-item label,
.cosplayer-item label {
  flex: 1;
  cursor: pointer;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tag-count,
.cosplayer-count {
  font-size: 12px;
  color: var(--text-secondary);
  background-color: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 3px;
}

.filter-section label {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 14px;
}

.filter-section input[type='radio'],
.filter-section input[type='date'] {
  margin-right: 8px;
  cursor: pointer;
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ============================================================
   Post Detail Panel (貼文詳情面板)
   ============================================================ */

.carousel-container {
  position: relative;
  margin-bottom: 20px;
}

.carousel-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background-color: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
}

.carousel-slide {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 20px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  z-index: 10;
}

.carousel-prev:hover,
.carousel-next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.carousel-prev {
  left: 10px;
}

.carousel-next {
  right: 10px;
}

.carousel-indicator {
  text-align: center;
  padding: 10px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.post-story {
  background-color: rgba(0, 0, 0, 0.02);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  line-height: 1.6;
  font-size: 14px;
  color: var(--text-primary);
  max-height: 150px;
  overflow-y: auto;
}

.post-info {
  background-color: rgba(0, 0, 0, 0.02);
  padding: 15px;
  border-radius: 8px;
}

.post-info h3 {
  margin-bottom: 15px;
  font-size: 16px;
}

.info-item {
  display: flex;
  margin-bottom: 10px;
  font-size: 14px;
}

.info-item .label {
  font-weight: 600;
  min-width: 70px;
  color: var(--text-secondary);
}

.info-item span:last-child {
  flex: 1;
  word-break: break-all;
  color: var(--text-primary);
}

/* ============================================================
   Submission Panel (提交面板)
   ============================================================ */

.form-section {
  margin-bottom: 25px;
}

.form-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-hint {
  font-size: 13px;
  color: #ff9800;
  margin-bottom: 12px;
  padding: 8px 12px;
  background-color: rgba(255, 152, 0, 0.1);
  border-left: 3px solid #ff9800;
  border-radius: 2px;
}

.form-section label {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-primary);
}

.form-section input[type='text'],
.form-section input[type='email'],
.form-section input[type='number'],
.form-section textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  margin-top: 5px;
  transition: border-color 0.2s ease;
}

.form-section input[type='text']:focus,
.form-section input[type='email']:focus,
.form-section input[type='number']:focus,
.form-section textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.form-section input[type='checkbox'],
.form-section input[type='radio'] {
  margin-right: 8px;
  cursor: pointer;
}

.form-section input[type='checkbox']:disabled,
.form-section input[type='number']:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.required {
  color: var(--error-color);
}

.location-coords {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.location-coords label {
  position: relative;
}

.coord-check {
  position: absolute;
  right: 12px;
  top: 35px;
  font-size: 18px;
}

.location-status {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
  font-size: 13px;
  min-height: 20px;
}

.location-status.loading {
  color: #ff9800;
  background-color: rgba(255, 152, 0, 0.1);
}

.location-status.success {
  color: var(--success-color);
  background-color: rgba(76, 175, 80, 0.1);
}

.location-status.error {
  color: var(--error-color);
  background-color: rgba(244, 67, 54, 0.1);
}

.drop-zone {
  border: 2px dashed var(--primary-color);
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: rgba(233, 30, 99, 0.02);
  margin-bottom: 15px;
}

.drop-zone:hover {
  background-color: rgba(233, 30, 99, 0.05);
  border-color: #c2185b;
}

.drop-zone.dragover {
  background-color: rgba(233, 30, 99, 0.1);
  border-color: #c2185b;
}

.drop-zone p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.drop-zone .link {
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
}

.uploaded-photos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.photo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
  font-size: 13px;
}

.photo-item-info {
  flex: 1;
}

.photo-item-name {
  font-weight: 500;
  color: var(--text-primary);
}

.photo-item-size {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.photo-item-remove {
  background: none;
  border: none;
  color: var(--error-color);
  cursor: pointer;
  font-size: 16px;
  padding: 5px;
  transition: color 0.2s ease;
}

.photo-item-remove:hover {
  color: #d32f2f;
}

.form-section textarea {
  resize: vertical;
  min-height: 100px;
}

#storyCount {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 5px;
  display: block;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ============================================================
   按鈕 (Button)
   ============================================================ */

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: #c2185b;
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background-color: #1976d2;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
  flex: none;
}

/* ============================================================
   側邊欄菜單
   ============================================================ */

.sidebar-menu {
  position: fixed;
  left: 0;
  top: 0;
  width: 250px;
  height: 100vh;
  background-color: var(--dark-bg);
  z-index: 45;
  padding-top: var(--navbar-height);
  animation: slideInMenu 0.3s ease;
}

@keyframes slideInMenu {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.sidebar-menu ul {
  list-style: none;
  padding: 0;
}

.sidebar-menu li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-item {
  display: block;
  padding: 15px 20px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 15px;
}

.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  padding-left: 25px;
}

.menu-item.active {
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
}

/* ============================================================
   地圖容器 (Map Container)
   ============================================================ */

.map-container {
  flex: 1;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.leaflet-container {
  font-family: inherit;
}

.map-marker-popup {
  font-size: 14px;
}

.map-marker-popup strong {
  display: block;
  margin-bottom: 5px;
  color: var(--primary-color);
}

/* ============================================================
   響應式設計 (Responsive)
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --sidebar-width: 90vw;
    --navbar-height: 50px;
  }

  .navbar {
    padding: 8px 15px;
  }

  .navbar-title {
    font-size: 18px;
  }

  .menu-btn {
    padding: 5px;
  }

  .panel-header {
    padding: 12px 15px;
  }

  .panel-header h2 {
    font-size: 16px;
  }

  .panel-content {
    padding: 15px;
  }

  .form-section,
  .filter-section {
    margin-bottom: 20px;
  }

  .carousel-container {
    margin-bottom: 15px;
  }

  .sidebar-menu {
    width: 280px;
  }
}

@media (max-width: 480px) {
  :root {
    --sidebar-width: 100vw;
    --navbar-height: 45px;
  }

  .navbar {
    padding: 8px 12px;
  }

  .navbar-title {
    font-size: 16px;
  }

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

  .filter-actions {
    flex-direction: column;
  }

  .location-coords {
    grid-template-columns: 1fr;
  }

  .carousel-prev,
  .carousel-next {
    padding: 8px 12px;
    font-size: 18px;
  }

  .form-section label {
    font-size: 13px;
  }
}

/* ============================================================
   動畫和過渡
   ============================================================ */

.sidebar {
  animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.sidebar.collapsed {
  animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

.panel {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Leaflet 自訂樣式 */

.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
  margin: 10px 12px;
}

.leaflet-control-zoom {
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.leaflet-control-attribution {
  background-color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
}

/* ============================================================
   Toast 通知
   ============================================================ */

.toast {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}
