@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Playfair+Display:wght@400;600;700&family=Quicksand:wght@400;500;600&family=Poppins:wght@400;500;600&family=Cormorant+Garamond:wght@400;500;600&family=Merriweather:wght@400;700&family=Roboto:wght@400;500&family=Raleway:wght@400;500;600&display=swap');

html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: 'Merriweather', serif;
  background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)),
              url('/static/nature-3194001_1280.jpg') no-repeat center center fixed;
  background-size: cover;
  background-attachment: scroll;
  color: white;
  display: flex;
  flex-direction: column;
  height: 100vh;
  -webkit-overflow-scrolling: touch;
  justify-content: center;
  align-items: center;
}

/* Sign-in page specific body styling */
body:has(.signin-container) {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.signin-container {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 2rem 3rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  text-align: center;
  will-change: transform; /* Optimize for animations */
  margin: auto;
  position: relative;
  overflow: hidden;
}

.signin-container::before {
  content: '🌙';
  position: absolute;
  top: -20px;
  right: -20px;
  font-size: 4rem;
  opacity: 0.1;
  animation: moonSpin 20s linear infinite;
  pointer-events: none;
  z-index: 0;
}

.signin-container > * {
  position: relative;
  z-index: 1;
}

@keyframes moonSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* App loading animation - subtle startup animation */
.app-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(rgba(0,0,0,0.9), rgba(0,0,0,0.9)),
              url('/static/nature-3194001_1280.jpg') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.3s ease;
  pointer-events: none; /* Don't block interactions */
}

/* Ensure dream feed is ready to display */
#dream-feed {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-content {
  text-align: center;
  color: white;
}

.moon-fade {
  font-size: 3rem;
  animation: moonFade 2s ease-in-out infinite;
  margin-bottom: 20px;
}

.loading-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: #64A6BD;
  opacity: 0.9;
  animation: textFade 2s ease-in-out infinite;
  animation-delay: 0.5s;
}

@keyframes moonFade {
  0%, 100% { 
    opacity: 0.6; 
    transform: scale(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.1);
  }
}

@keyframes textFade {
  0%, 100% { 
    opacity: 0.7; 
  }
  50% { 
    opacity: 1; 
  }
}

/* Loading moon animation - for other uses */
.loading-moon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.moon-spinner {
  font-size: 4rem;
  animation: moonSpin 2s linear infinite;
  opacity: 0.9;
}

.signin-container h1 {
  font-size: 2rem;
  color: #fff;
  margin-bottom: 1rem;
}

.signin-container p {
  font-size: 0.95rem;
  margin-bottom: 2rem;
  color: #ddd;
}

.signin-container input[type="text"],
.signin-container input[type="email"],
.signin-container input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.signin-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  background-color: #64A6BD;
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-family: 'Quicksand', sans-serif;
}

.signin-btn:hover {
  background-color: #4d8da3;
}

.footer-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #bbb;
}

/* Reset body for main app pages */
body:has(.container) {
  justify-content: flex-start;
  align-items: stretch;
  height: 100vh;
  overflow: hidden;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 20px 0 20px;
  box-sizing: border-box;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 90px;
  height: calc(100vh - 70px);
}

.navigation {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 9999;
  box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.3);
  height: 70px;
  padding: 0 10px;
  box-sizing: border-box;
  /* iOS safe area support */
  padding-bottom: max(env(safe-area-inset-bottom), 10px);
}

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  color: #999;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 0.65rem;
  text-align: center;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  position: relative;
}

.nav-link:active {
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  color: #64A6BD;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  background: #64A6BD;
  border-radius: 0 0 3px 3px;
}

.nav-link span:first-child {
  font-size: 1.3rem;
  line-height: 1;
  margin-bottom: 2px;
}

.nav-link span:last-child {
  font-size: 0.6rem;
  opacity: 0.9;
  white-space: nowrap;
}

h1 {
  text-align: center;
  color: #64A6BD;
  font-size: 3rem;
  margin-bottom: 1.5rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}

.dream-form {
  background: rgba(255, 255, 255, 0.2);
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
  box-sizing: border-box;
}

textarea {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  box-sizing: border-box;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 16px;
  /* Prevent zoom on iOS when focusing input */
  -webkit-appearance: none;
  /* Optimize scrolling */
  -webkit-overflow-scrolling: touch;
  /* Prevent layout shift */
  contain: layout;
}

textarea::placeholder {
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
}

button {
  background: #64A6BD;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
}

.dream-post {
  background: rgba(255, 255, 255, 0.2);
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
}

.checkbox-wrapper {
  margin: 10px 0;
}

.character-count {
  text-align: right;
  font-size: 0.8rem;
  color: #bbb;
  margin: 5px 0;
}

.dream-card, .dream-post {
  background: rgba(255, 255, 255, 0.2);
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateZ(0); /* Force hardware acceleration */
  will-change: transform;
}

.dream-meta {
  margin-bottom: 15px;
  color: #bbb;
  font-size: 0.9rem;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64A6BD, #4d8da3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-pic-small {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-text-small {
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
}

.author-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dream-author {
  color: #64A6BD;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.dream-author:hover {
  text-decoration: underline;
}

.dream-timestamp {
  color: #888;
  font-size: 0.85em;
}

.dream-title {
  color: #64A6BD;
  margin: 10px 0;
  font-family: 'Playfair Display', serif;
  font-weight: 600;
}

.private-badge {
  background: #64A6BD;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 10px;
  font-size: 0.8em;
}

.dream-interpretation, .interpretation {
  margin-top: 10px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  line-height: 1.5;
}

.toggle-interpretation, .interpret-btn {
  background: #64A6BD;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  margin: 10px 0;
  transition: background-color 0.3s ease;
}

.toggle-interpretation:hover, .interpret-btn:hover {
  background: #4d8da3;
}

.dream-controls {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.control-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.9em;
  transition: opacity 0.3s ease;
}

.control-btn:hover {
  opacity: 0.8;
}

.control-btn.edit {
  background: #64A6BD;
  color: white;
}

.control-btn.privacy {
  background: #64A6BD;
  color: white;
}

.control-btn.delete {
  background: #ff4444;
  color: white;
}

/* Paywall Styles */
.paywall-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(10px);
}

.paywall-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  padding: 0;
  max-width: 450px;
  width: 90%;
  max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(100, 166, 189, 0.3);
  overflow: hidden;
  animation: paywallSlideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

@keyframes paywallSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.paywall-header {
  background: linear-gradient(135deg, #64A6BD 0%, #4d8da3 100%);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.paywall-header h2 {
  margin: 0;
  color: white;
  font-size: 1.5rem;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.paywall-content {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.premium-features h3 {
  color: #64A6BD;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.premium-features ul {
  list-style: none;
  padding: 0;
  margin: 0 0 30px 0;
}

.premium-features li {
  color: #ddd;
  padding: 8px 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pricing-section {
  text-align: center;
  margin: 30px 0;
}

.price-card {
  background: rgba(100, 166, 189, 0.1);
  border: 2px solid rgba(100, 166, 189, 0.3);
  border-radius: 12px;
  padding: 20px;
}

.price {
  font-size: 3rem;
  font-weight: bold;
  color: #64A6BD;
  margin-bottom: 10px;
}

.price span {
  font-size: 1.2rem;
  color: #bbb;
}

.price-card p {
  color: #ddd;
  margin: 0;
  font-size: 0.9rem;
}

.paywall-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 30px 0;
}

.premium-btn {
  background: linear-gradient(135deg, #64A6BD 0%, #4d8da3 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(100, 166, 189, 0.3);
}

.premium-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(100, 166, 189, 0.4);
}

.cancel-btn {
  background: none;
  color: #bbb;
  border: 1px solid rgba(187, 187, 187, 0.3);
  padding: 12px 30px;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.paywall-footer {
  text-align: center;
  margin-top: 20px;
}

.paywall-footer p {
  color: #bbb;
  font-size: 0.9rem;
  margin: 0;
}

.premium-badge {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
  margin-left: 10px;
}

/* Like Button Styles */
.dream-actions {
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}

.share-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.like-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  color: #bbb;
  background: rgba(255, 255, 255, 0.1);
}

.like-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.like-btn.liked {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

.heart-icon {
  font-size: 1.2rem;
  transition: transform 0.2s ease; /* Shorter transition for mobile */
  transform: translateZ(0); /* Hardware acceleration */
}

.like-btn:hover .heart-icon {
  transform: scale(1.2);
}

/* Disable hover effects on touch devices */
@media (hover: none) {
  .like-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
  }

  .like-btn:hover .heart-icon {
    transform: translateZ(0);
  }

  .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .profile-avatar:hover {
    transform: none;
  }

  .dream-preview:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.2);
  }
}

.like-count {
  font-weight: 600;
  min-width: 20px;
  text-align: left;
}

.share-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  padding: 6px 12px;
  border-radius: 16px;
  color: #bbb;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Likes Modal Styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
  margin: 10% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 70vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
}

.close {
  color: #bbb;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close:hover {
  color: #fff;
}

.likes-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 10px 0;
}

.like-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.like-username {
  color: #64A6BD;
  text-decoration: none;
  font-weight: 600;
}

.like-username:hover {
  color: #7bb3d1;
  text-decoration: underline;
}

.like-time {
  color: #888;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .modal-content {
    margin: 20% auto;
    width: 95%;
  }
};
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #64A6BD;
  transform: translateY(-1px);
}

.share-btn span {
  font-size: 0.9rem;
}

.like-animation {
  animation: likeAnimation 0.3s ease;
}

@keyframes likeAnimation {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Guest Banner Styles */
.guest-banner .signin-btn {
  background: #64A6BD;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.95rem;
}

.guest-banner .signin-btn:hover {
  background: #4d8da3;
}

/* Modern Profile Styles */
.profile-header {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 30px;
  margin: 20px 0;
  text-align: center;
}

.profile-banner {
  position: relative;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64A6BD, #4d8da3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  transition: transform 0.3s ease;
}

.profile-avatar:hover {
  transform: scale(1.05);
}

.avatar-text {
  font-size: 3rem;
  font-weight: 600;
  color: white;
}

.avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: white;
  font-size: 0.9rem;
}

.profile-avatar:hover .avatar-overlay {
  opacity: 1;
}

.profile-info {
  margin-top: 20px;
}

.profile-name {
  font-size: 2rem;
  margin: 10px 0;
  color: white;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
}

.profile-bio {
  color: #bbb;
  margin: 10px 0 20px 0;
  font-size: 1.1rem;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 20px;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: #64A6BD;
}

.stat-label {
  color: #bbb;
  font-size: 0.9rem;
}

.legal-links {
  text-align: center;
  margin: 20px 0;
  padding: 15px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.legal-link {
  color: #64A6BD;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.legal-link:hover {
  color: #4d8da3;
  text-decoration: underline;
}

.separator {
  margin: 0 15px;
  color: #999;
}

.profile-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
}

.action-btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  font-family: 'Quicksand', sans-serif;
}

.action-btn.primary {
  background: #64A6BD;
  color: white;
}

.action-btn.primary:hover {
  background: #4d8da3;
  transform: translateY(-2px);
}

.action-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.action-btn.danger {
  background: #dc3545;
  color: white;
}

.action-btn.danger:hover {
  background: #c82333;
}

.action-btn.danger:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

.delete-warning {
  margin: 20px 0;
  text-align: left;
}

.delete-warning p {
  margin-bottom: 10px;
}

.delete-warning ul {
  margin: 10px 0 10px 20px;
}

.delete-warning li {
  margin-bottom: 5px;
}

.delete-warning input {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border: 2px solid #dc3545;
  border-radius: 5px;
  font-size: 16px;
}

.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.profile-tabs {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 30px 0 20px 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 5px;
}

.tab-btn {
  padding: 12px 24px;
  border: none;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.tab-btn.active {
  background: #64A6BD;
  color: white;
}

.tab-content {
  display: none;
}

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

.dreams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.dream-preview {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.dream-preview:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.15);
}

.dream-preview h4 {
  color: #64A6BD;
  margin: 0 0 10px 0;
  font-size: 1.1rem;
}

.dream-preview p {
  color: #ddd;
  line-height: 1.5;
  margin: 10px 0;
}

.dream-preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
}

.dream-date {
  font-size: 0.8rem;
  color: #bbb;
}

.privacy-badge {
  font-size: 0.8rem;
}

.interpretation-preview {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  border-left: 3px solid #64A6BD;
}

.interpretation-preview p {
  color: #ddd;
  font-style: italic;
  margin: 0;
}

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

.modal-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  color: white;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: 'Roboto', sans-serif;
}

.form-group input,
.form-group textarea {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1rem;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Search Styles */
.search-container {
  margin: 20px 0;
  display: flex;
  justify-content: center;
}

.search-form {
  width: 100%;
  max-width: 600px;
}

.search-input-wrapper {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  padding: 5px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: white;
  font-size: 1rem;
  outline: none;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-btn {
  background: #64A6BD;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background-color 0.3s ease;
}

.search-btn:hover {
  background: #4d8da3;
}

.search-results {
  margin-top: 30px;
}

.search-results h3 {
  color: #64A6BD;
  margin-bottom: 20px;
  text-align: center;
}

.user-card {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 20px;
  margin: 15px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.user-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.user-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64A6BD, #4d8da3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar .avatar-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
}

.user-details {
  flex: 1;
}

.user-name {
  color: white;
  margin: 0 0 5px 0;
  font-size: 1.2rem;
}

.user-stats {
  color: #bbb;
  margin: 0 0 10px 0;
  font-size: 0.9rem;
}

.recent-dreams {
  margin-top: 8px;
}

.recent-label {
  color: #64A6BD;
  font-size: 0.8rem;
  margin: 0 0 5px 0;
}

.dream-snippet {
  display: block;
  color: #ddd;
  font-size: 0.8rem;
  margin: 2px 0;
  font-style: italic;
}

.user-actions {
  flex-shrink: 0;
}

.view-profile-btn {
  background: #64A6BD;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.view-profile-btn:hover {
  background: #4d8da3;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #bbb;
}

.search-prompt {
  text-align: center;
  padding: 40px 20px;
  color: #bbb;
}

.search-prompt h3 {
  color: #64A6BD;
  margin-bottom: 10px;
}

.no-dreams {
  text-align: center;
  padding: 40px 20px;
  color: #bbb;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  margin: 20px 0;
}

.profile-section {
  margin: 30px 0;
}

.profile-section h3 {
  color: #64A6BD;
  margin-bottom: 20px;
  text-align: center;
}

/* Dream Analysis Page Styles */
.analysis-container {
  max-width: 1000px;
  margin: 0 auto;
}

.analysis-intro {
  text-align: center;
  margin: 30px 0 50px 0;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 30px;
}

h2, h3, h4 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
}

.analysis-intro h2 {
  color: #64A6BD;
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.analysis-intro p {
  font-size: 1.2rem;
  color: #ddd;
  line-height: 1.6;
}

.analysis-section {
  margin: 40px 0;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 30px;
}

.section-header {
  text-align: center;
  margin-bottom: 30px;
}

.section-header h3 {
  color: #64A6BD;
  font-size: 2rem;
  margin-bottom: 10px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
}

.section-header p {
  color: #bbb;
  font-size: 1.1rem;
  font-style: italic;
}

.analysis-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.analysis-card {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 25px;
  transition: all 0.3s ease;
}

.analysis-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-5px);
}

.analysis-card h4 {
  color: #64A6BD;
  font-size: 1.3rem;
  margin-bottom: 15px;
}

.analysis-card p {
  color: #ddd;
  line-height: 1.6;
  margin-bottom: 15px;
}

.analysis-card ul {
  color: #ddd;
  line-height: 1.8;
  padding-left: 20px;
}

.analysis-card li {
  margin-bottom: 8px;
}

.analysis-card strong {
  color: #64A6BD;
  font-weight: 600;
}

.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.theme-card {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
  border-left: 4px solid #64A6BD;
}

.theme-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-3px);
  border-left-color: #4d8da3;
}

.theme-card h4 {
  color: #64A6BD;
  font-size: 1.2rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-card p {
  color: #ddd;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 10px;
}

.analysis-footer {
  text-align: center;
  margin: 50px 0 30px 0;
  background: rgba(100, 166, 189, 0.1);
  border-radius: 16px;
  padding: 40px;
  border: 2px solid rgba(100, 166, 189, 0.3);
}

.analysis-footer h3 {
  color: #64A6BD;
  font-size: 2rem;
  margin-bottom: 15px;
}

.analysis-footer p {
  color: #ddd;
  font-size: 1.1rem;
  margin-bottom: 25px;
  line-height: 1.6;
}

/* Footer Styles */
.footer {
  margin-top: 60px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 40px 0 20px 0;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-section h4 {
  color: #64A6BD;
  margin-bottom: 15px;
  font-size: 1rem;
}

.footer-section p {
  color: #bbb;
  font-size: 0.9rem;
  line-height: 1.5;
}

.footer-section a {
  display: block;
  color: #bbb;
  text-decoration: none;
  margin: 8px 0;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: #64A6BD;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #888;
  font-size: 0.8rem;
}

.social-stats {
  color: #64A6BD;
  font-size: 0.9rem;
  margin-top: 10px;
}

/* Error Page Styles */
.error-page {
  text-align: center;
  padding: 60px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  margin: 40px 0;
}

.error-content h2 {
  color: #64A6BD;
  font-size: 2rem;
  margin-bottom: 20px;
  font-family: 'Montserrat', sans-serif;
}

.error-content p {
  color: #ddd;
  font-size: 1.1rem;
  margin-bottom: 30px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Mobile Performance Optimizations */
@media (max-width: 768px) {
  body {
    background-attachment: scroll;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  /* Mobile sign-in container adjustments */
  .signin-container {
    padding: 1.5rem 2rem;
    max-width: 350px;
    margin: 20px;
  }

  .signin-container h1 {
    font-size: 1.5rem;
  }

  /* Mobile main app layout - Portrait mode fix */
  body:has(.container) {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
  }

  .container {
    padding: 10px 15px 0 15px;
    padding-bottom: 85px;
    height: calc(100vh - 70px);
    height: calc(100dvh - 70px); /* Dynamic viewport height */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .navigation {
    height: 65px;
    padding: 0 5px;
    padding-bottom: max(env(safe-area-inset-bottom), 8px);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
  }

  .nav-link {
    padding: 4px 2px;
    font-size: 0.6rem;
    gap: 1px;
  }

  .nav-link span:first-child {
    font-size: 1.2rem;
  }

  .nav-link span:last-child {
    font-size: 0.55rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Simplify backdrop filters on mobile for better performance */
  .signin-container,
  .dream-card, 
  .dream-post,
  .profile-header,
  .analysis-section,
  .modal-content {
    backdrop-filter: blur(5px); /* Reduced blur for mobile */
    -webkit-backdrop-filter: blur(5px);
  }

  /* Optimize font loading on mobile */
  * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  

  .dream-form, .dream-post, .dream-card {
    padding: 15px;
    margin: 15px 0;
  }

  textarea {
    font-size: 16px;
    padding: 12px;
  }

  .dream-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .dream-actions {
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
  }

  .like-btn {
    padding: 6px 10px;
    font-size: 0.9rem;
  }

  .share-buttons {
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
  }

  .share-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .profile-header {
    padding: 20px;
  }

  .profile-avatar {
    width: 100px;
    height: 100px;
  }

  .avatar-text {
    font-size: 2.5rem;
  }

  .profile-name {
    font-size: 1.5rem;
  }

  .profile-stats {
    gap: 20px;
  }

  .profile-actions {
    flex-direction: column;
    align-items: center;
  }

  .action-btn {
    width: 200px;
  }

  .dreams-grid {
    grid-template-columns: 1fr;
  }

  .profile-tabs {
    flex-direction: column;
    gap: 0;
  }

  .tab-btn {
    padding: 10px 20px;
  }

  .form-actions {
    flex-direction: column;
  }

  .user-card {
    flex-direction: column;
    text-align: center;
    gap: 15px;
    padding: 15px;
  }

  .user-info {
    flex-direction: column;
    text-align: center;
  }

  .search-input-wrapper {
    border-radius: 12px;
  }

  .search-container {
    margin: 15px 0;
    padding: 0 10px;
  }

  .analysis-intro {
    padding: 20px;
  }

  .analysis-intro h2 {
    font-size: 2rem;
  }

  .analysis-intro p {
    font-size: 1rem;
  }

  .section-header h3 {
    font-size: 1.5rem;
  }

  .analysis-content {
    grid-template-columns: 1fr;
  }

  .themes-grid {
    grid-template-columns: 1fr;
  }

  .analysis-section {
    padding: 20px;
    margin: 20px 0;
  }

  .analysis-card {
    padding: 20px;
  }

  .theme-card {
    padding: 15px;
  }

  .analysis-footer {
    padding: 25px;
  }

  .analysis-footer h3 {
    font-size: 1.5rem;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
  }

  .signin-container {
    padding: 1rem 1.5rem;
  }

  /* Mobile paywall adjustments */
  .paywall-modal {
    width: 95%;
    max-height: 85vh;
    margin: 10px;
  }

  .paywall-header {
    padding: 15px;
  }

  .paywall-header h2 {
    font-size: 1.3rem;
  }

  .paywall-content {
    padding: 20px;
    max-height: calc(85vh - 120px);
  }

  .premium-features ul {
    margin-bottom: 20px;
  }

  .premium-features li {
    font-size: 0.9rem;
    padding: 6px 0;
  }

  .pricing-section {
    margin: 20px 0;
  }

  .price {
    font-size: 2.5rem;
  }

  .paywall-actions {
    margin: 20px 0;
  }

  .premium-btn, .cancel-btn {
    padding: 12px 20px;
    font-size: 1rem;
  }
}

/* Portrait orientation specific fixes */
@media (max-width: 768px) and (orientation: portrait) {
  body:has(.container) {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .container {
    height: calc(100vh - 75px);
    height: calc(100dvh - 75px);
    min-height: calc(100vh - 75px);
    min-height: calc(100dvh - 75px);
    padding-bottom: 90px;
  }

  .navigation {
    height: 70px;
    position: fixed !important;
    bottom: 0 !important;
    z-index: 10000 !important;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.6rem;
    margin-bottom: 0.25rem;
  }

  .signin-container {
    padding: 1rem 1.5rem;
    margin: 15px;
  }

  .signin-container h1 {
    font-size: 1.3rem;
  }

  .container {
    padding: 10px;
    padding-bottom: 80px;
    height: calc(100vh - 65px);
    height: calc(100dvh - 65px);
  }

  .navigation {
    height: 60px;
    padding: 0 2px;
    padding-bottom: max(env(safe-area-inset-bottom), 6px);
  }

  .nav-link {
    padding: 3px 1px;
    font-size: 0.55rem;
    gap: 1px;
  }

  .nav-link span:first-child {
    font-size: 1.1rem;
  }

  .nav-link span:last-child {
    font-size: 0.5rem;
  }

  .dream-form, .dream-post, .dream-card {
    padding: 12px;
  }

  .profile-header {
    padding: 15px;
  }

  .profile-avatar {
    width: 80px;
    height: 80px;
  }

  .avatar-text {
    font-size: 2rem;
  }

  .profile-name {
    font-size: 1.3rem;
  }

  .profile-stats {
    flex-direction: column;
    gap: 15px;
  }

  .analysis-intro {
    padding: 15px;
  }

  .analysis-section {
    padding: 15px;
  }

  .analysis-card, .theme-card {
    padding: 15px;
  }

  .signin-container {
    padding: 1rem 1.5rem;
  }

  /* Mobile paywall adjustments */
  .paywall-modal {
    width: 95%;
    max-height: 85vh;
    margin: 10px;
  }

  .paywall-header {
    padding: 15px;
  }

  .paywall-header h2 {
    font-size: 1.3rem;
  }

  .paywall-content {
    padding: 20px;
    max-height: calc(85vh - 120px);
  }

  .premium-features ul {
    margin-bottom: 20px;
  }

  .premium-features li {
    font-size: 0.9rem;
    padding: 6px 0;
  }

  .pricing-section {
    margin: 20px 0;
  }

  .price {
    font-size: 2.5rem;
  }

  .paywall-actions {
    margin: 20px 0;
  }

  .premium-btn, .cancel-btn {
    padding: 12px 20px;
    font-size: 1rem;
  }
}