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

body {
  font-family: -apple-system, 'Segoe UI', sans-serif;
  background: #fafafa;
  color: #222;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

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

/* ===== Header ===== */
.header {
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111;
}

.nav { display: flex; gap: 24px; }

.nav-link {
  font-size: 0.9rem;
  color: #666;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active { color: #111; font-weight: 600; }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 48px 0 32px;
}

.hero h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.hero p { color: #888; font-size: 0.95rem; }

/* ===== Search ===== */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.search-bar input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus { border-color: #333; }

.search-bar select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
  outline: none;
}

/* ===== Materials Grid ===== */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding-bottom: 48px;
}

.material-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
}

.material-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}

.card-category {
  display: inline-block;
  font-size: 0.75rem;
  color: #666;
  background: #f0f0f0;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-price { font-weight: 700; font-size: 1rem; }
.card-price.free { color: #16a34a; }
.card-date { font-size: 0.75rem; color: #aaa; }

.no-results {
  text-align: center;
  color: #999;
  padding: 48px 0;
}

/* ===== Upload Form ===== */
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  padding: 40px 0 24px;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 520px;
  padding-bottom: 60px;
}

.upload-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #444;
}

.upload-form input,
.upload-form textarea,
.upload-form select {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.upload-form input:focus,
.upload-form textarea:focus,
.upload-form select:focus { border-color: #333; }

.file-hint { font-size: 0.75rem; color: #aaa; }

.btn-primary {
  padding: 12px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: #333; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
}

.modal-category {
  display: inline-block;
  font-size: 0.75rem;
  color: #666;
  background: #f0f0f0;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.modal-desc { font-size: 0.9rem; color: #555; line-height: 1.7; margin-bottom: 16px; }
.modal-price { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.modal-price.free { color: #16a34a; }
.modal-date { font-size: 0.8rem; color: #aaa; margin-bottom: 20px; }
.modal-file { font-size: 0.85rem; color: #666; }

.btn-buy {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-buy:hover { background: #333; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .search-bar { flex-direction: column; }
  .hero h1 { font-size: 1.3rem; }
  .materials-grid { grid-template-columns: 1fr; }
}
