/* Reset and base styles */
:root {
  --primary-color: #000000;
  --secondary-color: #000000;
  --accent-color: #e74c3c;
  --text-color: #333;
  --light-text: #7f8c8d;
  --border-color: #e0e0e0;
  --background-color: #f5f5f5;
  --message-bg: #ffffff;
  --user-message-bg: #f5f5f5;
  --header-height: 60px;
  --footer-height: 60px;
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
}

a {
  color: var(--secondary-color);
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* App container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100vh;
  max-height: calc(var(--vh, 1vh) * 100);
  overflow: hidden;
  background-color: white;
}

/* Header */
.app-header {
  background-color: var(--primary-color);
  color: white;
  padding: 15px;
  text-align: center;
  height: var(--header-height);
  padding-top: calc(var(--safe-area-inset-top) + 15px);
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 700;
}

.app-header p {
  font-size: 0.875rem;
  margin: 0;
  opacity: 0.8;
}

/* Tab content */
.tab-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-pane {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: none;
  background-color: var(--background-color);
}

.tab-pane.active {
  display: block;
}

/* Tab navigation */
.tab-navigation {
  display: flex;
  justify-content: space-around;
  background-color: white;
  position: relative;
  z-index: 10;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  height: var(--footer-height);
  padding-bottom: var(--safe-area-inset-bottom);
}

.tab-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: none;
  background: none;
  color: var(--light-text);
  transition: color 0.3s;
}

.tab-button.active {
  color: var(--primary-color);
}

.tab-button svg {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
}

.tab-button span {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Chat interface */
.chat-container {
  padding: 16px;
  overflow-y: auto;
  height: calc(100% - 60px);
  -webkit-overflow-scrolling: touch;
}

.message {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 85%;
  position: relative;
  line-height: 1.5;
  word-wrap: break-word;
  font-family: 'Inter', sans-serif;
  color: #000000;
}

.rini-message {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-top-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.user-message {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-top-right-radius: 4px;
  margin-left: auto;
  align-self: flex-end;
  text-align: right;
}

.chat-input-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background-color: white;
  box-shadow: 0 -1px 4px rgba(0,0,0,0.1);
  z-index: 5;
  padding-bottom: calc(12px + var(--safe-area-inset-bottom));
  transform: translateY(calc(var(--footer-height) * -1 - var(--safe-area-inset-bottom)));
}

#message-form {
  display: flex;
  align-items: center;
  position: relative;
}

#message-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
}

#message-input:focus {
  border-color: var(--secondary-color);
}

/* Location button styles */
.location-button {
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 10;
  font-size: 24px;
}

/* Adjust message input for location button */
#message-form {
  position: relative;
  padding-left: 50px;
}

#send-button {
  margin-left: 8px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

#send-button svg {
  width: 20px;
  height: 20px;
}

#send-button:active {
  background-color: #1a2530;
}

/* Places tab */
.places-container {
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

.places-header {
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.places-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.places-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 16px;
}

.place-card {
  background-color: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid var(--border-color);
}

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

.place-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
}

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

.place-actions button {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--light-text);
  padding: 0;
  border-radius: 50%;
  transition: all 0.2s;
}

.place-actions button:hover {
  background-color: rgba(0,0,0,0.05);
}

.place-actions button svg {
  width: 18px;
  height: 18px;
}

.heart-button.active {
  color: var(--accent-color);
}

.heart-button.active svg {
  fill: var(--accent-color);
}

.place-details {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  color: var(--light-text);
}

.place-description {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.place-notes {
  background-color: #f8f9fa;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  border-left: 3px solid var(--secondary-color);
}

.place-personal-notes {
  margin-bottom: 8px;
}

.place-insider-tips {
  font-style: italic;
}

.place-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

.place-footer a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--secondary-color);
  padding: 8px 12px;
  border-radius: 4px;
  background-color: rgba(52, 152, 219, 0.1);
  transition: background-color 0.2s;
}

.place-footer a:hover {
  background-color: rgba(52, 152, 219, 0.2);
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--light-text);
}

/* Profile tab */
.profile-container {
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

.profile-header {
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.profile-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.auth-section {
  background-color: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.auth-section h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.auth-section p {
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: var(--light-text);
}

.auth-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
}

.auth-form button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 500;
}

.auth-message {
  font-size: 0.875rem;
  min-height: 20px;
}

.auth-message.success {
  color: #27ae60;
}

.auth-message.error {
  color: #e74c3c;
}

.user-preferences {
  background-color: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

.modal.active {
  display: flex;
}

.modal-content {
  background-color: white;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  position: relative;
}

.close-modal {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--light-text);
}

.modal h2 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.modal p {
  margin-bottom: 16px;
  font-size: 0.95rem;
}

#modal-auth-skip {
  background: none;
  border: none;
  color: var(--light-text);
  margin-top: 12px;
  text-align: center;
  width: 100%;
  font-size: 0.9rem;
  padding: 8px;
}

.modal-auth-message {
  font-size: 0.875rem;
  min-height: 20px;
  margin: 8px 0;
}

/* Loading indicator */
.loading {
  display: none;
  position: absolute;
  top: -38px;
  left: 16px;
  padding: 8px 16px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 2;
}

.typing-indicator {
  display: flex;
  align-items: center;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  float: left;
  margin: 0 1px;
  background-color: var(--light-text);
  display: block;
  border-radius: 50%;
  opacity: 0.4;
}

.typing-indicator span:nth-of-type(1) {
  animation: 1s typing-indicator infinite;
}

.typing-indicator span:nth-of-type(2) {
  animation: 1s typing-indicator 0.33s infinite;
}

.typing-indicator span:nth-of-type(3) {
  animation: 1s typing-indicator 0.66s infinite;
}

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

/* Responsive adjustments */
@media (display-mode: standalone) {
  .app-header {
    padding-top: var(--safe-area-inset-top);
  }
}

/* Specific case for chat tab */
#chat-tab {
  padding-bottom: var(--footer-height);
  display: flex;
  flex-direction: column;
}

/* Add this to your CSS */
.message {
  white-space: pre-line;  /* Preserves line breaks */
}

/* Fix for iOS Safari viewport height */
@supports (-webkit-touch-callout: none) {
  .app-container, body, html {
    height: -webkit-fill-available;
  }
}