* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f5f5f5;
  font-size: 32px;
}

h1 {
  color: #333;
  margin-bottom: 30px;
}

.create-new-btn {
  background-color: #28a745;
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  width: 100%;
}

.create-new-btn:hover {
  background-color: #218838;
}

.backup-restore-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.backup-btn,
.restore-btn {
  flex: 1;
  background-color: #6c757d;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backup-btn:hover {
  background-color: #5a6268;
}

.restore-btn {
  background-color: #ffc107;
  color: #333;
}

.restore-btn:hover {
  background-color: #e0a800;
}

.new-note-form {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  color: #333;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 28px;
}

#new-body-html,
#edit-body-html {
  min-height: 300px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.toggle-html-btn {
  background-color: #6c757d;
  color: white;
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 10px;
  float: right;
}

.toggle-html-btn:hover {
  background-color: #5a6268;
}

/* Version navigation in modal */
.version-nav-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 10px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid #ddd;
}

.version-timestamp {
  font-size: 14px;
  color: #666;
  font-style: italic;
  min-width: 200px;
  text-align: center;
}

.version-nav-modal .version-back-btn,
.version-nav-modal .version-forward-btn {
  padding: 6px 12px;
  font-size: 14px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.version-nav-modal .version-back-btn:hover:not(:disabled),
.version-nav-modal .version-forward-btn:hover:not(:disabled) {
  background-color: #0056b3;
}

.version-nav-modal .version-back-btn:disabled,
.version-nav-modal .version-forward-btn:disabled {
  background-color: #d3d3d3;
  color: #888;
  cursor: not-allowed;
}

input[type="text"]:focus {
  outline: none;
  border-color: #007bff;
}

/* Quill editor styling */
#new-body {
  min-height: 200px;
  background: white;
}

.ql-container {
  font-size: 28px;
  font-family: inherit;
  min-height: 150px;
}

.ql-editor {
  min-height: 150px;
}

.ql-toolbar {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.ql-container {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

/* Custom button in Quill editor */
.ql-editor .custom-button,
.ql-editor button {
  display: inline-block;
  margin: 5px;
  padding: 8px 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.ql-editor .custom-button:hover,
.ql-editor button:hover {
  background-color: #0056b3;
}

/* Custom form elements in Quill editor */
.ql-editor form {
  display: block;
  margin: 15px 0;
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: 4px;
  background-color: #f9f9f9;
}

.ql-editor input[type="text"],
.ql-editor textarea,
.ql-editor select {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 8px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background-color: white;
}

.ql-editor textarea {
  min-height: 80px;
  resize: vertical;
}

.ql-editor select {
  cursor: pointer;
}

.ql-editor input[type="text"]:focus,
.ql-editor textarea:focus,
.ql-editor select:focus {
  outline: none;
  border-color: #007bff;
}

button {
  padding: 10px 20px;
  font-size: 14px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  touch-action: manipulation;
}

button:hover {
  background-color: #0056b3;
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.notes-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.note {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.note-title {
  margin: 0 0 10px 0;
  font-size: 32px;
  font-weight: bold;
}

.note-body {
  padding: 8px;
  margin-bottom: 10px;
  min-height: 60px;
  font-size: 28px;
}

.note-body img {
  max-width: 100%;
  height: auto;
  display: block;
}

.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
}

.timestamp {
  font-style: italic;
}

.note-toolbar {
  display: flex;
  gap: 8px;
}

.edit-btn,
.delete-btn {
  padding: 6px 12px;
  font-size: 18px;
  color: white;
}

.edit-btn {
  background-color: #28a745;
}

.edit-btn:hover {
  background-color: #218838;
}

.delete-btn {
  background-color: #dc3545;
}

.delete-btn:hover {
  background-color: #c82333;
}

.delete-btn.confirm {
  background-color: #ff6b6b;
}

.up-btn,
.down-btn {
  background-color: #007bff;
  color: white;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: bold;
}

.up-btn:hover,
.down-btn:hover {
  background-color: #0056b3;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: auto;
}

.modal.show {
  display: block;
}

.modal-content {
  background-color: #fefefe;
  margin: 5vh auto;
  border-radius: 8px;
  width: 90vw;
  height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid #ddd;
}

.modal-header h2 {
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 48px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  line-height: 40px;
  color: #666;
}

.close-btn:hover {
  color: #000;
  background: none;
}

.modal-body {
  padding: 20px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.modal-body input {
  margin-bottom: 15px;
}

#edit-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#edit-body .ql-container {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

#edit-body-html {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 20px;
  border-top: 2px solid #ddd;
}

.cancel-btn {
  background-color: #ffc107;
  color: #333;
}

.cancel-btn:hover {
  background-color: #e0a800;
}

.delete-btn-modal {
  background-color: #dc3545;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}

.delete-btn-modal:hover {
  background-color: #c82333;
}

.delete-btn-modal.confirm {
  background-color: #ff6b6b;
  animation: pulse 0.5s ease-in-out;
}

.delete-btn-modal:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.message {
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
