/* Global reset for consistent box-sizing */
* {
  box-sizing: border-box;
}

:root {
  /* Navy Blue inspired palette - Light Theme */
  --navy-dark: #000080; /* Deepest navy */
  --navy-medium: #0000CD; /* Standard navy */
  --navy-light: #4169E1; /* Royal blue */
  --navy-aqua: #6495ED; /* Cornflower blue */
  --navy-green-dark: #228B22; /* Forest green */
  --navy-green-light: #3CB371; /* Medium sea green */
  --navy-green-medium: #2E8B57; /* Sea green */
  --navy-red-dark: #B22222; /* Firebrick */
  --navy-red-light: #DC143C; /* Crimson */
  --navy-red-medium: #CD5C5C; /* Indian red */
  --navy-gray-dark: #36454F; /* Charcoal gray */
  --navy-gray-medium: #708090; /* Slate gray */
  --navy-gray-light: #C0C0C0; /* Silver */
  --navy-white: #F0F8FF; /* Alice Blue */
  --navy-white-pure: #FFFFFF; /* Pure white */

  /* Themed elements using Navy palette - Light Theme */
  --bg-color: linear-gradient(to bottom right, #ADD8E6, #87CEEB); /* Light blue gradient */
  --paper-color: var(--navy-white); /* Newspaper background */
  --text-color: var(--navy-gray-dark);
  --control-bg: rgba(255, 255, 255, 0.75); /* Semi-transparent white for Aero effect */
  --control-border: 1px solid rgba(100, 149, 237, 0.4); /* Subtle bluish border */
  --archive-bg: var(--control-bg);
  --archive-item-bg: rgba(255, 255, 255, 0.6);
  --archive-item-hover: rgba(230, 245, 255, 0.8);
  --border-color: var(--navy-gray-light); /* General border color */
  --loading-bg: rgba(255, 255, 255, 0.7);
  --loading-spinner-border: var(--navy-gray-light);
  --button-text: white;
  --input-focus: var(--navy-medium);
  --archive-text: var(--navy-gray-dark); /* Use variable for consistency */
  --success-color: var(--navy-green-medium);
  --danger-color: var(--navy-red-medium);
  --primary-color: var(--navy-light);

  /* Default Button Variables (Light Theme) */
  --button-default-bg-start: #EFEFEF;
  --button-default-bg-end: #DCDCDC;
  --button-default-border: #C0C0C0;
  --button-default-text: var(--navy-gray-dark);
  --button-hover-bg-start: #FFFFFF;
  --button-hover-bg-end: #EFEFEF;
  --button-active-bg-start: #DCDCDC;
  --button-active-bg-end: #EFEFEF;
  --button-text-shadow-color: rgba(255,255,255,0.7);
}

[data-theme="dark"] {
  /* Dark theme (high contrast) for Navy. */
  /* Redefine core navy colors for dark mode */
  --navy-dark: #000022; /* Very deep navy, almost black */
  --navy-medium: #000044; /* Darker standard navy */
  --navy-light: #1A2A6B; /* Deeper royal blue */
  --navy-aqua: #2C4590; /* Darker cornflower blue */
  --navy-green-dark: #0F3A0F; /* Darker forest green */
  --navy-green-light: #1A5C1A; /* Darker medium sea green */
  --navy-green-medium: #154D15; /* Darker sea green */
  --navy-red-dark: #701010; /* Darker firebrick */
  --navy-red-light: #901515; /* Darker crimson */
  --navy-red-medium: #801212; /* Darker indian red */
  --navy-gray-dark: #E0E8F0; /* Off-white for dark text/icons on lighter backgrounds */
  --navy-gray-medium: #A0B0C0; /* Lighter slate gray for standard text/borders */
  --navy-gray-light: #3A4E6B; /* Darker silver for light borders/dividers */
  --navy-white: #0D1E3A; /* Darker navy for paper/light backgrounds */
  --navy-white-pure: #050A14; /* Even darker for elements, almost black */

  --bg-color: linear-gradient(to bottom right, #050A14, #0A1428); /* Deeper navy gradient */
  --paper-color: var(--navy-white); /* Darker navy for newspaper */
  --text-color: var(--navy-gray-dark); /* Uses redefined navy-gray-dark */
  --control-bg: rgba(13, 30, 58, 0.9); /* Slightly less transparent for darker feel */
  --control-border: 1px solid rgba(44, 69, 144, 0.4); /* Royal blue border */
  --archive-bg: var(--control-bg);
  --archive-item-bg: rgba(13, 30, 58, 0.8); /* Slightly less transparent */
  --archive-item-hover: rgba(18, 38, 70, 0.95); /* Slightly less transparent */
  --border-color: var(--navy-gray-light); /* Uses redefined navy-gray-light */
  --loading-bg: rgba(13, 30, 58, 0.95); /* Slightly less transparent */
  --loading-spinner-border: var(--navy-gray-light); /* Uses redefined navy-gray-light */
  --input-focus: var(--navy-aqua); /* Uses redefined navy-aqua */
  --archive-text: var(--navy-gray-medium); /* Uses redefined navy-gray-medium */

  /* Button Variables (Dark Theme) - Override generic ones */
  --button-default-bg-start: #1A2840; /* Darker gray-blue for general buttons */
  --button-default-bg-end: #101E30;
  --button-default-border: #2A3C5B;
  --button-default-text: var(--text-color);
  --button-hover-bg-start: #2A3C5B;
  --button-hover-bg-end: #1F304E;
  --button-active-bg-start: #101E30;
  --button-active-bg-end: #1A2840;
  --button-text-shadow-color: rgba(0,0,0,0.3); /* Darker text shadow for dark buttons */

  /* Specific button color overrides for dark theme */
  .generate-btn {
    background: linear-gradient(to bottom, var(--navy-green-light) 0%, var(--navy-green-medium) 100%);
    border-color: var(--navy-green-dark);
  }
  .generate-btn:hover {
    background: linear-gradient(to bottom, #2BA62B 0%, #208C20 100%); /* Slightly lighter green on hover */
  }
  .generate-btn:active {
    background: linear-gradient(to top, var(--navy-green-medium) 0%, var(--navy-green-light) 100%);
  }

  .archive-btn, .view-all-btn, .read-more-btn, .back-btn {
    background: linear-gradient(to bottom, var(--navy-light) 0%, var(--navy-medium) 100%); /* Navy blue */
    border-color: var(--navy-dark);
  }
  .archive-btn:hover, .view-all-btn:hover, .read-more-btn:hover, .back-btn:hover {
    background: linear-gradient(to bottom, var(--navy-aqua) 0%, var(--navy-light) 100%);
  }
  .archive-btn:active, .view-all-btn:active, .read-more-btn:active, .back-btn:active {
    background: linear-gradient(to top, var(--navy-medium) 0%, var(--navy-light) 100%);
  }

  .share-btn, .delete-headline-btn, .delete-btn, .delete-community-btn, .delete-story-btn {
    background: linear-gradient(to bottom, var(--navy-red-light) 0%, var(--navy-red-medium) 100%);
    border-color: var(--navy-red-dark);
  }
  .share-btn:hover, .delete-headline-btn:hover, .delete-btn:hover, .delete-community-btn:hover, .delete-story-btn:hover {
    background: linear-gradient(to bottom, #B02020 0%, #A01818 100%); /* Slightly lighter red on hover */
  }
  .share-btn:active, .delete-headline-btn:active, .delete-btn:active, .delete-community-btn:active, .delete-story-btn:active {
    background: linear-gradient(to top, var(--navy-red-medium) 0%, var(--navy-red-light) 100%);
  }

  .random-btn {
    background: linear-gradient(to bottom, #1A327F 0%, #0B1C4F 100%); /* Darker light blue action button */
    border-color: #08122D; /* Deeper light blue */
    color: var(--navy-gray-dark);
    text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  }
  .random-btn:hover {
    background: linear-gradient(to bottom, #2C4590 0%, #1A327F 100%);
  }
  .random-btn:active {
    background: linear-gradient(to top, #0B1C4F 0%, #1A327F 100%);
  }

  .upvote-btn.upvoted {
    background: linear-gradient(to bottom, var(--navy-aqua) 0%, var(--navy-light) 100%); /* Bluish */
  }
  .upvote-btn.upvoted:hover {
    background: linear-gradient(to bottom, #4C65C0 0%, #3C55B0 100%); /* Lighter blue on hover */
  }
  .upvote-btn.upvoted:active {
    background: linear-gradient(to top, var(--navy-light) 0%, var(--navy-aqua) 100%);
  }
}

body {
  background: var(--bg-color);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
  line-height: 1.5;
}

.game-container {
  display: flex;
  gap: 30px;
  max-width: 1800px; /* Increased overall max width to accommodate wider newspaper and controls */
  margin: 0 auto;
  align-items: flex-start;
  padding: 30px;
  width: 100%;
  justify-content: center; /* Added for horizontal centering of content */
}

/* Newspaper styles - make it wider */
.newspaper {
  background: var(--paper-color);
  padding: 40px;
  width: 900px; /* Increased fixed width for the newspaper */
  position: relative;
  min-height: 700px; /* Adjusted min-height slightly for better horizontal fit */
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); /* More prominent shadow for depth */
  transition: all 0.3s ease;
  border-radius: 12px;
  color: var(--text-color);
  border: 1px solid var(--border-color); /* Add a light border */
}

.newspaper:hover {
  transform: translateY(-2px); /* Less dramatic lift */
  box-shadow: 0 12px 36px rgba(0,0,0,0.2);
}

.masthead {
  font-family: "Times New Roman", serif;
  font-size: 54px;
  font-weight: 900;
  text-align: center;
  border-bottom: 3px solid currentColor;
  margin-bottom: 30px;
  padding-bottom: 20px;
  letter-spacing: -1px;
}

.headline {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 25px;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.article {
  font-size: 18px;
  line-height: 1.8;
  column-count: 3; /* Increased to 3 columns for better readability on wider layout */
  column-gap: 40px;
  text-align: justify;
  margin-top: 30px;
}

.subheadline {
  font-size: 24px;
  font-style: italic;
  margin: 15px 0 25px;
  line-height: 1.4;
  color: var(--navy-gray-medium); /* Use a defined gray */
}

.date {
  text-align: right;
  font-style: italic;
  margin-bottom: 20px;
}

/* Controls styling - make it wider and internal elements horizontal */
.controls {
  display: grid; /* Use grid for internal layout */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Auto-fit columns, min 300px, max 1fr */
  gap: 20px; /* Gap between grid items */
  width: 650px; /* Increased width for the controls panel */
  background: var(--control-bg); /* Semi-transparent for Aero effect */
  backdrop-filter: blur(8px); /* The Aero glass effect */
  border: var(--control-border);
  padding: 30px;
  border-radius: 12px; /* Consistent rounded corners */
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); /* More prominent shadow for depth */
  /* Removed flex-direction: column and original gap: 20px as grid handles it */
}

/* Ensure certain elements span full width within the controls grid */
.input-container,
.random-btn,
.options-section,
.button-group,
.delete-headline-btn {
  grid-column: 1 / -1; /* Span across all columns */
}

.theme-switch-container,
.toggle-container,
.archive-section,
.shared-stories-section {
  /* These will naturally flow into the available grid columns */
  /* No specific grid-column property needed unless we want to force pairing */
  /* For now, let grid's auto-placement handle them */
}

/* Input container and prompt input */
.input-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%; /* Important for grid span to work properly inside grid item */
}

.prompt-input {
  width: 100%;
  padding: 15px;
  border: 1px solid var(--border-color); /* Thinner border */
  border-radius: 6px; /* Match button radius */
  font-size: 16px;
  min-height: 100px; /* Slightly reduced min-height */
  resize: vertical;
  font-family: inherit;
  background: var(--paper-color);
  color: var(--text-color);
  transition: all 0.3s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08); /* Subtle inset shadow */
}

.prompt-input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3); /* Softer focus glow */
}

/* Button improvements - Vista style */
button {
  font-family: inherit;
  padding: 10px 18px; /* Adjusted padding */
  border: 1px solid var(--button-default-border);
  border-radius: 6px; /* Slightly less rounded for buttons */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-out; /* Faster transition for button clicks */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 14px;
  color: var(--button-default-text);
  position: relative;
  overflow: hidden;
  background: linear-gradient(to bottom, var(--button-default-bg-start) 0%, var(--button-default-bg-end) 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1); /* Subtle shadow */
  text-shadow: 0 1px 1px var(--button-text-shadow-color); /* Use variable for text shadow */
}

button:not(:disabled):hover {
  background: linear-gradient(to bottom, var(--button-hover-bg-start) 0%, var(--button-hover-bg-end) 100%);
  transform: translateY(-1px); /* Less dramatic lift */
  box-shadow: 0 2px 5px rgba(0,0,0,0.15); /* Slightly more prominent hover shadow */
}

button:not(:disabled):active {
  background: linear-gradient(to top, var(--button-active-bg-start) 0%, var(--button-active-bg-end) 100%); /* Invert gradient on active */
  transform: translateY(0);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); /* Inset shadow for press effect */
}

/* Specific button colors */
.generate-btn {
  background: linear-gradient(to bottom, var(--navy-green-light) 0%, var(--navy-green-medium) 100%);
  border-color: var(--navy-green-dark);
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.archive-btn, .view-all-btn, .read-more-btn, .back-btn {
  background: linear-gradient(to bottom, var(--navy-light) 0%, var(--navy-medium) 100%); /* Navy blue */
  border-color: var(--navy-dark);
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.archive-btn:hover, .view-all-btn:hover, .read-more-btn:hover, .back-btn:hover {
  background: linear-gradient(to bottom, var(--navy-aqua) 0%, var(--navy-light) 100%);
}

.archive-btn:active, .view-all-btn:active, .read-more-btn:active, .back-btn:active {
  background: linear-gradient(to top, var(--navy-medium) 0%, var(--navy-light) 100%);
}

.share-btn, .delete-headline-btn, .delete-btn, .delete-community-btn, .delete-story-btn {
  background: linear-gradient(to bottom, var(--navy-red-light) 0%, var(--navy-red-medium) 100%);
  border-color: var(--navy-red-dark);
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.share-btn:hover, .delete-headline-btn:hover, .delete-btn:hover, .delete-community-btn:hover, .delete-story-btn:hover {
  background: linear-gradient(to bottom, #FF6347 0%, #E04B4B 100%); /* Tomato/Red */
}

.share-btn:active, .delete-headline-btn:active, .delete-btn:active, .delete-community-btn:active, .delete-story-btn:active {
  background: linear-gradient(to top, var(--navy-red-medium) 0%, var(--navy-red-light) 100%);
}

.random-btn {
  background: linear-gradient(to bottom, #ADD8E6 0%, #87CEEB 100%); /* Light blue action button */
  border-color: #6AABD2; /* Deeper light blue */
  color: var(--navy-gray-dark);
  text-shadow: 0 1px 1px rgba(255,255,255,0.7);
}

.random-btn:hover {
  background: linear-gradient(to bottom, #B0E0E6 0%, #90D5EE 100%);
}

.random-btn:active {
  background: linear-gradient(to top, #87CEEB 0%, #ADD8E6 100%);
}

/* Disabled state */
button:disabled {
  background: linear-gradient(to bottom, #D0D0D0 0%, #B0B0B0 100%);
  border-color: #A0A0A0;
  color: #888888;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  text-shadow: none;
}

/* Options section - more sophisticated */
.options-section {
  background: var(--control-bg); /* Semi-transparent for Aero effect */
  backdrop-filter: blur(8px);
  padding: 25px;
  border-radius: 12px;
  border: var(--control-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.option-group {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.option-group select {
  padding: 10px 15px;
  border-radius: 6px; /* Match button radius */
  border: 1px solid var(--border-color); /* Thinner border */
  background: var(--paper-color);
  color: var(--text-color);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08); /* Subtle inset shadow */
}

.option-group select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3); /* Softer focus glow */
}

/* Archive and Community sections - more elegant */
.archive-section,
.shared-stories-section {
  background: var(--control-bg); /* Semi-transparent for Aero effect */
  backdrop-filter: blur(8px);
  padding: 25px;
  border-radius: 12px;
  border: var(--control-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  /* These will now automatically take their grid column width */
}

.archive-section h3,
.shared-stories-section h3 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-color);
}

.archive-item,
.shared-story-item {
  background: var(--archive-item-bg); /* Semi-transparent for consistency */
  padding: 20px;
  border-radius: 8px; /* Slightly more rounded than buttons, less than main panels */
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05); /* Lighter shadow */
}

.archive-item:hover,
.shared-story-item:hover {
  transform: translateY(-2px); /* Consistent lift */
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  background: var(--archive-item-hover); /* Lighter hover background */
}

.archive-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.archive-item-content {
  flex-grow: 1;
  padding-right: 10px;
}

.archive-item h4 {
  margin: 0 0 5px 0;
  font-size: 16px;
}

.archive-item p {
  margin: 0;
  font-size: 14px;
  color: var(--text-color); /* Consistent text color */
}

.delete-btn {
  background: var(--danger-color);
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 12px;
  min-width: 60px;
}

.delete-btn:hover {
  background: #ff0000;
}

.delete-community-btn {
  background: var(--danger-color);
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 12px;
  min-width: 60px;
  color: white;
}

.delete-community-btn:hover {
  background: #ff0000;
}

/* Upvote button - Vista style */
.upvote-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px; /* Slightly smaller */
  background: linear-gradient(to bottom, var(--button-default-bg-start) 0%, var(--button-default-bg-end) 100%); /* Light gray */
  border: 1px solid var(--button-default-border);
  color: var(--button-default-text);
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s ease-out;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  font-size: 13px; /* Slightly smaller font */
  text-shadow: 0 1px 1px var(--button-text-shadow-color);
}

.upvote-btn.upvoted {
  background: linear-gradient(to bottom, var(--navy-aqua) 0%, var(--navy-light) 100%); /* Bluish */
  color: white;
  border-color: var(--navy-medium);
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.upvote-btn:hover {
  background: linear-gradient(to bottom, var(--button-hover-bg-start) 0%, var(--button-hover-bg-end) 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.12);
}
.upvote-btn.upvoted:hover {
  background: linear-gradient(to bottom, #99CEFF 0%, #7CB9FF 100%); /* Lighter blue on hover */
}
.upvote-btn:active {
  background: linear-gradient(to top, var(--button-active-bg-start) 0%, var(--button-active-bg-end) 100%);
  transform: translateY(0);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
.upvote-btn.upvoted:active {
  background: linear-gradient(to top, var(--navy-light) 0%, var(--navy-aqua) 100%);
}

/* Loading animation - more refined */
.loading {
  backdrop-filter: blur(5px);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  background: var(--loading-bg);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.loading-spinner {
  width: 50px; /* Slightly smaller */
  height: 50px;
  border: 4px solid var(--loading-spinner-border); /* Thinner */
  border-top: 4px solid var(--navy-medium); /* Use specific blue */
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.1); /* Subtle shadow */
}

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

.loading.active {
  display: flex;
}

/* Theme switch - more elegant */
.theme-switch-container {
  background: var(--control-bg); /* Semi-transparent for Aero effect */
  backdrop-filter: blur(8px);
  padding: 15px;
  border-radius: 12px;
  border: var(--control-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.theme-icon {
  font-size: 22px;
  color: var(--text-color);
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e0;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider {
  background-color: var(--navy-medium);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Published banner styling */
.published-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 128, 0.8); /* Darker navy, slightly transparent */
  color: white;
  padding: 20px 40px;
  border-radius: 8px;
  font-size: 32px;
  animation: popIn 0.5s ease-out;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

@keyframes popIn {
  0% { opacity: 0; transform: translate(-50%, -60%); }
  100% { opacity: 1; transform: translate(-50%, -50%); }
}

.fade-out {
  animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* New rule: ensure the Random Prompt button (now a direct child of .controls) spans full width */
.controls > .random-btn {
  width: 100%;
  margin-top: 0; /* Remove specific margin-top, let grid gap handle it */
}

/* Delete headline button */
.delete-headline-btn {
  background: var(--danger-color);
  padding: 5px 10px;
  margin-top: 0; /* Remove specific margin-top, let grid gap handle it */
  width: 100%;
}

.delete-headline-btn:hover {
  background: #ff0000;
}

.delete-headline-btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

/* Button Group Styling */
.button-group {
  display: flex; /* Added for horizontal arrangement */
  gap: 15px; /* Spacing between buttons */
  justify-content: space-around; /* Distribute buttons evenly */
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

/* Toggle Container Styling */
.toggle-container {
  display: flex; /* Added for horizontal arrangement */
  align-items: center; /* Vertically align items */
  gap: 10px; /* Spacing between checkbox and label */
  /* This will be a grid item */
}

/* Community Page Styles */
.community-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

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

.community-header h1 {
  font-size: 36px;
  color: var(--text-color);
  margin: 0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 600;
  padding: 12px 24px;
  background: var(--paper-color);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.back-btn:hover {
  transform: translateX(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.community-filters {
  background: var(--control-bg); /* Aero glass effect */
  backdrop-filter: blur(8px);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: var(--control-border);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.filter-group select {
  padding: 10px 20px;
  border-radius: 8px; /* Slightly more rounded than inputs */
  border: 1px solid var(--border-color);
  background: var(--paper-color);
  color: var(--text-color);
  font-size: 16px;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

.filter-group select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.story-card {
  background: var(--archive-item-bg); /* Use semi-transparent for consistency */
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.story-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.story-header h2 {
  font-size: 24px;
  margin: 0 0 10px;
  color: var(--text-color);
  line-height: 1.3;
}

.story-meta {
  font-size: 14px;
  color: var(--text-color); /* Consistent text color */
}

.story-content {
  margin: 20px 0;
  color: var(--text-color);
}

.story-actions {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.read-more-btn {
  background: var(--primary-color);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-weight: 600;
}

.delete-story-btn {
  background: var(--danger-color);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-weight: 600;
}

.view-all-btn {
  display: inline-block;
  text-decoration: none;
  background: var(--primary-color);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.view-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}