:root {
  --primary-color: #8B5CF6;
  /* Violet */
  --primary-dark: #7C3AED;
  --primary-light: #A78BFA;
  --secondary-color: #10B981;
  /* Emerald */
  --bg-color: #F9FAFB;
  --card-bg: #FFFFFF;
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --border-color: #E5E7EB;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #111827;
    --card-bg: #1F2937;
    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;
    --border-color: #374151;
  }
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-lg);
}

/* Header */
header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background-color: var(--card-bg);
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

header h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.025em;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.75rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: transform 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-back:hover {
  color: var(--primary-color);
  transform: translateX(-2px);
}

.btn-icon {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  transition: all 0.2s;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: 500;
  font-size: 0.875rem;
}

.btn-icon:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.lang-select {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s;
  width:80px;
}

.lang-select:hover {
  border-color: var(--primary-color);
}

.lang-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Views */
.view {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Home View */
.selection-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

select {
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

select:hover {
  border-color: var(--primary-color);
}

select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  width: 100%;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  width: 100%;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* Verses List */
.verse-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
  border-radius: var(--radius-sm);
}

.verse-item:hover {
  background-color: var(--bg-color);
}

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

.verse-item input[type="checkbox"] {
  width: 1.375rem;
  height: 1.375rem;
  margin-top: 0.25rem;
  accent-color: var(--primary-color);
  cursor: pointer;
  flex-shrink: 0;
}

.verse-text {
  font-size: 1rem;
  line-height: 1.7;
  flex: 1;
}

.verse-ref {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--primary-color);
  margin-bottom: 0.375rem;
  display: block;
  letter-spacing: 0.025em;
}

/* Journal List */
.journal-item {
  background-color: var(--bg-color);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.journal-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.journal-item:active {
  transform: translateY(0);
}

.journal-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.journal-ref {
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.journal-preview {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

/* Journal Detail */
.detail-verse {
  background-color: var(--bg-color);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  font-style: italic;
  border-left: 4px solid var(--primary-color);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.detail-verse strong {
  color: var(--primary-color);
  font-style: normal;
  margin-right: 0.5rem;
}

.journal-entries {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.entry-card {
  background-color: var(--bg-color);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.entry-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

textarea::placeholder {
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  margin-top: 3rem;
  padding: 2rem;
  font-size: 1rem;
}

/* Sync View Improvements */
.tab-container {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.tab-container button {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.sync-description {
  background-color: var(--bg-color);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--primary-color);
}

.sync-section {
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

.sync-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

textarea[readonly] {
  background-color: var(--bg-color);
  cursor: default;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-main);
  font-size: 1rem;
  transition: border-color 0.2s;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

hr {
  border: none;
  height: 1px;
  background-color: var(--border-color);
  margin: 1.5rem 0;
}

.status-message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.status-waiting {
  background-color: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
}

.status-connected {
  background-color: #D1FAE5;
  color: #065F46;
  border: 1px solid #34D399;
}

.status-error {
  background-color: #FEE2E2;
  color: #991B1B;
  border: 1px solid #F87171;
}

#qrcode {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
  padding: 1rem;
  background-color: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .view {
    padding: 1rem;
  }

  header {
    padding: 0.875rem 1rem;
  }

  header h1 {
    font-size: 1.25rem;
  }
}
.clr {
    clear: both;
    padding: 0;
    margin: 0;
    background: none;
}