/* Reset and Base Styles */
:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --border: #a2a9b1;
  --border-light: #c8ccd1;
  --text: #202122;
  --text-secondary: #54595d;
  --link: #0645ad;
  --link-visited: #0b0080;
  --link-hover: #0b0080;
  --highlight: #eaecf0;
  --danger: #8b0000;
  --warning: #fc3;
  --success: #14866d;
  --gore: #4a0000;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* Content Warning Overlay */
.content-warning-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.content-warning-box {
  max-width: 600px;
  background: #1a0000;
  border: 3px solid #8b0000;
  padding: 40px;
  text-align: center;
  border-radius: 10px;
}

.content-warning-box h1 {
  color: #ff4444;
  font-size: 32px;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.content-warning-box p {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 16px;
  color: #ddd;
}

.content-warning-box ul {
  text-align: left;
  margin: 20px auto;
  max-width: 400px;
  color: #ff6666;
  list-style-position: inside;
}

.content-warning-box li {
  margin: 8px 0;
}

.warning-buttons {
  margin-top: 30px;
  display: flex;
  gap: 16px;
  justify-content: center;
}

.warning-btn {
  padding: 14px 28px;
  font-size: 16px;
  font-weight: bold;
  border: 2px solid;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 5px;
}

.warning-btn.accept {
  background: #8b0000;
  color: white;
  border-color: #ff4444;
}

.warning-btn.accept:hover {
  background: #a00000;
}

.warning-btn.decline {
  background: transparent;
  color: #888;
  border-color: #444;
}

.warning-btn.decline:hover {
  background: #222;
}

/* Header */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-section i {
  font-size: 24px;
  color: #8b0000;
}

.logo {
  font-size: 20px;
  font-weight: bold;
  color: var(--text);
  text-decoration: none;
  font-family: "Courier New", monospace;
  letter-spacing: 1px;
}

.header-nav {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 14px;
}

.header-nav a,
.header-nav button {
  color: var(--link);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 5px;
  transition: all 0.2s;
}

.header-nav a:hover,
.header-nav button:hover {
  background: var(--highlight);
  text-decoration: none;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.username {
  font-weight: bold;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--highlight);
}

/* Main Layout */
main {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 80px;
  height: fit-content;
}

.sidebar-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
  border-radius: 8px;
  font-size: 13px;
}

.sidebar-title {
  background: var(--highlight);
  padding: 10px 12px;
  font-weight: bold;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px 8px 0 0;
}

.sidebar-content {
  padding: 12px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--link);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 5px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.sidebar-link:hover {
  background: var(--highlight);
  text-decoration: none;
}

.mail-badge {
  background: #8b0000;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  margin-left: auto;
}

/* Article/Entity View */
article {
  background: var(--bg);
  min-height: 600px;
}

#entityView {
  padding: 20px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
  background-color: var(--bg);
  margin: 5% auto;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content.large {
  max-width: 800px;
}

.close {
  color: var(--text-secondary);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: var(--danger);
}

.modal-content h2 {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

/* Form Styles */
.form-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  border-radius: 5px;
  font-weight: bold;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: var(--highlight);
}

.tab-btn.active {
  background: var(--link);
  color: white;
  border-color: var(--link);
}

.form-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-input {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--link);
}

.form-btn {
  padding: 12px 20px;
  background: var(--link);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

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

/* Settings Sections */
.settings-section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.settings-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  color: var(--text);
}

.profile-info {
  background: var(--bg-secondary);
  padding: 15px;
  border-radius: 5px;
  border: 1px solid var(--border-light);
}

.profile-info p {
  margin: 8px 0;
  font-size: 14px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  margin-left: 6px;
}

.badge.verified {
  background: #1da1f2;
  color: white;
}

.badge.admin {
  background: #8b0000;
  color: white;
}

.badge.owner {
  background: #ffd700;
  color: #000;
}

/* Offense List */
#offensesList {
  max-height: 300px;
  overflow-y: auto;
}

.offense-item {
  background: #fff5f5;
  border: 1px solid var(--danger);
  border-left: 4px solid var(--danger);
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 5px;
}

.offense-item h4 {
  color: var(--danger);
  margin-bottom: 6px;
}

.offense-item p {
  font-size: 13px;
  margin: 4px 0;
}

.no-offenses {
  text-align: center;
  color: var(--success);
  padding: 20px;
  background: #e6f5f1;
  border-radius: 5px;
}

/* Mail Items */
.mail-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  padding: 15px;
  margin-bottom: 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.mail-item:hover {
  background: var(--highlight);
}

.mail-item.unread {
  border-left: 4px solid var(--link);
  font-weight: bold;
}

.mail-item.warning {
  border-left: 4px solid var(--danger);
  background: #fff5f5;
}

.mail-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mail-subject {
  font-weight: bold;
  color: var(--text);
}

.mail-date {
  color: var(--text-secondary);
  font-size: 12px;
}

.mail-body {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Comment Section */
.comment-section {
  margin-top: 20px;
}

.comment-input-area {
  margin-bottom: 20px;
}

.comment-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  padding: 15px;
  margin-bottom: 12px;
  border-radius: 5px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.comment-author {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comment-date {
  color: var(--text-secondary);
  font-size: 12px;
}

.comment-body {
  color: var(--text);
  line-height: 1.6;
}

.comment-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.comment-actions button {
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.comment-actions button:hover {
  background: var(--highlight);
}

/* About Content */
.about-content {
  line-height: 1.8;
}

.about-content h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 10px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

.license-text {
  background: var(--bg-secondary);
  padding: 12px;
  border-left: 4px solid var(--danger);
  margin: 10px 0;
  border-radius: 5px;
  font-size: 13px;
}

/* Owner Panel */
.owner-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg);
  border: 2px solid #ffd700;
  border-radius: 10px;
  padding: 20px;
  width: 400px;
  max-height: 600px;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.owner-panel h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffd700;
  margin-bottom: 15px;
}

.panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.panel-tabs button {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.panel-tabs button:hover {
  background: var(--highlight);
}

/* Responsive */
@media (max-width: 968px) {
  main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    top: 0;
  }

  .owner-panel {
    width: 90%;
    right: 5%;
  }
}

/* Utility Classes */
.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-muted {
  color: var(--text-secondary);
}

.hidden {
  display: none !important;
}

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

.loading i {
  font-size: 32px;
  animation: spin 1s linear infinite;
}

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

/* Alert Messages */
.alert {
  padding: 12px 16px;
  border-radius: 5px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert.success {
  background: #e6f5f1;
  border: 1px solid var(--success);
  color: var(--success);
}

.alert.error {
  background: #fff5f5;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.alert.warning {
  background: #fef6e7;
  border: 1px solid var(--warning);
  color: #996600;
}

.alert.info {
  background: #e6f5ff;
  border: 1px solid var(--link);
  color: var(--link);
}

/* Redacted Text - Hover to Reveal */
.redacted {
  background: #000;
  color: transparent;
  padding: 2px 8px;
  user-select: none;
  cursor: help;
  transition: all 0.3s ease;
  border-radius: 3px;
  display: inline-block;
  position: relative;
  border: 1px solid #333;
}

.redacted::before {
  content: "█████████";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: #333;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
  letter-spacing: 2px;
}

.redacted:hover {
  background: #222;
  color: #fff;
  user-select: text;
  border-color: #666;
}

.redacted:hover::before {
  opacity: 0;
}