/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  padding-bottom: 2rem;
}

/* Header Styles - Mobile First */
.header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.header__logo {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1rem 0 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.header__logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  text-align: center;
}

.header__nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.header__nav-container {
  display: flex;
  min-width: max-content;
  padding: 0.5rem 0;
  gap: 0.5rem;
}

.header__nav-item {
  display: block;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  border-radius: 0.375rem;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  cursor: pointer;
}

.header__nav-item:hover {
  background-color: #f3f4f6;
  color: #374151;
}

.header__nav-item--active {
  background-color: #3b82f6;
  color: white;
}

.header__nav-item--active:hover {
  background-color: #2563eb;
}

/* News Card Styles */
.news-card {
  background: white;
  border-radius: 0.5rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.news-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.news-card--large {
  padding: 1.5rem;
}

.news-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.news-card--large .news-card__title {
  font-size: 1.125rem;
  font-weight: 700;
}

.news-card__description {
  color: #6b7280;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.news-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #6b7280;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.news-card__source {
  font-weight: 500;
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

/* Home Page Styles */
.home-page__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
  text-align: center;
}

.home-page__subtitle {
  text-align: center;
  color: #6b7280;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.home-page__categories {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.home-category {
  background: white;
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid #e5e7eb;
}

.home-category__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.home-category__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  text-transform: capitalize;
}

.home-category__view-all {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
}

.home-category__view-all:hover {
  color: #2563eb;
}

.home-category__no-news {
  color: #6b7280;
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

/* Category Page Styles */
.category-page__header {
  margin-bottom: 2rem;
  text-align: center;
}

.category-page__back {
  display: inline-block;
  color: #3b82f6;
  text-decoration: none;
  margin-bottom: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.category-page__back:hover {
  color: #2563eb;
}

.category-page__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
  text-transform: capitalize;
}

.category-page__count {
  color: #6b7280;
  font-size: 0.875rem;
}

.category-page__news-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-page__no-news {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 3rem 1rem;
}

/* Loading and Error States */
.loading, .error {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
}

.error {
  color: #dc2626;
}

.error__home-link {
  color: #3b82f6;
  text-decoration: none;
}

.error__home-link:hover {
  color: #2563eb;
}

/* Search Interface Styles */
.search-interface {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 1rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  margin-top: 2rem;
}

/* Footer Styles */
.footer {
  background: #f8f9fa;
  border-top: 1px solid #e5e7eb;
  padding: 1.5rem 1rem;
  margin-top: 2rem;
}

.footer__content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer__content p {
  margin: 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.footer__content a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}

.footer__content a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.search-form {
  max-width: 800px;
  margin: 0 auto;
}

.search-input-container {
  display: flex;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.search-input:disabled {
  background: #f9fafb;
  color: #6b7280;
}

.search-button {
  padding: 0.75rem 1.5rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.search-button:hover:not(:disabled) {
  background: #2563eb;
}

.search-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Main Content Adjustment */
.main-content {
  /* No padding needed since search is no longer fixed */
}

/* Search Results Modal */
.search-results-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 1rem;
}

.search-results-modal {
  background: white;
  border-radius: 0.5rem;
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.search-results-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #111827;
}

.close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0.25rem;
  width: 2rem;
  height: 2rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-button:hover {
  background: #f3f4f6;
  color: #374151;
}

.search-results-content {
  padding: 1.5rem;
  overflow-y: auto;
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-result-item {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: background-color 0.2s;
}

.search-result-item:hover {
  background: #f9fafb;
}

.result-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}

.result-title a {
  color: #3b82f6;
  text-decoration: none;
}

.result-title a:hover {
  text-decoration: underline;
}

.result-description {
  margin: 0.5rem 0;
  color: #6b7280;
  line-height: 1.5;
}

.result-meta {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #9ca3af;
}

/* Special Interface */
.special-container {
  position: fixed;
  right: 1rem;
  bottom: 120px;
  width: 350px;
  height: 450px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 1500;
}

.special-interface {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.special-header {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 0.5rem 0.5rem 0 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.special-header-content {
  flex: 1;
}

.special-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #111827;
}

.special-participant-count {
  font-size: 0.75rem;
  color: #6b7280;
}

.special-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.special-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

.special-message {
  max-width: 80%;
  margin-bottom: 0.5rem;
}

.special-message.own-message {
  align-self: flex-end;
}

.special-message.other-message {
  align-self: flex-start;
}

.special-message.system-message {
  align-self: center;
  max-width: 100%;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.message-username {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
}

.message-timestamp {
  font-size: 0.75rem;
  color: #9ca3af;
}

.message-content {
  background: #f3f4f6;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.own-message .message-content {
  background: #3b82f6;
  color: white;
}

.system-message .message-content {
  background: #fef3c7;
  color: #92400e;
  text-align: center;
  font-style: italic;
}

.special-input-form {
  border-top: 1px solid #e5e7eb;
  padding: 0.75rem;
}

.special-input-container {
  display: flex;
  gap: 0.5rem;
}

.special-input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  resize: none;
}

.special-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.special-send-button {
  padding: 0.5rem 1rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
}

.special-send-button:hover:not(:disabled) {
  background: #2563eb;
}

.special-send-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Username Prompt */
.username-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  padding: 1rem;
}

.username-prompt {
  background: white;
  border-radius: 0.5rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.username-prompt-content {
  padding: 2rem;
  text-align: center;
}

.username-prompt-content h2 {
  margin: 0 0 1rem 0;
  color: #111827;
}

.username-prompt-content p {
  margin: 0 0 2rem 0;
  color: #6b7280;
  line-height: 1.5;
}

.username-input-container {
  margin-bottom: 2rem;
}

.username-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  text-align: center;
}

.username-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.username-error {
  margin-top: 0.5rem;
  color: #dc2626;
  font-size: 0.875rem;
}

.username-submit-btn {
  width: 100%;
  padding: 0.75rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

.username-submit-btn:hover:not(:disabled) {
  background: #2563eb;
}

.username-submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.username-prompt-info {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Notification Prompt */
.notification-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2500;
  padding: 1rem;
}

.notification-prompt {
  background: white;
  border-radius: 0.5rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.notification-prompt-content {
  padding: 2rem;
  text-align: center;
}

.notification-prompt-content h3 {
  margin: 0 0 1rem 0;
  color: #111827;
}

.notification-prompt-content p {
  margin: 0 0 2rem 0;
  color: #6b7280;
  line-height: 1.5;
}

.notification-prompt-buttons {
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

.notification-allow-btn {
  padding: 0.75rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
}

.notification-allow-btn:hover {
  background: #2563eb;
}

.notification-dismiss-btn {
  padding: 0.75rem;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
}

.notification-dismiss-btn:hover {
  background: #e5e7eb;
}

.notification-unsupported {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: #fef2f2;
  color: #dc2626;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid #fecaca;
  font-size: 0.875rem;
  z-index: 2000;
}

/* Tablet Styles */
@media (min-width: 768px) {
  .page {
    padding: 0 24px;
  }

  .header__logo {
    border-bottom: none;
    padding: 1rem 0;
  }

  .header__logo h1 {
    font-size: 1.75rem;
    text-align: left;
  }

  .header__nav-container {
    gap: 1rem;
    padding: 1rem 0;
  }

  .header__nav-item {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
  }

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

  .category-page__header {
    text-align: left;
  }

  .category-page__news-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
  }

  .news-card__title {
    font-size: 1.125rem;
  }

  .news-card--large .news-card__title {
    font-size: 1.25rem;
  }
}

/* Desktop Styles */
@media (min-width: 1024px) {
  .header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .header__logo {
    padding: 1.5rem 0;
    flex-shrink: 0;
  }

  .header__nav {
    overflow: visible;
  }

  .header__nav-container {
    padding: 0;
  }

  .home-page__categories {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
  }

  .category-page__news-list {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
  }

  .home-page__title {
    font-size: 2.25rem;
  }

  .category-page__title {
    font-size: 2rem;
  }
}

/* Large Desktop */
@media (min-width: 1280px) {
  .home-page__categories {
    grid-template-columns: repeat(3, 1fr);
  }

  .category-page__news-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Mobile Responsive Adjustments for New Components */
@media (max-width: 768px) {
  .special-container {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: 100px;
    height: 400px;
  }

  .search-input-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .search-button {
    padding: 0.75rem;
  }

  .username-prompt, .notification-prompt {
    margin: 1rem;
  }

  .notification-prompt-buttons {
    flex-direction: column;
  }
}