/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #ffffff;
  color: #000000;
  line-height: 1.6;
}

/* Password Gate */
.password-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #ffffff;
}

.password-container {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  text-align: center;
}

.password-container h1 {
  font-size: 28px;
  margin-bottom: 12px;
  color: #000000;
}

.password-container p {
  font-size: 14px;
  color: #666666;
  margin-bottom: 24px;
}

#password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#password-input {
  padding: 12px;
  border: 1px solid #cccccc;
  border-radius: 4px;
  font-size: 16px;
}

#password-input:focus {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

.error-message {
  color: #d32f2f;
  font-size: 14px;
  min-height: 20px;
}

/* Main App Layout */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 28px;
  color: #000000;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background-color: #f0c44a;
  color: #000000;
}

.btn-primary:hover {
  background-color: #e0b43a;
}

.btn-primary:focus {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

.btn-secondary {
  background-color: #ffffff;
  color: #000000;
  border: 1px solid #cccccc;
}

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

.btn-secondary:focus {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

.btn-danger {
  background-color: #d32f2f;
  color: #ffffff;
}

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

.btn-danger:focus {
  outline: 2px solid #d32f2f;
  outline-offset: 2px;
}

/* Search Container */
.search-container {
  margin-bottom: 24px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cccccc;
  border-radius: 4px;
  background-color: #ffffff;
}

.search-bar:focus-within {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

.category-dropdown {
  padding: 6px 8px;
  border: none;
  background-color: transparent;
  font-size: 14px;
  color: #000000;
  cursor: pointer;
  min-width: 80px;
}

.category-dropdown:focus {
  outline: none;
}

.search-input {
  flex: 1;
  padding: 6px 8px;
  border: none;
  font-size: 14px;
  color: #000000;
}

.search-input:focus {
  outline: none;
}

.search-notice {
  margin-bottom: 12px;
  padding: 8px 12px;
  font-size: 14px;
  color: #666666;
  background-color: #f5f5f5;
  border-radius: 4px;
  display: none;
}

.search-notice.visible {
  display: block;
}

/* Results List */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* max-height: calc(100vh - 280px); */
  overflow-y: auto;
}

.result-card {
  padding: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
  height: 100px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.result-card:hover {
  border-color: #f0c44a;
  box-shadow: 0 2px 8px rgba(240, 196, 74, 0.2);
}

.result-card:focus {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

.result-question {
  font-weight: 600;
  font-size: 16px;
  color: #000000;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-snippet {
  font-size: 14px;
  color: #666666;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

mark {
  background-color: #f0c44a;
  color: #000000;
  padding: 0 2px;
}

/* Details View */
.details-view {
  max-width: 900px;
  margin: 0 auto;
}

.details-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.back-btn {
  padding: 8px;
  border: none;
  background-color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.back-btn:hover {
  background-color: #f5f5f5;
}

.back-btn:focus {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

.details-category {
  flex: 1;
  font-size: 14px;
  color: #666666;
  font-weight: 500;
}

/* View Mode */
.question-title {
  font-size: 24px;
  font-weight: 600;
  color: #000000;
  margin-bottom: 24px;
  line-height: 1.4;
}

.answer-content {
  font-size: 16px;
  color: #000000;
  line-height: 1.8;
}

.answer-content h2 {
  font-size: 20px;
  margin-top: 24px;
  margin-bottom: 12px;
}

.answer-content h3 {
  font-size: 18px;
  margin-top: 20px;
  margin-bottom: 10px;
}

.answer-content ul,
.answer-content ol {
  margin-left: 24px;
  margin-bottom: 12px;
}

.answer-content li {
  margin-bottom: 8px;
}

.answer-content a {
  color: #000000;
  text-decoration: underline;
}

.answer-content a:hover {
  color: #f0c44a;
}

/* Edit Mode */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #000000;
}

.input-small,
.input-full {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cccccc;
  border-radius: 4px;
  font-size: 14px;
  color: #000000;
}

.input-small {
  max-width: 300px;
}

.input-small:focus,
.input-full:focus {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

/* Editor */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border: 1px solid #cccccc;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background-color: #f9f9f9;
}

.editor-btn {
  padding: 6px 10px;
  border: 1px solid #cccccc;
  border-radius: 3px;
  background-color: #ffffff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.editor-btn:hover {
  background-color: #f0f0f0;
}

.editor-btn.active {
  background-color: #f0c44a;
  border-color: #f0c44a;
}

.editor-btn:focus {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

.editor-content {
  min-height: 300px;
  padding: 12px;
  border: 1px solid #cccccc;
  border-radius: 0 0 4px 4px;
  background-color: #ffffff;
  font-size: 16px;
  line-height: 1.8;
  overflow-y: auto;
}

.editor-content:focus {
  outline: 2px solid #f0c44a;
  outline-offset: 2px;
}

.editor-content h2 {
  font-size: 20px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.editor-content h3 {
  font-size: 18px;
  margin-top: 14px;
  margin-bottom: 6px;
}

.editor-content ul,
.editor-content ol {
  margin-left: 24px;
  margin-bottom: 12px;
}

.editor-content li {
  margin-bottom: 8px;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.visible {
  display: flex;
}

.modal-content {
  background-color: #ffffff;
  padding: 24px;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
}

.modal-content h3 {
  font-size: 20px;
  margin-bottom: 12px;
  color: #000000;
}

.modal-content p {
  font-size: 14px;
  color: #666666;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
  .app {
    padding: 16px;
  }

  .header h1 {
    font-size: 24px;
  }

  .result-card {
    height: 90px;
  }

  .question-title {
    font-size: 20px;
  }

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

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

