/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #1a1a2e;
  min-height: 100vh;
}

/* Navigation Bar */
.navbar {
  background-color: #16213e;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

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

.nav-logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #e94560;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

.nav-link:hover {
  color: #e94560;
  background-color: rgba(233, 69, 96, 0.1);
}

.nav-user {
  color: #4ecca3;
  padding: 0.5rem 1rem;
  font-weight: 600;
}

.flash-message {
  max-width: 1200px;
  margin: 1rem auto 0;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
}

.flash-success {
  background-color: #1f7a57;
}

.flash-error {
  background-color: #9f2f46;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: #e94560;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn:hover {
  background-color: #c73e54;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: #0f3460;
}

.btn-secondary:hover {
  background-color: #1a4a7a;
}

.btn-primary {
  background-color: #e94560;
}

/* Main Content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

h1 {
  color: #e94560;
  margin-bottom: 1.5rem;
  font-size: 2.5rem;
  text-align: center;
}

/* Home Page */
.home-page {
  text-align: center;
}

.faction-showcase {
  margin: 3rem 0;
}

.faction-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.faction-display img {
  max-width: 200px;
  max-height: 200px;
  object-fit: contain;
}

.character-left, .character-right {
  flex: 1;
  max-width: 250px;
}

.character-left a, .character-right a {
  text-decoration: none;
  color: inherit;
}

.character-left h3, .character-right h3 {
  color: #fff;
  margin-top: 1rem;
}

.faction-symbol {
  flex: 0 0 auto;
  text-align: center;
  padding: 2rem;
  background-color: #16213e;
  border-radius: 10px;
  min-width: 300px;
}

.faction-symbol h2 {
  color: #e94560;
  margin: 1rem 0;
}

.faction-info {
  color: #ccc;
  margin: 0.5rem 0;
}

.home-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}

.dashboard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0 2rem;
  color: #fff;
  background-color: #16213e;
  border-radius: 8px;
  padding: 1rem;
}

.auth-page {
  display: flex;
  justify-content: center;
}

.auth-form {
  width: 100%;
  max-width: 440px;
  display: grid;
  gap: 1.25rem;
  background-color: #16213e;
  border-radius: 10px;
  padding: 2rem;
}

.auth-form h1 {
  margin-bottom: 0;
}

/* Filter Section */
.filter-section {
  margin: 2rem 0;
  text-align: center;
}

.filter-form {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-input {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid #0f3460;
  border-radius: 4px;
  background-color: #16213e;
  color: #fff;
  min-width: 300px;
}

.search-input:focus {
  outline: none;
  border-color: #e94560;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  margin: 2rem 0;
  background-color: #16213e;
  border-radius: 10px;
  padding: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: #fff;
}

.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #0f3460;
}

.data-table th {
  background-color: #0f3460;
  color: #e94560;
  font-weight: 600;
}

.data-table th a {
  color: #e94560;
  text-decoration: none;
}

.data-table th a:hover {
  text-decoration: underline;
}

.data-table tr:hover {
  background-color: rgba(233, 69, 96, 0.05);
}

.table-avatar {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.character-link, .faction-link {
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.character-link:hover, .faction-link:hover {
  color: #e94560;
}

.faction-link {
  color: #4ecca3;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
}

.page-info {
  color: #fff;
  font-size: 1rem;
}

/* Factions Grid */
.factions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.faction-card {
  background-color: #16213e;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.faction-card:hover {
  transform: translateY(-5px);
}

.faction-card a {
  text-decoration: none;
  color: inherit;
  display: block;
  padding: 1.5rem;
}

.faction-card-image {
  text-align: center;
  margin-bottom: 1rem;
}

.faction-card-image img {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
}

.faction-card-content h3 {
  color: #e94560;
  margin-bottom: 0.5rem;
}

.faction-card-info {
  color: #ccc;
  margin: 0.25rem 0;
}

/* Character Detail Page */
.character-detail-page,
.faction-detail-page {
  padding: 1rem 0;
}

.back-link {
  display: inline-block;
  color: #4ecca3;
  text-decoration: none;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.back-link:hover {
  color: #e94560;
}

.character-detail,
.faction-detail {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background-color: #16213e;
  border-radius: 10px;
  padding: 2rem;
}

.character-detail-image {
  text-align: center;
}

.character-detail-image img {
  max-width: 300px;
  max-height: 400px;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid #e94560;
}

.character-detail-info h1,
.faction-detail-info h1 {
  text-align: left;
  margin-bottom: 0.5rem;
}

.character-id,
.faction-id {
  color: #888;
  margin-bottom: 1.5rem;
}

.character-stats,
.faction-stats {
  display: flex;
  gap: 2rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.stat-item {
  background-color: #0f3460;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  min-width: 150px;
}

.stat-label {
  display: block;
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  color: #e94560;
  font-size: 1.2rem;
  font-weight: 600;
}

.character-description,
.character-abilities,
.character-faction {
  margin: 1.5rem 0;
}

.edit-form {
  display: grid;
  gap: 1.25rem;
  background-color: #16213e;
  border-radius: 10px;
  padding: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field label {
  color: #e94560;
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #0f3460;
  border-radius: 6px;
  background-color: #0f3460;
  color: #fff;
  font: inherit;
}

.form-field textarea {
  min-height: 160px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #e94560;
}

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

.character-description h2,
.character-abilities h2,
.character-faction h2 {
  color: #e94560;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.character-description p {
  color: #ccc;
  line-height: 1.8;
}

.abilities-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.abilities-list li {
  background-color: #0f3460;
  color: #4ecca3;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

.faction-preview {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background-color: #0f3460;
  padding: 1.5rem;
  border-radius: 10px;
}

.faction-small-symbol {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.faction-preview-info h3 {
  margin-bottom: 0.5rem;
}

.faction-preview-info h3 a {
  color: #4ecca3;
  text-decoration: none;
}

.faction-preview-info h3 a:hover {
  color: #e94560;
}

.faction-preview-info p {
  color: #ccc;
  margin: 0.25rem 0;
}

/* Faction Detail Header */
.faction-detail-header {
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

.faction-detail-symbol {
  flex: 0 0 auto;
}

.faction-detail-symbol img {
  max-width: 200px;
  max-height: 200px;
  object-fit: contain;
}

.faction-detail-info {
  flex: 1;
}

/* Faction Characters */
.faction-characters {
  margin-top: 2rem;
}

.faction-characters h2 {
  color: #e94560;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.5rem;
}

.character-card {
  background-color: #0f3460;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.character-card:hover {
  transform: translateY(-5px);
}

.character-card a {
  text-decoration: none;
  color: inherit;
  display: block;
  padding: 1rem;
  text-align: center;
}

.character-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.character-card h3 {
  color: #e94560;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.character-role {
  color: #888;
  font-size: 0.9rem;
}

/* Error Page */
.error-page {
  text-align: center;
  padding: 4rem 2rem;
}

.error-container {
  background-color: #16213e;
  padding: 3rem;
  border-radius: 10px;
  display: inline-block;
}

.error-container h1 {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-container p {
  color: #ccc;
  margin-bottom: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-menu {
    gap: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  .faction-display {
    flex-direction: column;
    gap: 2rem;
  }

  .character-left, .character-right {
    max-width: 100%;
  }

  .faction-symbol {
    min-width: auto;
    width: 100%;
  }

  .home-actions {
    flex-direction: column;
    align-items: center;
  }

  .filter-form {
    flex-direction: column;
    align-items: center;
  }

  .search-input {
    width: 100%;
    max-width: 400px;
  }

  .data-table {
    font-size: 0.9rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.75rem 0.5rem;
  }

  .character-stats,
  .faction-stats {
    flex-direction: column;
    gap: 1rem;
  }

  .faction-detail-header {
    flex-direction: column;
    text-align: center;
  }

  .faction-detail-symbol {
    margin: 0 auto;
  }

  .faction-detail-info {
    text-align: center;
  }

  .faction-preview {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  main {
    padding: 1rem;
  }

  .navbar {
    padding: 1rem;
  }

  .nav-logo {
    font-size: 1.2rem;
  }

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

  .characters-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
