* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

.screen {
  min-height: 100vh;
  padding: 20px;
}

.hidden {
  display: none !important;
}

/* Setup Screen */
#setup-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  max-width: 400px;
  margin: 0 auto;
}

#setup-screen h1 {
  margin-bottom: 30px;
  color: #2196f3;
}

.back-btn {
  margin-bottom: 20px;
  background: #f5f5f5;
  color: #2196f3;
  border: 1px solid #2196f3;
  padding: 10px 20px;
  width: auto;
  font-size: 14px;
}

.back-btn:hover {
  background: #e3f2fd;
}

/* Storage Mode Indicator */
.storage-mode {
  width: 100%;
  padding: 10px 15px;
  background: #e3f2fd;
  border: 1px solid #2196f3;
  border-radius: 5px;
  text-align: center;
  margin-bottom: 20px;
  font-size: 14px;
  color: #1976d2;
  font-weight: 500;
}

/* localStorage Info Section */
.local-storage-section {
  width: 100%;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.local-storage-section h3 {
  text-align: center;
  margin-bottom: 15px;
  color: #2196f3;
}

.local-storage-section p {
  margin-bottom: 20px;
  text-align: center;
  color: #666;
  line-height: 1.6;
}

.local-storage-section .help-text {
  font-size: 14px;
  margin-top: 15px;
  margin-bottom: 0;
}

/* Auth Form */
.auth-form {
  width: 100%;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-form h3 {
  text-align: center;
  margin-bottom: 25px;
  color: #333;
}

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

.form-group small {
  color: #666;
  font-size: 12px;
}

button {
  background: #2196f3;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  width: 100%;
}

button:hover {
  background: #1976d2;
}

button.primary {
  background: #4caf50;
}

button.primary:hover {
  background: #45a049;
}

/* Main Screen */
#main-screen {
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
}

header {
  background: #2196f3;
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 24px;
}

#settings-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 12px;
  width: auto;
  font-size: 18px;
}

main {
  padding: 20px;
}

/* Entry Form */
.entry-form {
  background: white;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.date-header {
  margin-bottom: 15px;
}

.date-header h2 {
  color: #2196f3;
  margin-bottom: 8px;
  font-size: 20px;
}

.date-header.grayed h2 {
  color: #999;
}

#custom-title {
  width: 100%;
  border: none;
  font-size: 16px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  background: transparent;
}

#custom-title:focus {
  outline: none;
  border-bottom-color: #2196f3;
}

.textarea-wrapper {
  position: relative;
  border-left: 3px solid transparent;
  padding-left: 12px;
  margin-left: -12px;
  transition: border-color 0.3s ease;
}

.textarea-wrapper:focus-within {
  border-left-color: #2196f3;
}

#entry-text {
  width: 100%;
  min-height: 120px;
  border: none;
  resize: vertical;
  font-size: 16px;
  line-height: 1.6;
  font-family: inherit;
  padding: 15px 0;
}

#entry-text:focus {
  outline: none;
}

#entry-text::placeholder {
  color: #999;
}

/* Session Timer */
.session-timer {
  position: absolute;
  bottom: 5px;
  right: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #999;
  background: rgba(255, 255, 255, 0.9);
  padding: 3px 8px;
  border-radius: 10px;
  opacity: 0.6;
  transition: opacity 0.3s;
  pointer-events: none;
}

.session-timer:hover {
  opacity: 1;
}

.session-timer .timer-icon {
  font-size: 12px;
}

#timer-text {
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
}

/* Committed content sections */
.committed-sections {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.committed-section {
  color: #555;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 15px;
  padding: 10px;
  background: #f9f9f9;
  border-left: 3px solid #2196f3;
  border-radius: 3px;
}

.committed-section .timestamp {
  display: block;
  font-style: italic;
  color: #2196f3;
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Entries Timeline */
.entry-item {
  background: white;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.entry-date {
  color: #2196f3;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.entry-content {
  color: #333;
  line-height: 1.6;
  white-space: pre-wrap;
}

.entry-time {
  font-style: italic;
  color: #666;
  font-size: 14px;
}

/* Loading */
#loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* Responsive */
@media (max-width: 600px) {
  main {
    padding: 15px;
  }

  .entry-form,
  .entry-item {
    padding: 15px;
  }
}

/* Auto-save indicator */
.auto-save {
  position: fixed;
  top: 80px;
  right: 20px;
  background: #4caf50;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s;
}

.auto-save.show {
  opacity: 1;
}

/* Migration Progress Indicator */
.migration-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.migration-content {
  background: white;
  padding: 40px;
  border-radius: 10px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.migration-content h3 {
  margin-bottom: 15px;
  color: #2196f3;
}

.migration-content p {
  margin-bottom: 20px;
  color: #666;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  transition: width 0.3s ease;
  border-radius: 10px;
}

/* Folder Browser */
#folder-browser-screen {
  max-width: 600px;
  margin: 0 auto;
}

#folder-browser-screen h1 {
  text-align: center;
  color: #2196f3;
  margin-bottom: 30px;
}

.folder-browser {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.breadcrumb {
  margin-bottom: 20px;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 5px;
  font-size: 14px;
}

.breadcrumb-item {
  background: transparent;
  border: none;
  color: #2196f3;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
  width: auto;
}

.breadcrumb-item:hover {
  background: #e3f2fd;
}

#breadcrumb-path {
  color: #666;
}

.folder-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.folder-actions button {
  width: auto;
  flex: 1;
}

.folder-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 5px;
}

.folder-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background-color 0.2s;
}

.folder-item:hover {
  background: #f5f5f5;
}

.folder-item:last-child {
  border-bottom: none;
}

.folder-icon {
  margin-right: 10px;
  font-size: 18px;
}

.folder-name {
  flex: 1;
  font-size: 16px;
}

.folder-type {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
}

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

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
  margin-bottom: 20px;
  color: #333;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: 20px;
  font-size: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions button {
  width: auto;
  flex: 1;
}
