/* Modern styles for the writing app */
:root {
  --primary-color: #3498db;
  --secondary-color: #2c3e50;
  --background-color: #ecf0f1;
  --text-color: #34495e;
  --error-color: #e74c3c;
  --success-color: #2ecc71;
}

body {
  font-family: 'Lato', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#header, #workspace {
  padding: 2rem;
}

#header {
  background-color: var(--secondary-color);
  color: white;
  text-align: center;
}

#workspace {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-form {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.auth-form h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--secondary-color);
  text-align: center;
  font-size: 1.5rem;
  font-weight: normal;
  opacity: 0.8;
}

.auth-form form {
  display: flex;
  flex-direction: column;
}

.form-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-weight: bold;
}

.required {
  color: var(--error-color);
  font-weight: bold;
}

.optional {
  color: #666;
  font-weight: normal;
  font-style: italic;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
}

/* Specific styles for auth forms */
.auth-form .form-group {
  max-width: 100%;
}

.auth-form form {
  width: 100%;
}

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

/* Character Impact Styles */
.character-impact {
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: var(--background-color);
  border-radius: 4px;
}

.character-impact label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-weight: bold;
}

.character-impact textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
  resize: vertical;
  min-height: 60px;
  font-family: 'Lato', sans-serif;
}

.character-impact textarea::placeholder {
  color: #999;
  font-style: italic;
}

/* Specific styles for create story page */
.create-story .form-group {
  align-items: flex-start;
}

.create-story .form-group label {
  margin-bottom: 0.75rem;
}

.auth-form .btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  text-align: center;
}

.auth-form .btn:hover {
  background-color: #2980b9;
}

.form-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
}

.form-links a,
.form-links button {
  color: var(--primary-color);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  font: inherit;
  transition: color 0.3s ease;
}

.form-links a:hover,
.form-links button:hover {
  color: #2980b9;
}

.message {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  text-align: center;
}

.message.error {
  background-color: #fde8e8;
  color: var(--error-color);
  border: 1px solid var(--error-color);
}

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

/* Page Styles */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
}

.scene-actions,
.character-actions {
  background-color: var(--background-color);
  padding: 1rem;
  margin-bottom: 2rem;
}

.scene-actions ul,
.character-actions ul {
  display: flex;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: #2980b9;
}

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

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


.btn-danger:hover {
  background-color: #c0392b;
}

.scene-selector,
.character-selector {
  grid-column: 1 / -1;
  margin-bottom: 2rem;
}

.scene-selector select,
.character-selector select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Lato', sans-serif;
  margin-left: 1rem;
  min-width: 200px;
}

.scene-content,
.character-content,
.character-impacts {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  grid-column: 1 / 2;
  margin-bottom: 2rem;
}

.scene-content h2,
.character-content h2 {
  color: var(--secondary-color);
  font-family: 'Merriweather', serif;
  margin-top: 0;
}

.scene-purpose {
  color: var(--text-color);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.scene-text,
.character-description {
  line-height: 1.6;
  white-space: pre-wrap;
}

.character-impacts {
  background-color: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.character-impacts h3 {
  color: var(--secondary-color);
  margin-top: 0;
  font-family: 'Merriweather', serif;
}

.impact-link {
  color: var(--primary-color);
  text-decoration: none;
  display: block;
  padding: 0.5rem;
  margin: 0.5rem 0;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

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

/* Full Story Page Styles */
.full-story-page {
  max-width: none;
  display: block;
  padding: 0 2rem;
}

.story-stats {
  background-color: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-label {
  display: block;
  color: var(--text-color);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  display: block;
  color: var(--secondary-color);
  font-size: 1.5rem;
  font-weight: bold;
  font-family: 'Merriweather', serif;
}

.full-story {
  background-color: white;
  padding: 3rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
  min-width: 800px;
  width: 80%;
}

.story-section {
  margin-bottom: 2rem;
  line-height: 1.8;
  font-size: 1.1rem;
  color: var(--text-color);
}

.story-section:last-child {
  margin-bottom: 0;
}

/* Full Story Page Responsive Styles */
@media (max-width: 1024px) {
  .story-stats {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .full-story {
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  .full-story {
    padding: 1.5rem;
    width: 100%;
  }

  .story-section {
    width: 100%;
  }
}

/* Outline Page Styles */
.outline-container {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.outline-container h2 {
  color: var(--secondary-color);
  font-family: 'Merriweather', serif;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.outline-list {
  list-style-type: none;
  padding: 0;
}

.outline-item {
  background-color: var(--background-color);
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  transition: background-color 0.3s ease;
}

.outline-item:hover {
  background-color: #d5dbdb;
}

.scene-title {
  font-weight: bold;
  color: var(--secondary-color);
}

.scene-number {
  color: var(--text-color);
  font-size: 0.9rem;
}

/* Outline Page Mobile Styles */
@media (max-width: 768px) {
  .outline-container {
    padding: 1rem;
  }

  .outline-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .scene-number {
    margin-top: 0.5rem;
  }
}

.character-connections {
  background-color: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  grid-column: 2 / 3;
}

.character-connections h3 {
  color: var(--secondary-color);
  margin-top: 0;
}

.character-connections form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.character-connections textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Lato', sans-serif;
  resize: vertical;
}

.character-connections input[type="checkbox"] {
  margin-right: 0.5rem;
}

footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-color);
  background-color: white;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .character-connections {
    grid-column: 1 / 2;
  }

  .scene-actions ul {
    flex-direction: column;
  }

  .scene-actions li {
    width: 100%;
  }

  .scene-actions .btn {
    display: block;
    text-align: center;
  }

  .auth-form {
    padding: 1.5rem;
  }

  .form-group input[type="text"],
  .form-group input[type="password"],
  .form-group input[type="email"],
  .auth-form .btn {
    padding: 0.6rem;
  }
}

#topbar {
  background-color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img {
  height: 100px;
  width: auto;
}

.storytitle {
  font-family: 'Merriweather', serif;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--secondary-color);
}

.story-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-story-title {
  flex: 1;
}

.story-switch-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 1.2rem;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.story-switch-link:hover {
  background-color: rgba(52, 152, 219, 0.1);
  color: #2980b9;
}

.authoricon img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
}

nav ul {
  list-style-type: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

nav ul li a {
  color: var(--text-color);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

nav ul li a:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Scene Editor Layout */
.scene-editor-layout {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  max-width: 1400px;
  margin: 2rem auto 1rem;
  padding: 0 2rem;
}

/* Author's Notes Section */
.authors-notes {
  max-width: 1000px;
  width: 800px;
  margin: 0 auto 2rem;
  padding: 0 2rem;
  box-sizing: border-box;
}

.authors-notes h3 {
  color: var(--secondary-color);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.authors-notes textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  background-color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.authors-notes textarea::placeholder {
  color: #999;
  font-style: italic;
}

.scene-form {
  width: 800px;
  max-width: 1000px;
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.scene-form h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--secondary-color);
  text-align: center;
  font-size: 1.5rem;
  font-weight: normal;
  opacity: 0.8;
}

.character-selector {
  width: 300px;
  flex-shrink: 0; /* Prevent width from shrinking */
  background-color: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  height: fit-content;
  position: sticky;
  top: 2rem;
  align-self: flex-start;
}

.character-selector h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--secondary-color);
  font-size: 1.2rem;
}

#character-list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.character-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.character-item:hover {
  background-color: var(--background-color);
}

.character-item input[type="checkbox"] {
  margin-right: 0.75rem;
}

.character-item label {
  cursor: pointer;
  flex: 1;
}

@media (max-width: 1200px) {
  .scene-editor-layout {
    flex-direction: column-reverse;
    align-items: center;
  }

  .scene-form {
    width: 100%;
    max-width: 800px;
  }

  .character-selector {
    width: 100%;
    max-width: 800px;
    position: static;
  }

  .authors-notes {
    width: 100%;
    max-width: 800px;
  }
}

@media (max-width: 820px) {
  .scene-editor-layout {
    padding: 1rem;
  }

  .scene-form {
    width: calc(100% - 2rem);
    padding: 1rem;
  }

  .authors-notes {
    width: calc(100% - 2rem);
    padding: 1rem;
  }
}

@media (max-width: 600px) {
  .scene-editor-layout {
    padding: 0.5rem;
  }

  .scene-form {
    width: calc(100% - 1rem);
    padding: 0.5rem;
  }

  .authors-notes {
    width: calc(100% - 1rem);
    padding: 0.5rem;
  }

  #character-list {
    max-height: 300px;
  }
}

/* Scene Editor Styles */
.scene-form-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
}

.form-row {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
}

.form-group {
  flex: 1;
}

.form-input-small {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
}

.scene-editor {
  margin: 2rem 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.scene-editor textarea {
  flex: 1;
  min-height: unset;
  width: 100%;
  min-height: 500px;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-start;
  margin-top: 2rem;
}

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

.btn-secondary:hover {
  background-color: #2c3e50;
}

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 1rem;
  }

  .scene-editor textarea {
    min-height: 300px;
  }

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

  .form-actions .btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  #topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  nav ul {
    flex-direction: column;
    width: 100%;
  }

  nav ul li {
    width: 100%;
  }

  nav ul li a {
    display: block;
    padding: 0.75rem 1rem;
  }
}

/* Character Workspace */
.character-workspace {
  display: flex;
  max-width: 1400px;
  margin: 2rem auto;
  gap: 2rem;
}

.character-editor {
  flex: 1;
  width: 800px;
  max-width: 1000px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  box-sizing: border-box;
}

.character-stack {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  position: relative;
}

.character-tab {
  background-color: white;
  border-radius: 8px 0 0 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  border: 1px solid #ddd;
  border-right: none;
  margin-bottom: -0.5rem;
  z-index: 1;
}

.character-tab::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--primary-color);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.character-tab::after {
  content: '→';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  opacity: 0;
  transition: all 0.3s ease;
}

.character-tab:hover {
  transform: translateX(-10px);
  box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.1);
}

.character-tab:hover::before,
.character-tab:hover::after {
  opacity: 1;
}

.character-tab.active {
  background-color: white;
  transform: translateX(-10px);
  box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.1);
  border-right: none;
  z-index: 2;
}

.character-tab.active::before {
  opacity: 1;
}

.character-name {
  font-weight: bold;
  color: var(--secondary-color);
  display: block;
  padding-right: 1.5rem;
  position: relative;
}

.character-tab:not(.active) .character-name::after {
  content: '';
  position: absolute;
  left: -1rem;
  right: -1rem;
  bottom: -0.5rem;
  height: 1px;
  background: linear-gradient(to right, transparent, #ddd, transparent);
}

.add-character-tab {
  background-color: var(--primary-color);
  color: white;
  border-radius: 8px 0 0 8px;
  padding: 1rem;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  margin-top: 1rem;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-character-tab:hover {
  transform: translateX(-10px);
  background-color: #2980b9;
  box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.1);
}

.add-character-tab .character-name {
  color: white;
}

.add-character-tab::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  background-color: rgba(255, 255, 255, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.add-character-tab:hover::before {
  opacity: 1;
}

.character-content h2 {
  color: var(--secondary-color);
  font-family: 'Merriweather', serif;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.character-content .form-group {
  margin-bottom: 1.5rem;
}

.character-content label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-weight: bold;
}

.character-content input[type="text"],
.character-content textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: 'Lato', sans-serif;
}

.character-content textarea {
  resize: vertical;
}

.character-impacts {
  margin-top: 2rem;
  width: 100%;
  box-sizing: border-box;
}

.character-impacts h3 {
  color: var(--secondary-color);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.impact-link {
  display: block;
  padding: 0.5rem;
  margin: 0.5rem 0;
  background-color: var(--background-color);
  border-radius: 4px;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.impact-link:hover {
  background-color: #d5dbdb;
}

.character-content {
  width: 100%;
  box-sizing: border-box;
}

.no-character-selected {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
  font-style: italic;
  color: var(--text-color);
}

@media (max-width: 1200px) {
  .character-workspace {
    flex-direction: column-reverse;
    align-items: center;
  }

  .character-editor {
    width: 100%;
    max-width: 800px;
  }

  .character-stack {
    width: 100%;
    max-width: 800px;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 1rem;
  }

  .character-tab,
  .add-character-tab {
    min-width: 150px;
    border-radius: 8px;
  }

  .character-tab:hover,
  .character-tab.active,
  .add-character-tab:hover {
    transform: translateY(-5px);
  }
}

@media (max-width: 820px) {
  .character-editor {
    width: calc(100% - 2rem);
    padding: 1rem;
  }
}

@media (max-width: 600px) {
  .character-editor {
    width: calc(100% - 1rem);
    padding: 0.5rem;
  }
}
