@import url('https://fonts.googleapis.com/css2?family=Fascinate+Inline&family=Roboto+Flex:opsz,wght,XOPQ,XTRA,YOPQ,YTDE,YTFI,YTLC,YTUC@8..144,100..1000,96,468,79,-203,738,514,712&display=swap');

/* #region CSS VARIABLES & ROOT */
/* Define CSS variables for consistent theming and easy maintenance */
:root {
  /* ORANGE — Brand scale */
  --orange-100: #FFE6D6;
  /* ultra light background */
  --orange-200: #FFD0B3;
  /* light background */
  --orange-300: #FFB07A;
  /* PRIMARY brand color */
  --orange-700: #B84312;
  /* dark / text on light */
  --text-dark: #441c06;
  --text-light: #807e7e;
  --border-radius: 30px;
  --transition: all 0.3s ease;
  --shadow: 0 4px 12px rgba(63, 28, 3, 0.15);
}

/* #endregion */

/* #region RESET & BASE STYLES */

/* Reset default browser styles for all elements */
* {
  margin: 0;
  box-sizing: border-box;
  /* Include padding and border in element's width/height */
}

/* Main body layout */
body {
  min-height: 100vh;
  /* Minimum height of viewport, can grow with content */
  max-width: 1800px;
  /* Limit maximum width for readability on large screens */
  margin: 0 auto;
  /* Center content horizontally */
  display: flex;
  flex-direction: column;
  /* Stack children vertically */
  font-family: 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--orange-100);
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}

/* Main content area - grows to fill available space (sticky footer technique) */
main {
  flex: 1 0 auto;
  /* Grow to fill space, don't shrink, auto basis */
}

/* Remove default link styling */
a {
  color: inherit;
  /* Use parent element's text color */
  text-decoration: none;
  /* Remove underline */
}

/* Keep consistent color for visited links */
a:visited {
  color: inherit;
}

/* #endregion */

/* #region NAVBAR */
.navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--orange-100);
  z-index: 1000;
}

.navbar .navbar-brand {
  font-weight: 800;
  font-size: 1.2rem;
  background: var(--text-dark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar .nav-link {
  color: var(--text-dark);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s ease;
  margin-left: 0;
  padding: 0.5rem 0 !important;
}

.navbar .nav-link:hover,
.navbar .nav-link:active,
.navbar .nav-link:focus,
.navbar .nav-link.active {
  color: var(--orange-700);
}

.navbar .nav-link.active {
  font-weight: 800;
}

.navbar .navbar-toggler {
  border: none;
  padding: 0.25rem 0.75rem;
}

.navbar .navbar-toggler:focus {
  box-shadow: none;
  outline: none;
}

.navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23E85D1F' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* #endregion */

/* #region HOME PAGE */

/* HERO */

.hero-section {
  padding-top: 4.5rem;
}

.hero-image {
  width: 100%;
  display: block;
}

.hero-content {
  margin-bottom: 1rem;
}

.hero-content h1 {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-dark);
}

.hero-content p {
  font-size: 0.9rem;
  color: var(--text-dark);
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.hero-buttons a {
  font-size: 0.9rem;
}

/* SECTIONS */

/* Alternate background colors for sections */
.full-section:nth-of-type(2) {
  background: var(--orange-200);
}

.full-section:nth-of-type(4) {
  background: var(--orange-200);
}

.section-text h2,
.why-header h2 {
  font-weight: 700;
  color: var(--text-dark);
}

.section-text p,
.why-header p,
.why-card p {
  font-size: 0.9rem;
  color: var(--text-dark);
}

.why-card p {
  margin: 0;
}

.section-image {
  width: 100%;
  display: block;
}

/* WHY SECTION */
.why-section {
  background: var(--orange-200);
}

.why-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.why-card {
  background: white;
  padding: 1rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.why-card h3 {
  font-size: 1rem;
  color: var(--text-dark);
  font-weight: 700;
}

/* #endregion */

/* #region AUTH FORM */

.auth-content {
  position: relative;
  z-index: 2;
  padding: 1.5rem;
}

.auth-content.form-page {
  min-height: 100vh;
  padding: 3rem 1rem;
}

.auth-content.create-owner {
  min-height: 100vh;
  padding: 7rem 1rem;
}

.auth-content.discover-page-wrapper {
  text-align: left;
  padding: 0;
  justify-content: flex-start;
}

.auth-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.auth-content p {
  font-size: 0.8rem;
}

/* #endregion */

/* #region BUTTONS & INTERACTIVE ELEMENTS */

/* --- Primary/Secondary Buttons --- */
.btn {
  padding: 0.75rem 1.75rem;
  border-radius: 50px;
  font-weight: 700;
  transition: all 0.3s ease;
}

.btn.edit {
  padding: 1rem;
}

.btn.primary {
  background: var(--text-dark);
  color: white;
  border: 3px solid var(--text-dark);
}

.btn.primary:hover {
  color: white;
  background-color: var(--orange-700);
  border: 3px solid var(--orange-700);
}

.btn.secondary {
  background: white;
  color: var(--text-dark);
  border: 3px solid var(--text-dark);
}

.btn.secondary:hover {
  color: var(--orange-700);
  border: 3px solid var(--orange-700);
}

/* --- General style for buttons in warning and delete modals --- */
.btn-modal {
  padding: 0.75rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

/* --- Modals Delete Button --- */
.btn-danger {
  background-color: #f87575;
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #e85555;
}

/* --- Modals Cancel Button --- */
.btn-cancel,
.send-msg {
  background-color: #f0f0f0;
  color: var(--text-dark);
  padding: 0.75rem 1rem;
}

.btn-cancel:hover,
.send-msg:hover {
  background-color: #e0e0e0;
}

/* --- Back Button --- */
.back-button,
.back-button-messages {
  transition: background 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  top: 60px;
  left: 16px;
  width: 40px;
  height: 40px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-button-messages {
  position: absolute;
  top: 4.5rem;
  left: 0.5rem;
  z-index: 10;
}

.back-button:hover,
.back-button-messages:hover {
  background: var(--orange-200);
  transform: translateX(-2px);
}

/* --- Conversation Delete Button --- */

/* Trash bin icon */
.btn-delete-conversation {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-delete-conversation img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.btn-delete-conversation:hover {
  background: rgba(248, 117, 117, 0.1);
}

/* --- Delete Match Button --- */

.delete-match-button {
  width: 99%;
  height: 50px;
}

.btn-delete-match {
  width: 40px;
  height: 40px;
  color: #e85555;
  border-radius: 50px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  transition: var(--transition);
}

.btn-delete-match:hover {
  background: rgba(248, 117, 117, 0.15);
}

/* #endregion */

/* #region FORMS & INPUTS */

/* Custom auth-card */
.auth-card-form h1 {
  font-size: 1.5rem;
}

.auth-card p {
  color: var(--text-dark);
}

/* Shared styles for auth forms and profile edit cards */
.form-card,
.auth-card {
  background: white;
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* --- Form Fields --- */

.form-page-container {
  color: var(--text-dark);
  padding: 4rem 0;
}

/* Ensure auth form pages use full available width inside centered flex parent */
.auth-content.form-page .form-page-container.form-with-image {
  align-self: stretch;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.form-page-image {
  display: none;
}

.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-dark);
}

/* --- Sign up link --- */

.auth-redirect p {
  font-size: 0.9rem;
  color: var(--text-dark);
}

.auth-link,
.forgot-password-link {
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s ease;
}

.forgot-password-link {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-dark) !important;
  margin-top: 0.5rem;
}

.auth-link:hover,
.forgot-password-link:hover {
  color: var(--orange-700) !important;
  text-decoration: underline;
}

/* --- Password Input with Toggle --- */
.input-wrapper {
  position: relative;
}

.toggle-password {
  /* Position the toggle button inside the input field, aligned to the right */
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  background: none;
  border: none;
}

.eye-icon {
  filter: grayscale(100%);
  /* Make the icon gray */
}

/* --- Password Reset Success image--- */
.success-image img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  box-shadow: var(--shadow);
  border-radius: 50%;
}

/* --- Create Owner and Dog Profile Forms --- */

h1.form-title {
  font-size: 1.3rem !important;
  font-weight: 700;
  color: var(--text-dark);
}

/* --- Image Upload Box --- */

/* The upload box is a square area with dashed border, rounded corners, and a hover effect */
.upload-box {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 2px dashed #ccc;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition);
}

/* Hover effect for upload box */
.upload-box:hover {
  background: var(--orange-100);
  border-color: var(--orange-300);
}

/* The file input is hidden but covers the entire upload box to capture clicks */
.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-placeholder {
  color: #999;
  font-size: 0.9rem;
}

/* Add a plus icon using a pseudo-element */
.upload-placeholder::before {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  color: #999;
  margin: 0 auto 0.35rem auto;
  background: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E");
}

/* Image preview is hidden by default, shown when an image is present */
.image-preview {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

/* When an image is present, hide the placeholder and show the preview */
.upload-box.has-image .upload-placeholder {
  display: none;
}

/* Show the image preview when an image is present */
.upload-box.has-image .image-preview {
  display: block;
}

/* Remove button appears when an image is present */
.upload-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 18px;
  display: none;
}

/* Show the remove button when an image is present */
.upload-box.has-image .upload-remove {
  display: inline-flex;
}

.owner-profile-photo,
.dog-profile-photo {
  width: 100%;
  max-width: 250px;
}

.owner-create-profile,
.dog-create-profile {
  gap: 1.5rem;
}

.dog-profile-card {
  overflow: visible;
}

.owner-profile-fields,
.dog-profile-fields {
  display: grid;
  grid-template-columns: 1fr;
}

/* --- Interests --- */

/* Pill-style multi-select options for interests */
.pill-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
}

/* Each pill option is a label that contains a hidden checkbox and a styled span for the pill appearance */
.pill-option {
  position: relative;
  cursor: pointer;
}

/* The checkbox input is hidden but still captures clicks on the label */
.pill-option input {
  position: absolute;
  opacity: 0;
}

/* When the checkbox is checked, style the adjacent span to look like a selected pill */
.pill-option input:checked+span {
  background: var(--orange-200);
  border-color: var(--orange-200);
  color: var(--text-dark);
}

/* The span inside the pill option is styled to look like a pill-shaped button */
.pill-option span {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 2px solid #999;
  font-size: 0.85rem;
  transition: var(--transition);
  background: #fff;
}

/* Disables non-selected pills when max selection (3) is reached */
.pill-option.is-disabled span {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Helper text below the pill options */
.pill-helper {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #999;
}

/* --- About me input--- */
.form-field input,
.form-field textarea,
.form-field select {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  border: 2px solid #999;
  background: #ffffff;
  font-size: 0.9rem;
  width: 100%;
  max-width: 100%;
}

/* Custom dropdown arrow for select fields */
.form-field select,
.form-field select:focus {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.25rem center;
  padding-right: 3rem;
}

/* Remove default focus outline and background change on focus */
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
}

/* Textarea specific styles */
textarea {
  resize: none;
  min-height: 120px;
}

/* Character counter below textarea */
.char-counter {
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.25rem;
}

/* Error input message styling */
.form-error {
  color: #c73636;
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

/* --- Django Error Style --- */
.errorlist {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
}

/* Style individual error messages with a red background and border */
.errorlist li {
  color: #c73636;
  font-size: 0.8rem;
  padding: 0.75rem 1rem;
  background-color: rgba(199, 54, 54, 0.1);
  border-left: 3px solid #c73636;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

/* Edit profile form */
.edit-profile-content {
  padding: 5rem 0.8rem 1rem 0.8rem;
}

/* #endregion */

/* #region BROWSE DOG PAGE */

/* Consistent page heading styling */
.discover-page h1,
.matches-page h1,
.messages-inbox-page h1,
.message-thread-page h1,
.view-user-profile-page h1,
.edit-dog-profile-page h1,
.edit-owner-profile-page h1,
.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

/* Wrapper for discover page content */
.discover-page,
.matches-page,
.view-user-profile-page,
.edit-dog-profile-page,
.edit-owner-profile-page {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 30px 12px;
}

/* --- Toggle view visibility (dog/owner) --- */
.hidden {
  display: none;
}

/* --- Toggle dog and owner views --- */
.toggle-btn {
  border: none;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  background: #ffefe4;
  color: var(--text-dark);
  font-weight: 600;
}

/* Active state for toggle buttons */
.toggle-btn.active {
  background: var(--orange-200);
  box-shadow: var(--shadow);
}

/* --- Dog and Owner Profile Card --- */
.profile-card,
.matches-card,
.view-user-profile-card {
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: 1000px;
}

/* --- Image Profil--- */
.profile-image {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}

.profile-image img {
  width: 100%;
  object-fit: cover;
}

/* Overlay at the bottom of the image for name and age ect*/
.image-overlay {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 1rem;
  text-align: left;
  color: white;
  background: linear-gradient(to top, rgb(0 0 0 / 86%), rgba(0, 0, 0, 0));
}

.image-overlay h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.image-overlay p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
}

/* --- Dividers --- */
.profile-divider {
  border: none;
  border-top: 1px solid #b2b0b0;
  margin: 1rem;
}

.profile-about h3,
.profile-interests h3,
.profile-meta h4 {
  color: var(--text-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

.profile-about p {
  font-size: 0.8rem;
}

/* --- Energy level + Size block --- */

.tag {
  background: #ffefe4;
  border-radius: 999px;
  font-size: 0.7rem;
}

/* --- Like and dislike button --- */

.action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dislike {
  background: #ffefe4;
}

.like {
  background: linear-gradient(135deg, #E85D1F, #FFB07A);
  color: #fff;
}

/* --- No more dogs to browse page AND no matches made yet --- */

.empty-dogs-title,
.no-msg-title,
.empty-matches-title {
  font-weight: 400 !important;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

.empty-dogs-subtitle,
.no-msg-subtitle,
.empty-matches-subtitle {
  font-size: 0.9rem;
  color: var(--text-dark);
}

.empty-dogs .empty-state-emoji,
.empty-matches .empty-state-emoji,
.no-msg .empty-state-emoji {
  width: 100px;
  height: 100px;
}

/* #endregion */

/* #region MODALS */

/* --- General modal styles --- */

.modal-overlay,
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-overlay.is-open,
.modal-backdrop.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content,
.match-modal,
.delete-modal,
.delete-message-modal {
  background-color: #ffffff;
  border-radius: var(--border-radius);
  animation: slideUp 0.3s ease;
}

.modal-content,
.delete-modal,
.delete-message-modal {
  max-width: 300px;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2,
.match-modal h2,
.delete-modal h2,
.delete-message-modal h2 {
  font-size: 1.3rem;
  color: var(--text-dark);
}

/* Delete profile modal */

.modal-list li {
  color: var(--text-dark);
}

.modal-list li strong {
  color: #f87575;
}

.modal-warning-text {
  color: #f87575;
  font-weight: 600;
}

.text-background {
  background-color: rgba(248, 117, 117, 0.1);
  border-radius: 10px;
  max-width: 280px;
}

/* Modal it's a match */

.match-modal {
  max-width: 450px;
  position: relative;
}

/* Add a close button to the top right corner of the match modal */
.match-modal .close,
.delete-modal .close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
}

/* Rotate the close button on hover and change color for better visibility */
.match-modal .close:hover,
.delete-modal .close:hover {
  color: #000;
  transform: rotate(90deg);
}

/* Add a heartbeat animation to the heart icon in the match modal */
.match-heart {
  font-size: 2rem;
  animation: heartBeat 1.2s ease-in-out infinite;
}

@keyframes heartBeat {

  0%,
  100% {
    transform: scale(1);
  }

  25% {
    transform: scale(1.2);
  }

  50% {
    transform: scale(1);
  }
}

/* Style the avatars of the matched dogs in the match modal */
.match-avatars img {
  width: 80px;
  height: 80px;
  border-radius: 20%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.30);
}

/* Style the button in the match modal to view the match's profile */
.match-modal-btn {
  max-width: 180px;
}

/* Style the matched dog's name in the match modal and other delete modal */
.match-dog-name,
.delete-msg-dog-name {
  font-weight: 600;
}

/* #endregion */

/* #region MATCHES PAGE */
/* Grid layout for matches and user profile view */
.matches-grid,
.view-user-profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.matches-card {
  position: relative;
}

/* #endregion */

/* #region DANGER ZONE */

.danger-zone {
  border: 3px solid #f87575;
  border-radius: var(--border-radius);
  background-color: rgb(255 255 255);
  max-width: 350px;
}

.danger-zone p {
  color: #f87575;
}

/* #endregion */

/* #region MESSAGING */

/* --- Messages Inbox --- */

/* Container for the entire messages inbox page */
.messages-container-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  width: min(100%, 1200px);
  min-width: 0;
  margin: 0 auto;
}

/* Split container for conversations list and message thread */
.messages-split-container {
  display: block;
  width: 100%;
}

/* Thread preview stays hidden on mobile/tablet, opens on desktop thread page */
.messages-thread-panel {
  display: none;
  /* Hidden on mobile/tablet */
  overflow: hidden;
}

/* Conversation row */
.conversation-item {
  position: relative;
  display: grid;
  padding: 0.4rem 0;
  grid-template-columns: minmax(0, 1fr) auto;
  border-bottom: 1px solid #e0e0e0;
  transition: background-color 0.2s;
  overflow: hidden;
}

.conversation-item:hover {
  background-color: #f9f9f9;
}

.conversation-dog-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.conversation-card {
  width: 100%;
  overflow: hidden;
}

/* Avatar for the dog in the conversation list */
.dog-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.dog-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dog's detail in the conversation list */
.dog-details {
  min-width: 0;
}

.dog-details h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dog-breed {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Last message preview in the conversation list */
.last-message {
  margin: 0;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-date {
  margin-left: 1rem;
  flex-shrink: 0;
}

.last-time {
  font-size: 0.6rem;
  color: var(--text-light);
}

/* -- Messages Thread --- */

.message-thread-page {
  position: relative;
  padding: 4.5rem clamp(0.75rem, 2.5vw, 1.25rem);
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

.messages-inbox-page {
  padding: 4.5rem clamp(0.75rem, 2.5vw, 1.25rem);
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

/* Chat container */
.thread-chat-container {
  position: relative;
  height: calc(100vh - 50px);
  background: #fff;
  border-radius: 16px;
  margin: 0 auto;
  width: min(100%, 950px);
  overflow: hidden;
}

/* Header of the messages thread with receiver's info */
.message-header {
  background: #f9f9f9;
}

/* Receiver avatar */
.receiver-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
}

.receiver-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Receiver text info */
.receiver-info h2 {
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receiver-info p {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receiver-info {
  overflow: hidden;
}

/* --- Messages --- */
.messages-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.message-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.message-bubble {
  max-width: 65%;
  border-radius: 18px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.message-row.sent .message-bubble {
  border-bottom-right-radius: 4px;
  background: var(--orange-100);
}

.message-row.sent .message-time {
  text-align: right;
}

.message-row.received .message-bubble {
  border-bottom-left-radius: 4px;
  background: #f0f0f0;
}

.message-content {
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Animation for each message */
.message-time {
  font-size: 0.7rem;
  opacity: 0.7;
}

.message-row {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Message Input --- */
.message-form-container {
  background: #f9f9f9;
  border-top: 1px solid #eee;
}

.empty-thread {
  flex: 1;
}

.empty-state-text {
  color: var(--text-light);
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Message input area with a text area */
.message-input {
  resize: none;
  border: 2px solid #ddd;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem; /* 16px minimum to prevent iOS auto-zoom on focus */
  width: 100%;
  max-height: 100px;
  overflow-y: auto;
  overflow-x: hidden;
}

.message-input::placeholder {
  color: #999;
}

/* #endregion */

/* #region ERROR PAGES */

/* Section and article must fill main's height for vertical centering to work */
.error-content {
  min-height: 100vh;
  padding: 5rem 1rem;
}

.error-content h1 {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

.error-content h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-dark);
}

.error-content p {
  margin-bottom: 2rem;
  color: var(--text-dark);
}

.error-content img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  box-shadow: var(--shadow);
  border-radius: 50%;
}

.error-btn {
  padding: 0.7rem 1rem;
}

/* #endregion */

/* #region FOOTER */
.site-footer {
  background: var(--text-dark);
  color: #fff;
}

.footer-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.footer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border: 2px solid #fff;
  border-radius: 50%;
  transition: background 0.2s, transform 0.2s;
}

.footer-icon:hover {
  background: #fff2;
  transform: translateY(-4px) scale(1.08);
}

.footer-icon i {
  font-size: 1.3rem;
}

.footer-copyright {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* #endregion */

/* #region RESPONSIVE DESIGN */

/* Tablet: 768px+ */
@media (min-width: 768px) {

  /* HERO SECTION */

  .hero-section>:first-child {
    order: 2;
    flex: 1.2;
    margin: 0;
  }

  .hero-section>:last-child {
    order: 1;
    flex: 1;
    align-content: center;
  }

  /* SECTIONS */
  .full-section {
    align-items: center;
    gap: 2rem;
  }

  .img-size-1 {
    width: 380px;
    height: 190px;
  }

  .img-size-2,
  .img-size-3 {
    width: 400px;
    height: 300px;
  }

  .img-size-4 {
    width: 350px;
    height: 350px;
  }

  .why-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Disable hand cursor on toggle buttons on tablet and above (touch devices don't use cursor) */
  .toggle-btn {
    cursor: default !important;
  }

  .auth-card-form {
    flex: 1;
  }

  .auth-card-split {
    gap: 2.5rem;
  }

  .auth-card-split.success-split {
    flex-direction: row;
    align-items: center;
    gap: 2.5rem;
  }

  .auth-content.form-page .owner-profile-card {
    max-width: 900px;
  }

  .auth-content h1 {
    font-size: 1.5rem;
  }

  /* forgot password side image */
  .form-page-image {
    flex: 1.2;
    display: block;
  }

  .form-page-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* upload-box sizing */
  .owner-profile-photo .upload-box,
  .dog-profile-photo .upload-box {
    min-height: 250px;
  }

  .owner-profile-fields,
  .dog-profile-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 0.5rem;
  }

  /* Hide mobile success image on tablet+ */
  .success-image {
    display: none;
  }

  .discover-page,
  .matches-page,
  .view-user-profile-page {
    max-width: 1000px;
  }

  .profiles-side-by-side,
  .matches-side-by-side,
  .view-user-profile-side-by-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Make hidden views appear on desktop */
  .discover-view.hidden,
  .matches-card .match-view.hidden {
    display: block;
  }

  .profile-card .profile-toggle,
  .matches-card .profile-toggle {
    justify-content: space-around !important;
    width: 100%;
  }

  .profile-card .profile-toggle .toggle-btn,
  .matches-card .profile-toggle .toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20%;
    background: var(--orange-200);
    color: var(--text-dark);
    box-shadow: none;
  }

  .profile-about {
    min-height: 90px;
  }

  /* Modal */
  .modal-content,
  .match-modal,
  .delete-modal,
  .delete-message-modal {
    width: 92%;
  }

  .modal-content,
  .match-modal,
  .delete-modal,
  .delete-message-modal {
    max-width: 450px;
  }

  .match-heart {
    font-size: 2.3rem;
  }

  .match-avatars img {
    width: 110px;
    height: 110px;
  }

  .dog-avatar {
    width: 55px;
    height: 55px;
  }

  .error-content img {
    width: 200px;
    height: 200px;
  }
}

/* Desktop: 992px+ */
@media (min-width: 992px) {
  .navbar .container-fluid {
    max-width: 1800px;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .navbar .navbar-brand {
    font-size: 1.4rem;
  }

  .navbar .nav-link {
    font-size: 1rem;
  }

  .navbar .navbar-nav {
    gap: 0.75rem;
  }

  .navbar .nav-link {
    padding: 0.5rem 0.25rem !important;
  }

  .hero-content h1 {
    font-size: 2.8rem;
  }

  .hero-content p {
    font-size: 1rem;
  }

  .hero-buttons a {
    font-size: 1rem;
  }

  .hero-buttons {
    gap: 2rem;
  }

  .section-text h2,
  .section-text h2,
  .section-text h2,
  .section-text h2,
  .why-header h2 {
    font-size: 2rem;
  }

  .section-text p,
  .section-text p,
  .section-text p,
  .section-text p,
  .why-header p,
  .why-card p {
    font-size: 1rem;
  }

  .why-card h3 {
    font-size: 1.1rem;
  }

  .auth-content.form-page {
    padding-top: 30px;
  }

  .success-text h1 {
    font-size: 2rem !important;
  }

  .success-text p {
    font-size: 1.125rem;
  }

  .profile-about h3,
  .profile-interests h3,
  .profile-meta h4 {
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 600;
  }

  .profile-about p {
    font-size: 0.9rem;
  }

  /* --- Energy level + Size block --- */

  .tag {
    background: #ffefe4;
    border-radius: 999px;
    font-size: 0.7rem;
  }

  /* Desktop split-view: left inbox list + right thread preview */
  .messages-split-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: calc(100vh - 190px);
    overflow: hidden;
  }

  .messages-inbox-panel {
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid #e0e0e0;
  }

  /* Desktop row alignment: delete button on left, chat on the right */
  .conversation-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .conversation-item .btn-delete-conversation {
    order: 1;
  }

  .conversation-item .conversation-card {
    order: 2;
    flex: 1;
  }

  .messages-thread-panel {
    display: flex;
    flex-direction: column;
    border-radius: 0 16px 16px 0;
    background: #fff;
  }

  .messages-inbox-page {
    max-width: 1400px;
    padding: 80px 30px 50px;
  }
}

/* Large Desktop: 1200px+ */
@media (min-width: 1200px) {

  .message-avatar {
    width: 45px;
    height: 45px;
  }

}

/* Extra Large: 1400px+ */
@media (min-width: 1400px) {

  .navbar .nav-link {
    font-size: 1.2rem;
  }

  .hero-section {
    padding-top: 5rem;
  }

  .hero-content h1 {
    font-size: 3.5rem;
  }

  .hero-content p {
    font-size: 1.5rem;
  }

  .hero-buttons a {
    font-size: 1.25rem;
  }

  .section-text h2,
  .section-text h2,
  .section-text h2,
  .section-text h2,
  .why-header h2 {
    font-size: 2.5rem;
  }

  .section-text p,
  .section-text p,
  .section-text p,
  .section-text p,
  .why-header p,
  .why-card p {
    font-size: 1.5rem;
  }

  .full-section {
    gap: 4rem;
  }

  .img-size-1 {
    width: 700px;
    height: 350px;
  }

  .img-size-2,
  .img-size-3 {
    width: 640px;
    height: 480px;
  }

  .img-size-4 {
    width: 580px;
    height: 560px;
  }

  /* --- Back Button --- */
  .back-button,
  .back-button-messages {
    top: 70px;
  }

  .discover-page {
    padding: 40px 12px;
  }

  .profile-page {
    max-width: 1000px;
  }

}

@media (min-width: 1800px) {

  .navbar .nav-link {
    font-size: 1.5rem;
  }

  .img-size-1 {
    width: 760px;
    height: 380px;
  }

  .img-size-2,
  .img-size-3 {
    width: 720px;
    height: 540px;
  }

  .img-size-4 {
    width: 650px;
    height: 630px;
  }
}

/* Landscape mobile: 480px+ */
@media (max-height: 500px) and (orientation: landscape) {

  /* Modals */
  .match-modal,
  .modal-content,
  .delete-modal,
  .delete-message-modal {
    max-height: calc(100vh - 1rem);
    /* Ensure modal doesn't exceed viewport height on landscape mobile */
    max-width: 300px;
  }

  .match-modal h2,
  .modal-content h2,
  .delete-modal h2,
  .delete-message-modal h2 {
    font-size: 0.9rem;
  }

  .match-avatars img {
    width: 56px;
    height: 56px;
  }

  .match-heart {
    font-size: 1.5rem;
  }

  .match-modal>p,
  .modal-content p,
  .delete-modal p,
  .delete-message-modal p,
  .modal-list li {
    font-size: 0.8rem;
  }

  .match-modal-btn .btn,
  .btn-modal {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
  }

  /* Message thread */

  .thread-chat-container {
    height: 500px;
  }
}

/* #endregion */