:root {
  /* Luxury color palette - rich, sophisticated tones */
  --primary-color: #8a7559;      /* Rich gold-brown */
  --primary-dark: #6a583f;       /* Deeper brown */
  --primary-light: #c0aa86;      /* Soft gold */
  --accent-color: #b8a07e;       /* Champagne gold */

  /* Neutral colors - warmer, richer tones */
  --gray-50: #f9f7f3;            /* Creamy white */
  --gray-100: #f3efea;           /* Soft parchment */
  --gray-200: #e6e1d7;           /* Warm ivory */
  --gray-300: #d8d0c3;           /* Light taupe */
  --gray-400: #c5bdb0;           /* Warm gray */
  --gray-500: #b5ab9a;           /* Mid taupe */
  --gray-600: #9f9484;           /* Greige */
  --gray-700: #83796c;           /* Deep taupe */
  --gray-800: #5f554a;           /* Rich brown */
  --gray-900: #3d372f;           /* Deep chocolate */

  /* Semantic colors */
  --text-color: var(--gray-800);
  --text-light: var(--gray-600);
  --background-color: var(--gray-50);
  --card-color: #FFFFFF;
  --border-color: var(--gray-200);
  --success-color: #7a9268;      /* Olive green */
  --error-color: #a1665e;        /* Terracotta */

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(61, 55, 47, 0.05);
  --shadow: 0 2px 8px rgba(61, 55, 47, 0.08);
  --shadow-lg: 0 8px 16px rgba(61, 55, 47, 0.1);
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  color: var(--text-color);
  line-height: 1.6;
  background: var(--background-color);
  max-width: 800px;
  margin: 0 auto;
  padding: 2.5rem;
  letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Optima', 'Palatino', 'Georgia', serif;
  font-weight: 500;
  color: var(--gray-900);
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1.2rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--primary-color);
}

.nav {
  margin: 1.5rem 0 2rem 0;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--gray-200);
  font-family: 'Optima', 'Palatino', 'Georgia', serif;
}

.nav a {
  margin-right: 1rem;
  padding-bottom: 0.25rem;
}

form {
  margin: 2rem 0;
}

textarea {
  width: 100%;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--gray-300);
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1rem;
  min-height: 150px;
  resize: vertical;
  margin-bottom: 1.2rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: var(--card-color);
  color: var(--text-color);
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(138, 117, 89, 0.2);
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-family: 'Optima', 'Palatino', 'Georgia', serif;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  min-width: 120px;
  position: relative;
}

button:hover {
  background-color: var(--primary-dark);
}

button:active {
  transform: scale(0.98);
}

.delete-button {
  background-color: var(--error-color);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.delete-button:hover {
  background-color: #8a554e; /* Darker terracotta */
}

#result {
  margin-top: 2rem;
  padding: 1.75rem;
  background-color: var(--card-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  min-height: 100px;
  box-shadow: var(--shadow);
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.7;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#result.active {
  opacity: 1;
  transform: translateY(0);
  border-color: var(--primary-light);
}

.note {
  margin-bottom: 2rem;
  padding: 1.75rem;
  background-color: var(--card-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.note h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--primary-dark);
  margin-bottom: 1rem;
  font-family: 'Optima', 'Palatino', 'Georgia', serif;
}

.note p {
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
  color: var(--text-color);
}

.note-actions {
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  text-align: center;
  padding: 3.5rem 0;
  color: var(--text-light);
  font-style: italic;
}

.loading {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
  position: relative;
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

.loading-container {
  display: none; /* Hide the old loading container */
}

.loading-container.active {
  opacity: 1;
  pointer-events: auto;
}

/* Button text fade effect */
.button-text {
  transition: opacity 0.3s ease;
}

.button-text.fade-out {
  opacity: 0.5;
}

/* Loading spinner improvements */
.spinner-container {
  position: absolute;
  right: -40px;
  display: flex;
  align-items: center;
  opacity: 0; /* Start with zero opacity */
  visibility: hidden; /* Add visibility control for better hiding */
  transition: opacity 0.3s ease, visibility 0.3s ease; /* Include visibility in transition */
  pointer-events: none;
}

.spinner-container.active {
  opacity: 1;
  visibility: visible; /* Show when active */
}

/* Make sure the loading element is properly styled */
.loading {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid rgba(138, 117, 89, 0.3);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
  body {
    padding: 1.5rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  .note, #result {
    padding: 1.25rem;
  }
}
