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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

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

/* Header */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo i {
  font-size: 2rem;
  color: #667eea;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
}

.subtitle {
  font-size: 0.9rem;
  color: #666;
  font-weight: 400;
}

.nav {
  display: flex;
  gap: 1rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  transition: all 0.3s ease;
}

.nav-btn:hover,
.nav-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Filters */
.filters {
  background: rgba(255, 255, 255, 0.9);
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-item label {
  font-weight: 500;
  color: #555;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-item select,
.filter-item input {
  padding: 0.5rem 1rem;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 0.9rem;
  background: white;
  min-width: 150px;
  transition: all 0.3s ease;
}

.filter-item select:focus,
.filter-item input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box input {
  min-width: 250px;
}

.stats {
  display: flex;
  gap: 2rem;
  margin-left: auto;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
  font-weight: 500;
}

/* Loading */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading.hidden {
  display: none;
}

.loading-spinner {
  text-align: center;
}

.loading-spinner i {
  font-size: 3rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.loading-spinner p {
  font-size: 1.1rem;
  color: #666;
}

/* Main Content */
.main {
  padding: 2rem 0;
  min-height: 60vh;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Wallpaper Grid */
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.wallpaper-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
  cursor: pointer;
}

.wallpaper-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.wallpaper-image {
  position: relative;
  width: 100%;
  height: 250px;
  overflow: hidden;
}

.wallpaper-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.wallpaper-card:hover .wallpaper-image img {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.7));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wallpaper-card:hover .image-overlay {
  opacity: 1;
}

.wallpaper-info {
  padding: 1.5rem;
}

.wallpaper-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
  line-height: 1.4;
}

.wallpaper-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.wallpaper-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.country-tag,
.date-tag {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.country-tag {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.date-tag {
  background: #f1f3f4;
  color: #555;
}

/* Countries Grid */
.countries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.country-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
  cursor: pointer;
}

.country-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.country-flag {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.country-name {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
}

.country-code {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.country-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: #667eea;
}

.stat-label {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.25rem;
}

/* Timeline */
.timeline-container {
  margin-top: 2rem;
}

.timeline-date {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #667eea;
}

.timeline-wallpapers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  padding: 2rem;
  overflow-y: auto;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  cursor: pointer;
  color: #666;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 1);
  color: #333;
}

.modal-header {
  padding: 2rem 2rem 1rem;
}

.modal-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333;
}

.modal-meta {
  display: flex;
  gap: 1rem;
}

.modal-body {
  display: flex;
  gap: 2rem;
  padding: 0 2rem 2rem;
}

.modal-image-container {
  flex: 1;
  position: relative;
}

.modal-image-container img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.modal-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.resolution-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.resolution-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: #333;
  font-family: inherit;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.resolution-btn:hover {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25);
}

.resolution-btn.resolution-4k {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.resolution-btn.resolution-4k:hover {
  background: linear-gradient(135deg, #5a6fd8, #6b46a3);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.resolution-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.resolution-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.resolution-size {
  font-size: 0.8rem;
  opacity: 0.8;
}

.badge-4k {
  background: rgba(255, 215, 0, 0.9);
  color: #333;
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  }
}

.download-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 80px;
  justify-content: flex-end;
}

.download-text {
  font-weight: 500;
}

.download-status {
  font-weight: 600;
  font-size: 1.1rem;
}

/* 下载状态样式 */
.resolution-btn.downloading {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: white !important;
  cursor: not-allowed;
}

.resolution-btn.downloading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.resolution-btn.download-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: white !important;
  animation: success-pulse 0.6s ease-out;
}

@keyframes success-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.resolution-btn.download-error {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: white !important;
  animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

.resolution-btn:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

/* 移动端响应式 */
@media (max-width: 768px) {
  .resolution-btn {
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
  }

  .download-action {
    min-width: 70px;
  }

  .badge-4k {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
  }
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 2px solid #667eea;
  border-radius: 8px;
  color: #667eea;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: #667eea;
  color: white;
}

/* 主下载按钮特殊样式 */
.download-btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  color: white !important;
  border-color: transparent !important;
  font-weight: 700;
  padding: 1rem 1.75rem;
  font-size: 1.1rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  min-width: 160px;
  justify-content: center;
  position: relative;
}

.download-btn-primary:hover {
  background: linear-gradient(135deg, #5a6fd8, #6b46a3) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.download-btn-primary .btn-resolution {
  background: rgba(255, 215, 0, 0.9);
  color: #333;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: auto;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  }
}

/* 下载面板样式 */
.download-panel {
  margin-top: 1rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  border: 2px solid #dee2e6;
  transition: all 0.3s ease;
}

.download-panel.hidden {
  display: none;
}

.download-panel.show {
  display: block;
  animation: slideDown 0.3s ease-out;
}

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

.download-panel h4 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
}

.resolution-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.resolution-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.resolution-option:hover {
  border-color: #667eea;
  background: #f8f9ff;
  transform: translateY(-1px);
}

.resolution-option.is-4k {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.resolution-option.is-4k:hover {
  background: linear-gradient(135deg, #5a6fd8, #6b46a3);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.resolution-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.resolution-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.resolution-size {
  font-size: 0.85rem;
  opacity: 0.8;
}

.resolution-badge {
  background: rgba(255, 215, 0, 0.9);
  color: #333;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.download-icon {
  font-size: 1.2rem;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.resolution-option:hover .download-icon {
  opacity: 1;
  transform: scale(1.1);
}

/* 快速下载选项 */
.quick-download {
  margin-bottom: 1rem;
}

.quick-download-btn {
  width: 100%;
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: white !important;
  border-color: transparent !important;
  font-weight: 600;
  animation: quick-pulse 1.5s infinite;
}

.quick-download-btn:hover {
  background: linear-gradient(135deg, #e98307, #c26a06) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

@keyframes quick-pulse {
  0%,
  100% {
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
  }
  50% {
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  }
}

/* 下载面板响应式设计 */
@media (max-width: 768px) {
  .modal-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .download-btn-primary {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  .resolution-options {
    grid-template-columns: 1fr;
  }

  .resolution-option {
    padding: 0.75rem;
  }
}

/* Footer */
.footer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  margin-top: 4rem;
  padding: 3rem 0 2rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 2rem;
}

.footer-info h3 {
  color: #333;
  margin-bottom: 0.5rem;
}

.footer-info p {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
}

.footer-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #667eea;
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid #eee;
  text-align: center;
  color: #999;
  font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .nav {
    width: 100%;
    justify-content: center;
  }

  .nav-btn span {
    display: none;
  }

  .filter-group {
    flex-direction: column;
    align-items: stretch;
  }

  .stats {
    margin-left: 0;
    justify-content: center;
  }

  .wallpaper-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .modal {
    padding: 1rem;
  }

  .modal-body {
    flex-direction: column;
    padding: 1rem;
  }

  .footer-content {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wallpaper-card,
.country-card {
  animation: fadeIn 0.6s ease forwards;
}

.wallpaper-card:nth-child(even) {
  animation-delay: 0.1s;
}

.wallpaper-card:nth-child(3n) {
  animation-delay: 0.2s;
}

/* 通知系统样式 */
.notification-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  gap: 0.5rem;
  min-width: 44px;
  min-height: 44px;
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  min-height: 36px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6b4190 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
  box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

.notification-status {
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 500;
}

.notification-status.subscribed {
  color: #28a745;
}

/* 通知消息动画 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* 响应式设计 */
@media (max-width: 768px) {
  .notification-control {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .btn-sm {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }
}
