:root {
  --primary-color: #800000;
  --secondary-color: #333333;
  --background-color: #f4f1e8;
  --text-color: #2b2b2b;
  --border-color: #999999;
  --header-bg: #444444;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --card-bg: #ffffff;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

body {
  font-family: 'Courier New', 'Courier', monospace;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

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

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

/* Header */
header {
  background: linear-gradient(to bottom, var(--header-bg), #2b2b2b);
  color: white;
  padding: 20px 0;
  border-bottom: 4px solid var(--primary-color);
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

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

.site-logo {
  font-size: 24px;
  font-weight: bold;
  text-decoration: none;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-logo::before {
  content: "███";
  color: var(--primary-color);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
  align-items: center;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  transition: all 0.3s;
}

nav a:hover {
  background: rgba(255,255,255,0.1);
}

.nav-btn {
  background: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.nav-btn:hover {
  background: #600000;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.3s;
}

.btn:hover {
  background: #600000;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
  background: var(--secondary-color);
}

.btn-secondary:hover {
  background: #222;
}

.btn-success {
  background: var(--success-color);
}

.btn-success:hover {
  background: #218838;
}

.btn-danger {
  background: var(--danger-color);
}

.btn-danger:hover {
  background: #c82333;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
  color: var(--primary-color);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Grid */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Character Card */
.character-card {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  padding: 15px;
  transition: all 0.3s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.character-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  border-color: var(--primary-color);
}

.character-avatar {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 10px;
  background: var(--border-color);
}

.character-codename {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.character-name {
  font-size: 14px;
  color: var(--secondary-color);
  margin-bottom: 10px;
}

.character-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #666;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: 10px;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  background: var(--secondary-color);
  color: white;
  border-radius: 3px;
  font-size: 11px;
  text-decoration: none;
}

.tag:hover {
  background: var(--primary-color);
}

/* Alerts */
.alert {
  padding: 15px;
  margin-bottom: 20px;
  border: 2px solid;
  border-radius: 4px;
  position: relative;
}

.alert-success {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.alert-error {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.alert-info {
  background: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.alert-warning {
  background: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.alert-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: inherit;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 4px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 20px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--secondary-color);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--primary-color);
}

.spinner {
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--secondary-color);
  color: white;
  font-weight: bold;
}

tr:hover {
  background: rgba(0,0,0,0.02);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.pagination button {
  padding: 8px 16px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.pagination button:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 15px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 4px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-size: 12px;
  font-weight: bold;
}

.filter-group select,
.filter-group input {
  padding: 8px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  font-family: inherit;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color), #600000);
  color: white;
  padding: 60px 20px;
  text-align: center;
  margin-bottom: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.hero h1 {
  font-size: 48px;
  margin-bottom: 20px;
}

.hero p {
  font-size: 20px;
  margin-bottom: 30px;
}

/* Footer */
footer {
  background: var(--header-bg);
  color: white;
  text-align: center;
  padding: 30px 20px;
  margin-top: 60px;
  border-top: 4px solid var(--primary-color);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 20px;
  }

  nav ul {
    flex-direction: column;
    gap: 10px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
  }
}
