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

:root {
  --primary: #5865F2;
  --secondary: #1a1a1a;
  --dark: #0f0f0f;
  --light: #1e1e1e;
  --border: #3a3a3a;
  --success: #43b581;
  --danger: #f04747;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: #121212;
  color: #e0e0e0;
}

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

/* Wider content region for data-heavy log screens */
.logs-page-container {
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 20px;
}

/* Navbar */
.navbar {
  background: #1a1a1a;
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand h1 {
  font-size: 1.5rem;
  color: var(--primary);
}

.navbar-menu {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.navbar-menu a {
  text-decoration: none;
  color: #e0e0e0;
  transition: color 0.3s;
}

.navbar-menu a:hover {
  color: var(--primary);
}

.btn-logout {
  background: var(--danger);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

.btn-logout:hover {
  background: #d83c3a;
  color: white;
}

/* User Profile Dropdown */
.user-profile-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-right: 15px;
}

.user-profile-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  transition: background 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
  user-select: none;
}

.user-profile-toggle:hover {
  background: rgba(88, 101, 242, 0.1);
  border-color: #5865f2;
}

#user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #444;
  border: 2px solid #555;
  object-fit: cover;
}

.user-profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  min-width: 200px;
  display: none;
}

.user-profile-dropdown-menu.active {
  display: block;
}

.user-profile-dropdown-menu a {
  display: block;
  padding: 12px 16px;
  color: #e0e0e0;
  text-decoration: none;
  transition: all 0.2s ease;
  border-bottom: 1px solid #333;
  cursor: pointer;
}

.user-profile-dropdown-menu a:last-child {
  border-bottom: none;
}

.user-profile-dropdown-menu a:hover {
  background: #3a3a3a;
  color: #5865f2;
}

.user-profile-dropdown-menu .logout-link {
  color: #ff6b6b;
}

.user-profile-dropdown-menu .logout-link:hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff8787;
}

/* Login Page */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #7289DA 100%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-box {
  background: #1e1e1e;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.login-box h1 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.login-box p {
  color: #b0b0b0;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.login-info {
  margin-top: 2rem !important;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem !important;
  color: #909090 !important;
}

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

.btn:hover {
  background: #4752C4;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3);
}

.btn-secondary {
  background: #3a3a3a;
  color: #e0e0e0;
}

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

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-discord {
  width: 100%;
  font-size: 1.1rem;
}

/* Dashboard */
.dashboard {
  padding: 3rem 0;
}

.dashboard h2 {
  margin-bottom: 1rem;
  color: #e0e0e0;
}

.dashboard p {
  color: #b0b0b0;
  margin-bottom: 2rem;
}

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

.module-card {
  background: #1e1e1e;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.3s;
}

.module-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  transform: translateY(-4px);
}

.module-card h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.module-card p {
  color: #b0b0b0;
  margin-bottom: 1.5rem;
}

/* Groups Section */
.groups-section {
  padding: 2rem 0;
}

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

.section-header h2 {
  color: #e0e0e0;
}

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

.group-card {
  background: #1e1e1e;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.3s;
}

.group-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  transform: translateY(-2px);
}

.group-card h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.group-card p {
  color: #b0b0b0;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.group-members {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.group-members p {
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #e0e0e0;
}

.member-list {
  font-size: 0.85rem;
  color: #909090;
}

.group-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.group-actions .btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.9rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal:not(.hidden) {
  display: flex;
}

.modal-content {
  background: #1e1e1e;
  border-radius: 8px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  color: #e0e0e0;
}

.modal-content h3 {
  color: #e0e0e0;
  margin-bottom: 1.5rem;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-content input,
.modal-content textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  background: #252525;
  color: #e0e0e0;
}

.modal-content input:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

.modal-content button {
  padding: 0.75rem;
}

.hidden {
  display: none !important;
}

/* Message */
.message {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.message.success {
  background: #1a3a1a;
  color: #6cD96c;
  border: 1px solid #4a7a4a;
}

.message.error {
  background: #3a1a1a;
  color: #ff6b6b;
  border: 1px solid #7a4a4a;
}

/* Modal Large */
.modal-lg {
  max-width: 700px !important;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-xl {
  max-width: 90vw !important;
  width: 90vw !important;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
}

.modal-large {
  max-width: 900px !important;
  width: 95% !important;
  max-height: 90vh !important;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #909090;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #e0e0e0;
}

/* Form Sections */
.form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section h4 {
  color: #e0e0e0;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #e0e0e0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.form-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.form-group input,
.form-group textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  background: #252525;
  color: #e0e0e0;
}

.form-group select {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  background: #252525;
  color: #e0e0e0;
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Discord Lookup */
.discord-lookup {
  position: relative;
}

.discord-lookup input {
  width: 100%;
}

.lookup-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1e1e1e;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
}

.lookup-results.hidden {
  display: none;
}

.lookup-result-item {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #e0e0e0;
}

.lookup-result-item:last-child {
  border-bottom: none;
}

.lookup-result-item:hover {
  background: #2a2a2a;
}

.lookup-result-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.lookup-result-info {
  flex: 1;
}

.lookup-result-username {
  font-weight: 600;
  color: #e0e0e0;
}

.lookup-result-id {
  font-size: 0.85rem;
  color: #909090;
}

.selected-user {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: #2a3a4a;
  border: 1px solid var(--primary);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.selected-user.hidden {
  display: none;
}

.selected-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.selected-user-info {
  flex: 1;
}

.selected-user-name {
  font-weight: 500;
  color: #e0e0e0;
}

.selected-user-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  margin-left: 0.25rem;
}

/* Resident Tags */
.resident-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.resident-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  font-size: 0.85rem;
}

.resident-tag-remove {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}

/* File Upload */
.file-upload {
  border: 2px dashed var(--border);
  border-radius: 4px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #252525;
  color: #e0e0e0;
}

.file-upload:hover {
  border-color: var(--primary);
  background: #2a3a4a;
}

.file-upload input[type="file"] {
  display: none;
}

.file-upload.active {
  border-color: var(--primary);
  background: #2a3a4a;
}

.image-preview {
  margin-top: 1rem;
}

.image-preview.hidden {
  display: none;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.form-actions .btn {
  flex: 1;
}

.modal-footer .form-actions {
  margin: 0;
  padding: 0;
  border: none;
}

.btn-primary {
  background: var(--primary);
}

.btn-primary:hover {
  background: #4752C4;
}

.btn-danger {
  background: #ef4444;
}

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

/* Modal Body & Footer */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 1rem 1rem 1rem;
}

.modal-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

.modal-footer .btn {
  min-width: 120px;
}

.view-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.view-section:last-of-type {
  border-bottom: none;
}

.view-section h4 {
  color: #e0e0e0;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.view-section p {
  margin: 0.5rem 0;
  color: #e0e0e0;
}

#view-group-logo {
  margin-bottom: 1.5rem;
  text-align: center;
}

#view-group-logo img {
  max-width: 100%;
  max-height: 250px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.residents-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.resident-item {
  padding: 0.5rem 0.75rem;
  background: #2a3a4a;
  border: 1px solid var(--primary);
  border-radius: 4px;
  font-size: 0.9rem;
  color: #a0d0ff;
}

/* Strikes System */
.strikes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.strike-card {
  background: #2a1a1a;
  border-left: 4px solid #f04747;
  border-radius: 4px;
  padding: 1rem;
  position: relative;
}

.strike-card.removed {
  border-left-color: #909090;
  opacity: 0.7;
}

.strike-card::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 30px;
  height: 30px;
  background: #f04747;
  border-radius: 0 4px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  color: white;
  opacity: 0.3;
}

.strike-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.strike-person {
  font-weight: 600;
  color: #f04747;
  font-size: 1rem;
}

.strike-meta {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.strike-reason {
  background: #1a1a1a;
  padding: 0.75rem;
  border-radius: 4px;
  border-left: 2px solid #f04747;
  color: #d0d0d0;
  margin: 0.75rem 0;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.strike-removal-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #444;
  font-size: 0.85rem;
  color: #888;
}

.strike-removal-section strong {
  color: #a0a0a0;
}

.strike-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.strike-actions .btn {
  flex: 1;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.residents-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.view-content-box {
  white-space: pre-wrap;
  background: #1a1a1a;
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: #b0b0b0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 2.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .logs-page-container {
    padding: 1rem 12px;
  }

  .navbar-menu {
    gap: 1rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

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

  .group-actions {
    flex-direction: column;
  }
}
