:root {
  --bg-color: #050505;
  --card-bg: #121212;
  --text-color: #f0f0f0;
  --accent-color: #bc13fe;
  --accent-hover: #d066ff;
  --secondary-text: #888;
  --border-radius: 8px;
  --box-shadow: 0 4px 15px rgba(188, 19, 254, 0.2);
  --header-height: 60px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  /* Prevent horizontal scroll */
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s;
}

a:hover {
  color: var(--accent-color);
}

/* Header */
header {
  background-color: var(--card-bg);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: var(--box-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent-color);
  text-shadow: 0 0 10px rgba(188, 19, 254, 0.5);
  letter-spacing: 1px;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

.nav-btn {
  padding: 0.5rem 1rem;
  background-color: var(--accent-color);
  color: white;
  border-radius: var(--border-radius);
}

.nav-btn:hover {
  background-color: var(--accent-hover);
  color: white;
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  min-height: calc(100vh - var(--header-height) - 100px);
  /* footer approx height */
}

/* Manga Grid */
.manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2rem;
}

/* Manga Card Redesign */
.manga-card {
  background-color: transparent;
  /* Clean look, maybe just image and text */
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: transform 0.3s;
  /* Remove box-shadow for cleaner look if preferred, or keep it subtle */
  box-shadow: none;
  height: 100%;
  /* Ensure full height in grid */
  display: flex;
  flex-direction: column;
}

/* Container for the card content to ensure equal height */
.manga-card-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
  /* slight bg to see card size */
  border-radius: 8px;
  padding: 10px;
  /* Internal padding */
  border: 1px solid #333;
}

.manga-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(188, 19, 254, 0.3);
}

.manga-cover {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid #222;
  transition: border-color 0.3s;
}

.manga-card:hover .manga-cover {
  border-color: var(--accent-color);
}

.manga-info {
  padding: 0.5rem 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.manga-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: white;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.manga-rating {
  color: #ffd700;
  /* Gold */
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chapter-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #333;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #ddd;
  transition: background-color 0.2s;
}

.chapter-btn:hover {
  background-color: #444;
  color: white;
}

.badge-new {
  background-color: #ff4757;
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 2px;
  margin-left: 5px;
  text-transform: uppercase;
}

/* Rating System */
.rating-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.star-rating {
  display: flex;
  flex-direction: row-reverse;
  /* Handle hover logic easily */
  gap: 5px;
}

.star-rating input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.star-rating label {
  font-size: 1.5rem;
  color: #444;
  cursor: pointer;
  transition: color 0.2s;
}

.star-rating input:checked~label,
.star-rating label:hover,
.star-rating label:hover~label {
  color: #ffd700;
}

.average-rating {
  font-size: 1.1rem;
  font-weight: bold;
  color: #ffd700;
}


/* Forms */
.auth-form {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--secondary-text);
}

.form-control {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #444;
  border-radius: 4px;
  background-color: #333;
  color: white;
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
}

.btn-submit {
  width: 100%;
  padding: 1rem;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(188, 19, 254, 0.3);
}

.btn-submit:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 0 20px rgba(188, 19, 254, 0.6);
  transform: translateY(-2px);
}

/* Footer */
footer {
  background-color: var(--card-bg);
  padding: 2rem;
  text-align: center;
  color: var(--secondary-text);
  margin-top: 3rem;
}

/* Alerts */
.alert {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: var(--border-radius);
}

.alert-error {
  background-color: rgba(255, 107, 107, 0.2);
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
}

.alert-success {
  background-color: rgba(75, 181, 67, 0.2);
  border: 1px solid #4bb543;
  color: #4bb543;
}

.badge-18 {
  background-color: #ff4757;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  vertical-align: middle;
}

/* Mobile Bottom Navigation */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--card-bg);
  border-top: 1px solid #333;
  z-index: 1000;
  justify-content: space-around;
  padding: 10px 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--secondary-text);
  text-decoration: none;
  font-size: 0.75rem;
  gap: 4px;
}

.bottom-nav-item i {
  font-size: 1.25rem;
}

.bottom-nav-item.active {
  color: var(--accent-color);
  text-shadow: 0 0 5px rgba(188, 19, 254, 0.5);
}

.bottom-nav-item.active span:first-child {
  filter: drop-shadow(0 0 5px var(--accent-color));
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  header nav {
    display: none;
    /* Hide top nav on mobile */
  }

  h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
  }

  .bottom-nav {
    display: flex;
  }

  .container {
    margin-top: 1rem;
    margin-bottom: 80px;
    /* Increased space for bottom nav */
    padding: 0 0.5rem;
    /* Reduce side padding on mobile */
  }

  .manga-grid {
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns on tablet/small laptops too maybe? or 3 is fine. */
    /* Let's keep 3 for tablet (768), but maybe tighter gap */
    gap: 1rem;
  }

  .manga-card-container {
    font-size: 0.85rem;
    padding: 5px;
    /* Reduce padding on mobile */
  }

  .manga-title {
    font-size: 0.8rem;
    /* Smaller font for mobile */
  }

  .chapter-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }

  /* Adjust Reader for mobile */
  .reader-container img {
    width: 100%;
  }

  .mobile-reader-nav {
    display: flex;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    padding: 5px 10px;
    justify-content: space-between;
    z-index: 99;
    backdrop-filter: blur(5px);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 10px;
    /* Ensure check padding */
  }

  .manga-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    /* Consistent gap */
  }

  /* Fix image sizing if needed */
  .manga-cover {
    aspect-ratio: 2/3;
    object-fit: cover;
  }

  h1 {
    font-size: 1.2rem;
    /* Smaller header */
  }
}

/* Custom Scrollbar for Neon Theme */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-color);
}