body {
  font-family: Arial, sans-serif;
  background: #f6f7f8;
  margin: 0;
  padding: 0;
  color: #333;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Mode Styles */
body.dark-mode {
  background-color: #0d1a29; /* Darker saturated navy */
  color: #e0e8f0; /* Lighter blue-gray text */
}

body.dark-mode header {
  background: #152a44; /* Slightly lighter navy for header */
}

body.dark-mode header h1 {
  color: #e0e8f0;
}

body.dark-mode .subreddit-input-group {
  background: #132236; /* Darker navy for input container */
  border-color: #334d66; /* Matching blue-gray border */
}

body.dark-mode .subreddit-input-group input {
  background: #132236;
  color: #e0e8f0;
}

body.dark-mode .subreddit-prefix {
  color: white;
}

body.dark-mode .submission-form {
  background: #0d1a29;
  box-shadow: 0 2px 4px rgba(255,255,255,0.1);
}

body.dark-mode .submission-form h2 {
  color: #e0e8f0;
}

body.dark-mode .submission-form input,
body.dark-mode .submission-form textarea {
  background: #132236;
  border-color: #334d66;
  color: #e0e8f0;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #a0b0c0;
}

body.dark-mode #submitBtn,
body.dark-mode #loadDataBtn {
  background-color: #2a415a;
  color: white;
}

body.dark-mode #submitBtn:hover:not(:disabled),
body.dark-mode #loadDataBtn:hover:not(:disabled) {
  background-color: #3c5d7a;
}

body.dark-mode #submitBtn:disabled,
body.dark-mode #loadDataBtn:disabled {
  background-color: #20354e;
  color: #a0b0c0;
  cursor: not-allowed;
}

body.dark-mode .simulation-output {
  background: #0d1a29;
  box-shadow: 0 2px 4px rgba(255,255,255,0.1);
}

header {
  background: #ff4500;
  padding: 1.5em 1em;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header h1 {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 2.2em;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  margin: 0 0 0.4em 0;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
  padding: 0.3em 0;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
  position: absolute;
  top: 1.5em;
  right: 1.5em;
}

/* Smaller Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px; /* Smaller width */
  height: 24px; /* Smaller height */
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
  overflow: hidden; /* Hide symbols that are out of bounds */
}

/* Day Mode Symbols (Sun) */
.slider:before {
  position: absolute;
  content: "☀︎";
  font-size: 1.2em;
  color: #ffcc00;
  height: 18px; 
  width: 18px; 
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-transition: .4s;
  transition: .4s;
  z-index: 2;
}

/* Night Mode Symbols (Moon) */
.slider:after {
  content: " ";
  font-size: 1.2em;
  color: white;
  position: absolute;
  right: 3px;
  top: 3px;
  opacity: 0; /* Initially hidden */
  transition: opacity 0.4s ease;
  z-index: 1;
}

/* When checked (dark mode) */
input:checked + .slider {
  background-color: #2a415a; /* Night sky color */
}

input:checked + .slider:before {
  -webkit-transform: translateX(16px);
  -ms-transform: translateX(16px);
  transform: translateX(16px);
  content: "☾"; /* Change content to moon */
  color: white;
  background-color: transparent;
}

input:checked + .slider:after {
  opacity: 1; /* Show moon symbol */
}


input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

.slider.round {
  border-radius: 24px;
}

/* Style the new container for the prefix and input */
.subreddit-input-group {
  display: flex;
  width: 60%;
  margin: 0 auto;
  padding: 0.5em;
  background: white;
  border-radius: 4px;
  border: 1px solid #ccc;
}

/* Style the "r/" prefix */
.subreddit-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.5em;
  color: #555;
  font-size: 1em;
  font-weight: bold;
}

/* Style the input field inside the group */
.subreddit-input-group input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0;
  font-size: 1em;
}

/* Add a hover/focus effect to the entire group */
.subreddit-input-group:focus-within {
  box-shadow: 0 0 0 2px rgba(0, 121, 211, 0.5);
  border-color: #0079d3;
}

main {
  padding: 2em;
  max-width: 800px;
  margin: auto;
}

.submission-form {
  background: white;
  padding: 1.5em;
  padding-right: 3.5em;
  border-radius: 8px;
  margin-bottom: 2em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.submission-form h2 {
  font-size: 1.5em;
  color: #333;
  margin-bottom: 1em;
}

/* New CSS for the submission field group */
.submission-field-group {
  display: flex;
  flex-direction: column;
  margin-top: 0.8em;
}

/* New CSS to handle the containers for the title and content inputs */
.input-with-asterisk-container {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}

input::placeholder,
textarea::placeholder {
  font-family: Arial, sans-serif;
  font-size: 1em;
  color: #888;
}

/* Style for the red asterisk */
.required-asterisk {
  color: red;
  font-size: 1.2em;
  font-weight: bold;
  margin-top: 0.2em;
}

/* Style for the character counter */
.char-counter {
  font-size: 0.8em;
  color: #888;
  text-align: right;
  margin-top: 0.2em;
}

.submission-form input,
.submission-form textarea {
  flex-grow: 1;
  display: block;
  width: auto;
  padding: 1em;
  font-size: 1em;
  border-radius: 4px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.submission-form textarea {
  min-height: 5em;
  resize: vertical;
  overflow: auto;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  align-items: center;
  margin-top: 1em;
}

.meta-row input {
  flex: 1;
  padding: 0.8em;
}

#submitBtn,
#loadDataBtn {
  margin-top: 1.5em;
  padding: 0.8em 1.5em;
  background-color: #0079d3;
  color: white;
  font-size: 1em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#submitBtn:hover:not(:disabled),
#loadDataBtn:hover:not(:disabled) {
  background-color: #005a96;
}

#submitBtn:disabled,
#loadDataBtn:disabled {
  background-color: lightgray;
  cursor: not-allowed;
}

.simulation-output {
  background: #fff;
  padding: 1.5em;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.post-preview {
  display: flex;
  align-items: flex-start; /* Aligns items to the top */
  margin-top: 1em;
  padding: 1em;
  border-top: 1px solid #ddd;
}

.score-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px; /* Spacing between the buttons and score */
  width: auto;
  text-align: center;
  margin-right: 15px;
}

.score-container .score {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-color, #333);
  margin: 0;
}

.upvote-btn,
.downvote-btn {
  cursor: pointer;
  padding: 5px;
  transition: color 0.2s ease-in-out;
}

/* Hover and active states for upvote and downvote */
.upvote-btn:hover {
  color: #ff4500; /* Reddit orange */
}

.downvote-btn:hover {
  color: #7193ff; /* Reddit blue */
}

/* Optional: Active state when clicked */
.upvote-btn:active {
  color: #ff4500;
}

.downvote-btn:active {
  color: #7193ff;
}

/* Username Flair Bubble Styles */
.username-flair {
  display: inline-block;
  background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
  color: white;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
  margin: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  animation: flairGlow 2s ease-in-out infinite alternate;
}

/* Submission Flair Bubble Styles */
.submission-flair {
  display: inline-block;
  background: linear-gradient(135deg, #9b59b6, #3498db);
  color: white;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.9em;
  font-weight: 600;
  margin: 0 6px 0 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  animation: submissionFlairGlow 2.5s ease-in-out infinite alternate;
}

/* NSFW Tag Styles */
.nsfw-tag {
  display: inline-block;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.8em;
  font-weight: bold;
  margin: 0 0 0 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  animation: nsfwPulse 1.5s ease-in-out infinite alternate;
}

/* Dark Mode Styles */
body.dark-mode .username-flair {
  background: linear-gradient(135deg, #e74c3c, #3498db);
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.1);
  animation: flairGlowDark 2s ease-in-out infinite alternate;
}

body.dark-mode .submission-flair {
  background: linear-gradient(135deg, #8e44ad, #2980b9);
  box-shadow: 0 2px 7px rgba(255, 255, 255, 0.15);
  animation: submissionFlairGlowDark 2.5s ease-in-out infinite alternate;
}

body.dark-mode .nsfw-tag {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.2);
  animation: nsfwPulseDark 1.5s ease-in-out infinite alternate;
}

/* Meta Container for Better Layout */
.post-meta {
  line-height: 1.6;
}

.post-meta-line {
  display: block;
  margin: 2px 0;
}

/* Light Mode Animations */
@keyframes flairGlow {
  from {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }
  to {
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
  }
}

@keyframes submissionFlairGlow {
  from {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  }
  to {
    box-shadow: 0 2px 10px rgba(155, 89, 182, 0.5);
  }
}

@keyframes nsfwPulse {
  from {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
  to {
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.6);
  }
}

/* Dark Mode Animations */
@keyframes flairGlowDark {
  from {
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.1);
  }
  to {
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.3);
  }
}

@keyframes submissionFlairGlowDark {
  from {
    box-shadow: 0 2px 7px rgba(255, 255, 255, 0.15);
  }
  to {
    box-shadow: 0 2px 12px rgba(142, 68, 173, 0.4);
  }
}

@keyframes nsfwPulseDark {
  from {
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.2);
  }
  to {
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.5);
  }
}