/* Base Styles */
body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background-color: #f9f9f9;
  color: #333;
}

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

/* Header and Navigation */
header {
  text-align: center;
}

.banner {
  margin-bottom: 10px;
}

.banner a {
  display: block;
  text-decoration: none;
}

.banner img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

nav {
  margin: 10px 0;
}

nav a {
  color: #333;
  text-decoration: none;
  padding: 5px 10px;
}

nav a:hover {
  text-decoration: underline;
}

/* Admin and Moderator Dashboard Styles */
.dashboard-section {
  margin: 20px 0;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-tabs {
  display: flex;
  border-bottom: 2px solid #eee;
  margin-bottom: 20px;
}

.tab-button {
  background: none;
  border: none;
  padding: 12px 24px;
  cursor: pointer;
  font-size: 16px;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
}

.tab-button:hover {
  background-color: #f5f5f5;
}

.tab-button.active {
  border-bottom-color: #007cba;
  color: #007cba;
  font-weight: bold;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.dashboard-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-left: 4px solid #007cba;
}

.dashboard-card h3 {
  margin-top: 0;
  color: #333;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

/* Status and Statistics */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  margin-left: 10px;
}

.status-badge.success { background: #d4edda; color: #155724; }
.status-badge.warning { background: #fff3cd; color: #856404; }
.status-badge.error { background: #f8d7da; color: #721c24; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin: 15px 0;
}

.stat-item {
  text-align: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.stat-number {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #007cba;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  margin-top: 5px;
}

/* Status Indicators */
.status-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.green { background-color: #28a745; }
.status-indicator.red { background-color: #dc3545; }
.status-indicator.yellow { background-color: #ffc107; }

/* Memory Items */
.memories-container {
  margin: 20px 0;
}

.memory-item {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 15px;
  transition: box-shadow 0.3s;
}

.memory-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.memory-item.admin {
  border-left: 4px solid #007cba;
}

.memory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.memory-meta {
  display: flex;
  gap: 15px;
  align-items: center;
  font-size: 14px;
}

.memory-status {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }

.memory-date {
  color: #666;
  font-size: 13px;
}

.memory-preview {
  margin: 10px 0;
}

.memory-text-preview {
  font-style: italic;
  color: #555;
  margin: 8px 0;
  line-height: 1.4;
}

.submitted-by, .modified-by {
  font-size: 12px;
  color: #888;
  margin: 4px 0;
}

.memory-actions {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

/* Buttons */
.btn-view, .btn-approve, .btn-reject, .btn-cancel {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-right: 8px;
  transition: background-color 0.3s;
}

.btn-view {
  background: #007cba;
  color: white;
}

.btn-view:hover {
  background: #005a85;
}

.btn-approve {
  background: #28a745;
  color: white;
}

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

.btn-reject {
  background: #dc3545;
  color: white;
}

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

.btn-cancel {
  background: #6c757d;
  color: white;
}

.btn-cancel:hover {
  background: #5a6268;
}

/* Controls */
.controls {
  display: flex;
  gap: 15px;
  margin: 15px 0;
  align-items: center;
  flex-wrap: wrap;
}

.controls button, .controls select {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}

.controls button:hover {
  background: #f8f9fa;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 20px 0;
}

.pagination button {
  padding: 8px 16px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
}

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

.pagination button:hover:not(:disabled) {
  background: #f8f9fa;
}

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

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal .close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.modal .close:hover {
  color: #333;
}

.memory-field {
  margin: 10px 0;
}

.memory-field strong {
  display: inline-block;
  width: 100px;
  color: #333;
}

.memory-text {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  border-left: 4px solid #007cba;
  margin: 10px 0;
  line-height: 1.6;
}

.modal-actions {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#rejection-reason {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 10px 0;
  min-height: 80px;
  resize: vertical;
}

/* Users List */
.users-container {
  margin: 20px 0;
}

.user-item {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info strong {
  display: block;
  margin-bottom: 4px;
}

.user-email {
  color: #666;
  font-size: 14px;
}

.user-meta {
  display: flex;
  gap: 15px;
  align-items: center;
  font-size: 13px;
}

.user-role {
  background: #e9ecef;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: bold;
}

/* Analytics */
.analytics-container {
  margin: 20px 0;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.analytics-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-left: 4px solid #28a745;
}

.analytics-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
  margin: 15px 0;
}

/* Activity Log */
.activity-log {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 15px;
  max-height: 300px;
  overflow-y: auto;
}

/* Loading and Error States */
.loading, .error, .no-results {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
}

.error {
  color: #dc3545;
  background: #f8d7da;
  border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .memory-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .memory-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls button, .controls select {
    width: 100%;
  }
  
  .user-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions button {
    width: 100%;
  }
}

#auth-link {
  font-weight: normal;
}

#auth-link.authenticated {
  font-weight: 500;
  color: #0056b3;
}

#auth-link:hover {
  text-decoration: underline;
}

hr {
  border: 0;
  height: 1px;
  background-color: #696969;
  margin: 10px 0;
}

/* Typography */
h1, h2, h3 {
  margin-bottom: 15px;
}

p {
  margin-bottom: 15px;
}

a {
  color: #0056b3;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.centered {
  text-align: center;
}

.small-text {
  font-size: 0.8rem;
  color: #666;
}

/* Home Page */
.intro-text {
  margin: 20px 0;
}

.candle-container {
  text-align: center;
  margin: 30px 0;
}

.random-victim-container {
  text-align: center;
  margin: 20px 0;
  font-size: 1.2rem;
  font-weight: bold;
}

/* Memorial Wall */
.memorial-intro {
  margin-bottom: 30px;
}

.people-wall {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin: 20px 0;
  background-color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.person-cell {
  padding: 4px 3px;
  border-bottom: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
  font-size: 0.75rem;
  text-align: center;
}

.person-cell:nth-child(4n) {
  border-right: none;
}

.person-cell a {
  color: #333;
  text-decoration: none;
  display: block;
  width: 100%;
}

.person-cell a:hover {
  text-decoration: underline;
  color: #0056b3;
}

.person-cell:hover {
  background-color: #f8f9fa;
}

.search-container {
  margin: 20px 0;
  display: flex;
  gap: 10px;
}

#search-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

button {
  padding: 8px 15px;
  background-color: #0056b3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background-color: #003d82;
}

button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.filter-container {
  margin: 15px 0;
}

.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  gap: 20px;
}

/* Victim Detail Page */
.victim-details {
  margin: 20px 0;
  padding: 20px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.person-details {
  margin: 20px 0;
  text-align: center;
}

.person-details p {
  margin-bottom: 2px;
}

.memories-section {
  margin: 30px 0;
}

.memory-card {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.memory-author {
  font-weight: bold;
  margin-bottom: 5px;
}

.memory-date {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 10px;
}

.memory-text {
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Form Styles */
.add-memory-section {
  margin: 30px 0;
  padding: 20px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.memory-form {
  margin-top: 20px;
}

.form-group {
  margin-bottom: 15px;
}

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

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
}

.form-buttons {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.submission-message {
  margin-top: 20px;
  padding: 15px;
  border-radius: 4px;
}

.submission-message.success {
  background-color: #d4edda;
  color: #155724;
}

.submission-message.error {
  background-color: #f8d7da;
  color: #721c24;
}


/* Loading indicator */
.loading {
  text-align: center;
  margin: 20px 0;
  color: #666;
}

/* Background loading indicator */
.background-loading {
  text-align: center;
  margin: 20px 0;
  padding: 10px;
  background-color: #f0f8ff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  color: #666;
  font-size: 0.9em;
}

.loading-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.loading-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
  font-size: 1.2em;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Footer */
footer {
  text-align: center;
  margin: 30px 0 20px 0;
}

.memorial-footer {
  margin-bottom: 15px;
}

.memorial-footer img {
  max-width: 100%;
  height: auto;
}

/* Accessibility - Focus indicators */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #0056b3;
  outline-offset: 2px;
}

/* Enhanced focus for person links in memorial wall */
.person-cell a:focus {
  background-color: #e7f3ff;
  outline: 2px solid #0056b3;
  outline-offset: 1px;
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  .banner {
    margin-bottom: 15px;
  }
  
  .banner img {
    max-width: 95%;
  }
  
  .people-wall {
    grid-template-columns: repeat(3, 1fr);
    font-size: 0.8rem;
  }
  
  .person-cell {
    padding: 3px 2px;
    font-size: 0.7rem;
  }
  
  .person-cell:nth-child(4n) {
    border-right: 1px solid #e0e0e0;
  }
  
  .person-cell:nth-child(3n) {
    border-right: none;
  }
  
  .search-container {
    flex-direction: column;
  }
  
  button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 8px;
  }
  
  .banner img {
    max-width: 100%;
  }
  
  .people-wall {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .person-cell:nth-child(3n) {
    border-right: 1px solid #e0e0e0;
  }
  
  .person-cell:nth-child(2n) {
    border-right: none;
  }
}

/* Static Content Management Styles */
.static-wall-info {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 15px;
  margin: 15px 0;
  border-left: 4px solid #007cba;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  padding: 5px 0;
}

.info-item:not(:last-child) {
  border-bottom: 1px solid #e9ecef;
}

.info-item strong {
  color: #495057;
  font-weight: 600;
}

.button-group {
  display: flex;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.btn-primary {
  background-color: #007cba;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  background-color: #005a9e;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 124, 186, 0.2);
}

.btn-primary:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background-color: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(108, 117, 125, 0.2);
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Alert Styles */
.alert {
  padding: 15px;
  border-radius: 6px;
  margin: 15px 0;
  border-left: 4px solid;
}

.alert h4 {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 600;
}

.alert p {
  margin: 0;
  line-height: 1.5;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border-left-color: #28a745;
}

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

/* Benefits and Tips Lists */
.benefits-list {
  list-style: none;
  padding: 0;
  margin: 15px 0;
}

.benefits-list li {
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
  position: relative;
  padding-left: 20px;
}

.benefits-list li:last-child {
  border-bottom: none;
}

.benefits-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #28a745;
  font-weight: bold;
}

.generation-tips {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 15px;
  margin-top: 20px;
}

.generation-tips h4 {
  margin: 0 0 10px 0;
  color: #495057;
  font-size: 14px;
  font-weight: 600;
}

.generation-tips ul {
  margin: 0;
  padding-left: 20px;
}

.generation-tips li {
  margin: 5px 0;
  color: #6c757d;
  font-size: 14px;
}

/* Card Description */
.card-description {
  color: #6c757d;
  font-size: 14px;
  line-height: 1.5;
  margin: 10px 0 20px 0;
}

/* Status Indicator Text Styles */
.status-indicator:not(.green):not(.red):not(.yellow) {
  background-color: #6c757d;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  width: auto;
  height: auto;
}

/* Responsive Design for Static Content */
@media (max-width: 768px) {
  .button-group {
    flex-direction: column;
  }
  
  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
  
  .info-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}