@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
  /* Premium Color Palette */
  --primary-color: #4F46E5;
  /* Indigo 600 */
  --primary-hover: #4338CA;
  /* Indigo 700 */
  --secondary-color: #EC4899;
  /* Pink 500 - Accent */
  --accent-color: #8B5CF6;
  /* Violet 500 */

  --bg-color: #F8FAFC;
  /* Slate 50 */
  --surface-color: #FFFFFF;
  --text-main: #1E293B;
  /* Slate 800 */
  --text-muted: #64748B;
  /* Slate 500 */
  --border-color: #E2E8F0;
  /* Slate 200 */

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --font-sans: 'Inter', 'Noto Sans JP', sans-serif;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0F172A;
    /* Slate 900 */
    --surface-color: #1E293B;
    /* Slate 800 */
    --text-main: #F8FAFC;
    /* Slate 50 */
    --text-muted: #94A3B8;
    /* Slate 400 */
    --border-color: #334155;
    /* Slate 700 */

    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  font-size: 0.95rem;
  text-decoration: none;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background: var(--surface-color);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-color);
  border-color: var(--text-muted);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 3.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 1rem;
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.05) 0%, transparent 100%);
  margin-bottom: 2rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Search Box */
.search-container {
  max-width: 700px;
  margin: 0 auto;
  background: var(--surface-color);
  padding: 0.75rem;
  border-radius: var(--radius-full);
  display: flex;
  gap: 0.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.search-select {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  font-weight: 600;
  color: var(--text-main);
  border-right: 1px solid var(--border-color);
  outline: none;
  min-width: 120px;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text-main);
  background: transparent;
}

.search-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.search-btn:hover {
  transform: scale(1.1);
}

/* Filters */
.filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.filter-chip {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.filter-chip.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Materials Grid */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
}

.material-card {
  background: var(--surface-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid var(--border-color);
  position: relative;
  display: flex;
  flex-direction: column;
}

.material-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-thumb {
  width: 100%;
  padding-top: 56.25%;
  /* 16:9 Aspect Ratio */
  position: relative;
  background-color: var(--bg-color);
  overflow: hidden;
}

.card-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.material-card:hover .card-thumb img {
  transform: scale(1.05);
}

.card-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: var(--bg-color);
  color: var(--text-muted);
  font-weight: 600;
}

.tag.bible {
  background: #EEF2FF;
  color: #4F46E5;
}

.card-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.card-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Detail Page */
.detail-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  padding: 2rem 0;
}

@media (max-width: 768px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.preview-container {
  background: var(--surface-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-md);
}

.main-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #f1f5f9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-preview img,
.main-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.download-panel {
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.file-list {
  list-style: none;
  margin: 1rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.75rem;
}

.file-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
}

.file-item.selected {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.file-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Checkbox overlay */
.file-checkbox {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 1.25rem;
  height: 1.25rem;
  z-index: 10;
  cursor: pointer;
}

/* Upload Form */
.upload-form {
  max-width: 800px;
  margin: 2rem auto;
  background: var(--surface-color);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-main);
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 3rem;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  background: var(--bg-color);
}

.drop-zone.dragover {
  border-color: var(--primary-color);
  background: rgba(79, 70, 229, 0.05);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

/* Load More */
.load-more-container {
  text-align: center;
  padding: 2rem;
}

nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}