/* ========================================
   中文233班作业公告板 - 样式表
   设计理念: 墨韵书香 · 新中式极简
   ======================================== */

/* CSS Variables */
:root {
  /* 主色 - 墨青色 */
  --primary: #1a3a4a;
  --primary-light: #2d5a6b;
  --primary-dark: #0f2a38;

  /* 强调色 - 朱砂红 */
  --accent: #c75555;
  --accent-light: #e07878;
  --accent-dark: #a04545;

  /* 背景色 */
  --bg-primary: #faf8f5;
  --bg-secondary: #f0ebe4;
  --bg-card: #ffffff;
  --bg-dark: #1a1a1a;

  /* 文字色 */
  --text-primary: #2c2c2c;
  --text-secondary: #666666;
  --text-muted: #999999;

  /* 边框 */
  --border: #e5e0d8;
  --border-dark: #3a3a3a;

  /* 科目颜色 */
  --subject-chinese: #c75555;
  --subject-math: #4a7c59;
  --subject-english: #5a7c9a;
  --subject-physics: #7c5a7c;
  --subject-chemistry: #7c6a4a;
  --subject-history: #6a5a4a;
  --subject-other: #666666;

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-hover: 0 12px 40px rgba(0,0,0,0.15);

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* 过渡 */
  --transition-fast: 150ms ease-out;
  --transition-normal: 250ms ease-out;
  --transition-slow: 400ms ease-out;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans SC', 'Crimson Pro', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Selection */
::selection {
  background: var(--accent);
  color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   Header
   ======================================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition-normal);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo-icon {
  width: 44px;
  height: 44px;
  color: var(--primary);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.05em;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.site-suffix {
  font-family: 'Crimson Pro', serif;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

/* ========================================
   Hero Section
   ======================================== */

.hero {
  position: relative;
  padding: 140px var(--space-lg) var(--space-3xl);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  z-index: -1;
}

.hero-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(199, 85, 85, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(26, 58, 74, 0.03) 0%, transparent 50%);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

.hero-decoration {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 120px;
  height: 200px;
  color: var(--primary);
}

.hero-decoration.left {
  left: -80px;
}

.hero-decoration.right {
  right: -80px;
}

.hero-decoration svg {
  width: 100%;
  height: 100%;
}

.hero-text {
  animation: fadeInUp 0.8s ease-out;
}

.hero-title {
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-md);
  letter-spacing: 0.1em;
}

.hero-subtitle {
  font-family: 'Crimson Pro', serif;
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-md);
}

.hero-subtitle .divider {
  color: var(--border);
}

.hero-welcome {
  font-size: 1rem;
  color: var(--text-muted);
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* ========================================
   Filter Section
   ======================================== */

.filter-section {
  position: sticky;
  top: 73px;
  z-index: 50;
  background: var(--bg-primary);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.filter-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.search-box {
  position: relative;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: var(--space-md) var(--space-2xl) var(--space-md) var(--space-2xl);
  font-family: inherit;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition-normal);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(26, 58, 74, 0.1);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear.visible {
  opacity: 1;
  visibility: visible;
}

.search-clear:hover {
  color: var(--text-primary);
}

.search-clear svg {
  width: 18px;
  height: 18px;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
}

.filter-btn {
  padding: var(--space-sm) var(--space-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-normal);
}

.filter-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(26, 58, 74, 0.03);
}

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

.filter-btn.active:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: white;
}

/* Show Expired Button */
.show-expired-container {
  display: flex;
  justify-content: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px dashed var(--border);
}

.show-expired-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  border: 1px solid var(--text-muted);
  border-radius: 24px;
  color: var(--text-muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
}

.show-expired-btn svg {
  width: 18px;
  height: 18px;
}

.show-expired-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.show-expired-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.show-expired-btn.active:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-3xl);
  min-height: 50vh;
}

/* Homework Grid */
.homework-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

/* Homework Card */
.homework-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-normal);
  animation: cardEnter 0.5s ease-out backwards;
}

.homework-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: transparent;
}

.homework-card.expired {
  opacity: 0.7;
}

.homework-card.expired:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.card-accent {
  height: 4px;
  background: var(--subject-color, var(--subject-other));
}

.card-content {
  padding: var(--space-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
  gap: var(--space-md);
}

.subject-tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--subject-bg, var(--bg-secondary));
  color: var(--subject-color, var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-status {
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.card-status.active {
  background: rgba(74, 124, 89, 0.1);
  color: var(--subject-math);
}

.card-status.expired {
  background: rgba(102, 102, 102, 0.1);
  color: var(--text-muted);
}

.card-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

.card-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-lg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.card-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.date-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.date-value {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-family: 'Crimson Pro', serif;
}

.card-countdown {
  text-align: right;
}

.countdown-value {
  font-family: 'Crimson Pro', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.countdown-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.countdown-value.urgent {
  color: var(--accent);
  animation: pulse 2s infinite;
}

/* Expired card overlay */
.card-expired-overlay {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: var(--text-muted);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.homework-card {
  position: relative;
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.empty-illustration {
  width: 160px;
  height: 160px;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.empty-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.empty-text {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ========================================
   Loading State
   ======================================== */

.loading-state {
  display: none;
}

.loading-state.visible {
  display: block;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.skeleton-card {
  height: 220px;
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-card) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
}

/* ========================================
   Modal
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px) scale(0.95);
  transition: var(--transition-normal);
}

.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-accent {
  height: 6px;
  background: var(--subject-color, var(--subject-other));
}

.modal-content {
  padding: var(--space-xl);
}

.modal-header {
  margin-bottom: var(--space-xl);
}

.modal-subject {
  display: inline-flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--subject-bg, var(--bg-secondary));
  color: var(--subject-color, var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

.modal-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: var(--space-md);
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.modal-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-meta-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-meta-value {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  color: var(--text-secondary);
}

.modal-description {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-xl);
}

.modal-description p {
  margin-bottom: var(--space-md);
}

.modal-description p:last-child {
  margin-bottom: 0;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) var(--space-lg);
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.footer-logo {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.footer-tagline {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer-bottom {
  text-align: center;
}

.footer-bottom p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
  .header-content {
    padding: var(--space-sm) var(--space-md);
  }

  .logo-icon {
    width: 36px;
    height: 36px;
  }

  .logo-title {
    font-size: 1.25rem;
  }

  .site-suffix {
    display: none;
  }

  .hero {
    padding: 120px var(--space-md) var(--space-2xl);
  }

  .hero-decoration {
    display: none;
  }

  .hero-title {
    font-size: 2rem;
  }

  .filter-section {
    top: 61px;
  }

  .filter-btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8125rem;
  }

  .main-content {
    padding: var(--space-lg) var(--space-md) var(--space-2xl);
  }

  .homework-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-top: auto;
  }

  .modal-content {
    padding: var(--space-lg);
  }

  .modal-title {
    font-size: 1.5rem;
  }

  .footer-main {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }
}

@media (max-width: 480px) {
  .filter-buttons {
    gap: var(--space-xs);
  }

  .filter-btn {
    padding: 6px var(--space-sm);
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
  }
}
