/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

:root {
  --bg: #ffffff;
  --text: #000000;
  --chat-bg: #f0f0f0;
  --primary: #005066;
  --danger: #ff0000;
  --shadow: rgba(0, 0, 0, 0.1);
  --background-image: url('https://images.unsplash.com/photo-1506748686214-e9df14d4d9d0?auto=format&fit=crop&w=1950&q=80');
}

body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image: var(--background-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--text);
  transition: background-color 0.3s, color 0.3s;
}

/* Dark Mode */
body.dark-mode {
  --bg: #121212;
  --text: #f0f0f0;
  --chat-bg: #1e1e1e;
}

/* Theme Buttons */
.theme-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}
.theme-buttons button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background-color: var(--primary);
  color: white;
  cursor: pointer;
  font-size: 14px;
}

/* Container & Layout */
.container {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--shadow);
  backdrop-filter: blur(4px);
}
body.dark-mode .container {
  background-color: #1e1e1e;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.logo {
  width: 100px;
  height: 50px;
  object-fit: contain;
}
h1, h2, h3 {
  text-align: center;
  color: var(--primary);
  margin-top: 20px;
}

/* Navigation */
nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  justify-content: center;
  background-color: var(--primary);
  border-radius: 5px;
  flex-wrap: wrap;
}
nav ul li {
  margin: 0 15px;
  position: relative;
}
nav ul li a {
  color: white;
  text-decoration: none;
  font-weight: bold;
}
nav ul li a:hover {
  text-decoration: underline;
}
nav ul li a.crisis-link {
  color: var(--danger);
}
nav ul li ul.dropdown {
  display: none;
  position: absolute;
  top: 35px;
  background-color: var(--primary);
  padding: 10px;
  border-radius: 6px;
  list-style: none;
  z-index: 999;
}
nav ul li:hover ul.dropdown {
  display: block;
}
nav ul li ul.dropdown li {
  margin: 5px 0;
}
nav ul li ul.dropdown li a {
  color: white;
  font-weight: normal;
}

/* Inputs & Buttons */
input, textarea, button, select {
  display: block;
  width: 100%;
  max-width: 400px;
  margin: 10px auto;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
}
textarea {
  height: 150px;
  resize: vertical;
}
button {
  background: linear-gradient(to right, #007bff, #0056b3);
  color: white;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}
button:hover {
  transform: scale(1.03);
}
#logout-btn {
  background-color: var(--danger);
}
#logout-btn:hover {
  background-color: #cc0000;
}

/* Auth Section */
#auth-section, #user-info {
  text-align: center;
}

/* Chat Styles */
.chat-container {
  max-width: 600px;
  margin: 30px auto;
  padding: 20px;
  border-radius: 12px;
  background: var(--chat-bg);
}
.chat-box {
  height: 400px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 12px;
  background-color: var(--chat-bg);
  margin-bottom: 15px;
}
.chat-message {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 10px;
}
.chat-message.user {
  justify-content: flex-end;
  flex-direction: row-reverse;
}
.chat-message.bot .avatar,
.chat-message.user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.chat-message .bubble {
  background-color: #e2f0d9;
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 70%;
  line-height: 1.4;
}
.chat-message.user .bubble {
  background-color: #d1e7ff;
}
.typing-indicator {
  font-style: italic;
  color: gray;
  margin: 8px 0;
}
.timestamp {
  font-size: 0.8em;
  color: gray;
  margin-left: 8px;
}
.speak-btn {
  background: none;
  border: none;
  font-size: 1em;
  cursor: pointer;
  margin-left: 5px;
}

/* Mood Tracker */
.mood-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mood-buttons button {
  font-size: 24px;
  padding: 10px 20px;
}

/* Breathing Exercise */
#breathing-circle {
  width: 120px;
  height: 120px;
  background-color: var(--primary);
  border-radius: 50%;
  margin: 20px auto;
  animation: breathe 4s infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}

/* Progress Bar */
#progress-bar {
  width: 100%;
  max-width: 400px;
  height: 10px;
  background-color: #ccc;
  border-radius: 5px;
  margin: 10px auto;
}
#progress-bar::after {
  content: '';
  display: block;
  width: 0;
  height: 100%;
  background-color: var(--primary);
  transition: width 1s linear;
}
#timer, #breathing-cue {
  text-align: center;
  font-size: 18px;
  color: var(--primary);
}

/* Audio Section */
.audio-controls {
  text-align: center;
  margin-top: 20px;
}
.audio-controls input[type="file"] {
  margin-bottom: 10px;
}
.audio-controls audio {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
}

/* Social Icon */
.social-icon {
  position: absolute;
  top: 20px;
  right: 20px;
}
.social-icon img {
  width: 24px;
  height: 24px;
  opacity: 0.8;
  transition: opacity 0.3s;
}
.social-icon img:hover {
  opacity: 1;
}

/* Community Page */
#user-post {
  height: 120px;
  resize: vertical;
}
#submit-post {
  background: linear-gradient(to right, #0084ff, #0047ab);
  color: white;
  font-weight: bold;
}
#moderation-status {
  text-align: center;
  font-style: italic;
  color: var(--primary);
  margin: 10px 0;
  display: none;
}
.community-message {
  padding: 12px;
  background-color: #f0faff;
  border-radius: 8px;
  margin-bottom: 10px;
  animation: fadeIn 0.5s ease-in-out;
}
body.dark-mode .community-message {
  background-color: #1d2d3c;
}

/* Animations */
@keyframes fadeIn {
  to { opacity: 1; }
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    margin: 10px;
    padding: 15px;
  }
  nav ul {
    flex-direction: column;
    align-items: center;
  }
  nav ul li {
    margin: 10px 0;
  }
  .mood-buttons {
    flex-direction: column;
    align-items: center;
  }
  .mood-buttons button {
    width: 100%;
    max-width: 200px;
  }
}
/* --- Community posts styling --- */
.post-card {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0.85;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.post-user {
  font-weight: 600;
}

.post-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.post-text {
  margin: 0.4rem 0;
  white-space: pre-wrap;
  line-height: 1.4;
}

.post-actions {
  margin-top: 0.5rem;
}

.like-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.95rem;
  color: inherit;
  transition: background 0.2s ease;
}

.like-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
