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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  background-color: #fdf2f8;
  color: #1f2937;
  line-height: 1.6;
}

nav {
  background-color: #fbcfe8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
}

nav .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav .logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #9f1239;
  text-decoration: none;
}

nav .logo:hover {
  color: #831843;
}

nav .links {
  display: flex;
  gap: 1.5rem;
}

nav .links a {
  color: #be185d;
  text-decoration: none;
  font-weight: 500;
}

nav .links a:hover {
  color: #9f1239;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: calc(100vh - 200px);
}

footer {
  background-color: #fbcfe8;
  text-align: center;
  padding: 1.5rem;
  margin-top: 3rem;
  color: #be185d;
}

/* Homepage */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  color: #4b5563;
}

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

.post-card {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #fbcfe8;
  transition: box-shadow 0.3s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.post-card h3 {
  font-size: 1.25rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 0.5rem;
}

.post-card p {
  color: #6b7280;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #9ca3af;
}

.drama-tag {
  background-color: #fce7f3;
  color: #be185d;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: #ec4899;
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: background-color 0.3s;
  border: none;
  cursor: pointer;
}

.btn:hover {
  background-color: #db2777;
}

.btn-secondary {
  background-color: #6b7280;
}

.btn-secondary:hover {
  background-color: #4b5563;
}

.btn-danger {
  background-color: #ef4444;
}

.btn-danger:hover {
  background-color: #dc2626;
}

/* Post page */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-size: 2.5rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 1rem;
}

.rankings-box {
  background-color: #fdf2f8;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.rankings-box h3 {
  font-size: 1.125rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 1rem;
}

.rankings-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.ranking-item {
  text-align: center;
}

.ranking-item .label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.ranking-item .score {
  font-size: 1.5rem;
  font-weight: bold;
  color: #be185d;
}

.total-score {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #fbcfe8;
}

.total-score .label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.total-score .score {
  font-size: 2rem;
  font-weight: bold;
  color: #ec4899;
}

.post-content {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  line-height: 1.8;
}

.post-content h2 {
  color: #9f1239;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.post-content h3 {
  color: #be185d;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.post-content a {
  color: #ec4899;
  text-decoration: underline;
}

.post-content a:hover {
  color: #db2777;
}

/* Ranking page */
.ranking-table {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.ranking-table table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table thead {
  background-color: #fbcfe8;
}

.ranking-table th {
  padding: 1rem;
  text-align: left;
  font-weight: bold;
  color: #9f1239;
}

.ranking-table td {
  padding: 1rem;
  border-bottom: 1px solid #fce7f3;
}

.ranking-table tbody tr:hover {
  background-color: #fdf2f8;
}

.ranking-table .rank {
  font-weight: bold;
  color: #be185d;
}

.score-badge {
  background-color: #fce7f3;
  color: #be185d;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  display: inline-block;
}

.total-score-badge {
  background-color: #ec4899;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-weight: bold;
  font-size: 1.125rem;
}

/* Admin page */
.admin-container {
  max-width: 1400px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.admin-header h1 {
  font-size: 2.5rem;
  font-weight: bold;
  color: #9f1239;
}

.admin-actions {
  display: flex;
  gap: 1rem;
}

.posts-table {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.posts-table table {
  width: 100%;
  border-collapse: collapse;
}

.posts-table thead {
  background-color: #fbcfe8;
}

.posts-table th {
  padding: 1rem;
  text-align: left;
  font-weight: bold;
  color: #9f1239;
}

.posts-table td {
  padding: 1rem;
  border-bottom: 1px solid #fce7f3;
}

.posts-table tbody tr:hover {
  background-color: #fdf2f8;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Editor */
.editor-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.editor-panel, .preview-panel {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.editor-panel h3, .preview-panel h3 {
  font-size: 1.25rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 1rem;
}

/* Markdown Toolbar */
.markdown-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #fdf2f8;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-btn {
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid #fbcfe8;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #9f1239;
  transition: all 0.2s;
}

.toolbar-btn:hover {
  background: #fce7f3;
  border-color: #ec4899;
  transform: translateY(-1px);
}

.toolbar-btn:active {
  transform: translateY(0);
}

.editor-panel textarea {
  width: 100%;
  min-height: 400px;
  padding: 1rem;
  border: 1px solid #fbcfe8;
  border-radius: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  resize: vertical;
}

.editor-panel textarea:focus {
  outline: none;
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.preview-panel {
  overflow-y: auto;
  max-height: 500px;
}

/* Heart Rating */
.heart-rating {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  align-items: center;
  margin: 0.5rem 0;
}

.heart-rating .heart {
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s;
  filter: grayscale(100%);
  opacity: 0.5;
}

.heart-rating .heart:hover {
  transform: scale(1.2);
  filter: grayscale(0%);
  opacity: 1;
}

.heart-rating .heart.active {
  filter: grayscale(0%);
  opacity: 1;
}

.heart-rating .heart:not(.active) {
  filter: grayscale(100%);
  opacity: 0.5;
}

.preview-content {
  line-height: 1.8;
}

.preview-content h2 {
  color: #9f1239;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.preview-content h3 {
  color: #be185d;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.preview-content a {
  color: #ec4899;
  text-decoration: underline;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #fbcfe8;
  border-radius: 0.5rem;
  font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.rankings-form {
  background-color: #fdf2f8;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.rankings-form h3 {
  font-size: 1.125rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 1rem;
}

.rankings-grid-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.rankings-grid-form input {
  width: 100%;
}

.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
}

/* Login page */
.login-container {
  max-width: 400px;
  margin: 4rem auto;
}

.login-card {
  background: white;
  border-radius: 0.5rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.login-card h1 {
  font-size: 2rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-card .btn {
  width: 100%;
}

/* TMDB Search */
.tmdb-search {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tmdb-search h3 {
  font-size: 1.125rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 1rem;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.drama-result {
  border: 2px solid #fbcfe8;
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.drama-result:hover {
  background-color: #fdf2f8;
  border-color: #ec4899;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.drama-result.selected {
  background-color: #fce7f3;
  border-color: #ec4899;
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.drama-result img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}

.drama-result h4 {
  font-size: 1rem;
  font-weight: bold;
  color: #9f1239;
  margin: 0.5rem 0;
}

/* Gemini Assistant */
.gemini-assistant {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gemini-assistant h3 {
  font-size: 1.125rem;
  font-weight: bold;
  color: #9f1239;
  margin-bottom: 1rem;
}

.gemini-assistant textarea {
  width: 100%;
  min-height: 150px;
  padding: 0.75rem;
  border: 1px solid #fbcfe8;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  resize: vertical;
}

.gemini-assistant .btn {
  margin-right: 0.5rem;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

/* Emoji images */
.emoji-large {
  width: 80px;
  height: 80px;
  object-fit: contain;
  animation: float 3s ease-in-out infinite;
}

.emoji-medium {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.emoji-small {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.hero-emoji-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.hero-emoji-container img {
  animation-delay: calc(var(--i) * 0.2s);
}

/* Responsive */
@media (max-width: 768px) {
  .editor-container {
    grid-template-columns: 1fr;
  }
  
  .rankings-grid,
  .rankings-grid-form {
    grid-template-columns: 1fr;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  nav .container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .emoji-large {
    width: 60px;
    height: 60px;
  }
  
  .hero-emoji-container {
    gap: 0.5rem;
  }
}

