/* 全局样式 */
:root {
  --primary-color: #00a8ff;
  --secondary-color: #192a56;
  --accent-color: #0097e6;
  --background-color: #0c1633;
  --card-bg-color: rgba(25, 42, 86, 0.7);
  --text-color: #f5f6fa;
  --border-color: rgba(0, 168, 255, 0.5);
  --success-color: #4cd137;
  --warning-color: #fbc531;
  --danger-color: #e84118;
}

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

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--background-color);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 168, 255, 0.1) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(0, 168, 255, 0.1) 0%, transparent 20%),
    linear-gradient(to bottom, var(--background-color), #070d1f);
  color: var(--text-color);
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* 头部样式 */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

h1 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  color: var(--primary-color);
  text-shadow: 0 0 10px rgba(0, 168, 255, 0.5);
  font-size: 2.2rem;
}

h1 span {
  font-size: 1.2rem;
  opacity: 0.7;
  margin-left: 10px;
}

.controls {
  display: flex;
  gap: 10px;
}

.btn {
  background-color: var(--secondary-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
}

.btn:hover {
  background-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(0, 168, 255, 0.5);
}

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

.btn-secondary {
  background-color: transparent;
}

/* 时钟网格样式 */
.clock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.clock-card {
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 380px; /* 固定高度确保所有卡片一致 */
  justify-content: space-between; /* 均匀分布内容 */
}

.clock-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.clock-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    rgba(0, 168, 255, 0.1),
    transparent,
    transparent
  );
  transform: rotate(45deg);
  z-index: 0;
}

.city-info {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  z-index: 1;
  width: 100%;
}

.flag {
  width: 30px;
  height: 20px;
  margin-right: 10px;
  border-radius: 3px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.city-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0;
}

.country-name {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 2px;
}

.analog-clock {
  position: relative;
  width: 200px;
  height: 200px;
  background-color: rgba(12, 22, 51, 0.7);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  margin: 10px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 20px rgba(0, 168, 255, 0.2);
  z-index: 1;
}

.analog-clock::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: var(--primary-color);
  border-radius: 50%;
  z-index: 10;
}

.clock-face {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hour-marks {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hour-marks span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 18px;
  background-color: var(--primary-color);
  opacity: 0.8;
  transform-origin: center bottom;
  transform: rotate(var(--angle, 0deg)) translateY(-90px);
}

.minute-marks {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.minute-marks span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 10px;
  background-color: var(--text-color);
  opacity: 0.4;
  transform-origin: center bottom;
  transform: rotate(var(--angle, 0deg)) translateY(-90px);
}

.hand {
  position: absolute;
  transform-origin: 100% 100%;
  transform-origin: 50% 100%;
  bottom: 50%;
  left: 50%;
  border-radius: 10px;
  transform: translateX(-50%);
  z-index: 5;
}

.hour-hand {
  width: 4px;
  height: 35%;
  background-color: var(--text-color);
}

.minute-hand {
  width: 3px;
  height: 45%;
  background-color: var(--text-color);
}

.second-hand {
  width: 2px;
  height: 48%;
  background-color: var(--primary-color);
  box-shadow: 0 0 5px var(--primary-color);
}

.digital-time {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  margin-top: 15px;
  color: var(--primary-color);
  text-shadow: 0 0 10px rgba(0, 168, 255, 0.5);
  z-index: 1;
}

.date {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 5px;
  z-index: 1;
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 100;
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  margin: 50px auto;
  box-shadow: 0 0 30px rgba(0, 168, 255, 0.3);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.modal-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.close-modal {
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-color);
  opacity: 0.7;
  transition: all 0.3s ease;
}

.close-modal:hover {
  opacity: 1;
  color: var(--primary-color);
}

.modal-body {
  padding: 20px;
}

.city-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.city-checkbox {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.city-checkbox:hover {
  background-color: rgba(0, 168, 255, 0.1);
}

.city-checkbox input {
  margin-right: 8px;
}

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

/* 响应式设计 */
@media (max-width: 1024px) {
  .clock-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .analog-clock {
    width: 130px;
    height: 130px;
  }
  
  .digital-time {
    font-size: 1.3rem;
  }
  
  .clock-card {
    height: 350px;
  }
}

@media (max-width: 768px) {
  .clock-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  .city-selector {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .clock-card {
    height: 360px;
  }
}

@media (max-width: 480px) {
  .clock-grid {
    grid-template-columns: 1fr;
  }
  
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  .analog-clock {
    width: 180px;
    height: 180px;
  }
  
  .city-selector {
    grid-template-columns: 1fr;
  }
  
  .clock-card {
    height: 400px;
  }
}
