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

html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #2d2d2d;
  background: #faf8f6;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* App Container */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  background: #ffffff;
  min-height: 100vh;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #d4a5a5 0%, #c89595 100%);
  color: white;
  padding: 24px 20px;
  text-align: center;
}

.app-header h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.tagline {
  font-size: 14px;
  opacity: 0.95;
  font-weight: 300;
}

/* Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 480px;
  width: 100%;
  background: white;
  border-top: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: #8a8a8a;
  transition: color 0.2s;
}

.nav-btn.active {
  color: #c89595;
}

.nav-icon {
  font-size: 24px;
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
}

/* Main Content */
.main-content {
  padding: 20px;
  padding-bottom: 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Cards */
.daily-card {
  background: linear-gradient(135deg, #f5e6e6 0%, #f0d9d9 100%);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.daily-card h2 {
  font-size: 18px;
  color: #7a5f5f;
  margin-bottom: 16px;
  font-weight: 600;
}

.affirmation {
  font-size: 20px;
  line-height: 1.6;
  color: #5a4444;
  margin-bottom: 20px;
  font-weight: 500;
  font-style: italic;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: #c89595;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: #8a8a8a;
}

/* Quick Actions */
.quick-actions {
  margin-bottom: 24px;
}

.quick-actions h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #5a4444;
}

.action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 15px;
  color: #2d2d2d;
}

.action-btn:hover {
  border-color: #c89595;
  background: #faf8f6;
}

.action-icon {
  font-size: 24px;
}

/* Buttons */
.btn-primary {
  background: #c89595;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #b88585;
}

.btn-secondary {
  background: white;
  color: #c89595;
  border: 1px solid #c89595;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #faf8f6;
}

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

.view-header h2 {
  font-size: 24px;
  color: #2d2d2d;
}

/* Form Card */
.form-card {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.form-card h3 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #5a4444;
}

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

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

.form-group input[type="text"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  font-family: inherit;
}

.form-group input[type="range"] {
  width: calc(100% - 40px);
  margin-right: 8px;
}

.form-group textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.form-actions button {
  flex: 1;
}

/* Goals List */
.goals-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.goal-card {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 16px;
  position: relative;
}

.goal-card.completed {
  opacity: 0.6;
  border-color: #a8d5a8;
  background: #f5faf5;
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 8px;
}

.goal-title {
  font-size: 16px;
  font-weight: 600;
  color: #2d2d2d;
  flex: 1;
}

.goal-category {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: #f0d9d9;
  color: #7a5f5f;
}

.goal-priority {
  font-size: 13px;
  color: #8a8a8a;
  margin-bottom: 12px;
}

.goal-actions {
  display: flex;
  gap: 8px;
}

.goal-actions button {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-complete {
  background: #a8d5a8;
  color: white;
}

.btn-delete {
  background: #e8e8e8;
  color: #8a8a8a;
}

/* Exercises */
.exercises-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exercise-card {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.exercise-card:hover {
  border-color: #c89595;
  background: #faf8f6;
}

.exercise-card h3 {
  font-size: 18px;
  color: #2d2d2d;
  margin-bottom: 8px;
}

.exercise-card p {
  font-size: 14px;
  color: #8a8a8a;
  margin-bottom: 12px;
}

.exercise-time {
  display: inline-block;
  padding: 4px 12px;
  background: #f0d9d9;
  color: #7a5f5f;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

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

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 440px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 32px;
  color: #8a8a8a;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
}

.modal-content h3 {
  font-size: 22px;
  margin-bottom: 16px;
  color: #5a4444;
}

/* Journal */
.mood-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.mood-btn {
  flex: 1;
  font-size: 32px;
  padding: 12px;
  background: white;
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.mood-btn:hover {
  border-color: #c89595;
}

.mood-btn.selected {
  border-color: #c89595;
  background: #faf8f6;
}

.journal-entries {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.journal-entry {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 16px;
}

.journal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.journal-date {
  font-size: 13px;
  color: #8a8a8a;
}

.journal-mood {
  font-size: 24px;
}

.journal-text {
  font-size: 15px;
  line-height: 1.6;
  color: #2d2d2d;
  white-space: pre-wrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #8a8a8a;
  font-size: 15px;
}

/* AI Coach */
.coach-subtitle {
  font-size: 14px;
  color: #8a8a8a;
  margin-top: -12px;
  margin-bottom: 20px;
}

.api-key-setup {
  margin: 16px;
}

.api-key-setup .card {
  text-align: center;
}

.api-key-setup h3 {
  margin-bottom: 12px;
  color: #333;
}

.api-key-setup p {
  color: #666;
  margin-bottom: 16px;
}

.api-key-setup input {
  font-family: monospace;
  font-size: 13px;
}

.api-key-setup small {
  display: block;
  margin-top: 6px;
  color: #888;
  font-size: 11px;
}

.api-key-setup a {
  color: #c89595;
  text-decoration: none;
}

.api-key-setup a:hover {
  text-decoration: underline;
}

.coach-suggestions {
  background: linear-gradient(135deg, #f5e6e6 0%, #f0d9d9 100%);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.coach-suggestions h3 {
  font-size: 16px;
  color: #7a5f5f;
  margin-bottom: 12px;
}

#suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-item {
  background: white;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  color: #5a4444;
  border-left: 3px solid #c89595;
}

.loading-text {
  color: #8a8a8a;
  font-size: 14px;
  font-style: italic;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 400px);
  min-height: 400px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message-avatar {
  font-size: 28px;
  flex-shrink: 0;
}

.message-content {
  flex: 1;
  background: #f5f5f5;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.6;
}

.user-message {
  flex-direction: row-reverse;
}

.user-message .message-content {
  background: #c89595;
  color: white;
}

.coach-message .message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.coach-message .message-content li {
  margin: 4px 0;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #c89595;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.prompt-btn {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  color: #2d2d2d;
}

.prompt-btn:hover {
  border-color: #c89595;
  background: #faf8f6;
}

.chat-input-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-form textarea {
  flex: 1;
  padding: 12px;
  font-size: 15px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}

.chat-input-form textarea:focus {
  outline: none;
  border-color: #c89595;
}

.send-btn {
  background: #c89595;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  height: 44px;
}

.send-btn:hover {
  background: #b88585;
}

.send-btn:disabled {
  background: #e8e8e8;
  color: #8a8a8a;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .stat-number {
    font-size: 24px;
  }
  
  .stat-label {
    font-size: 11px;
  }

  .quick-prompts {
    grid-template-columns: 1fr;
  }

  .chat-container {
    height: calc(100vh - 350px);
  }
}