/* Listing Wishes - Global Styles */

/* Font Face Declarations - Playpen Sans (Local) */
@font-face {
  font-family: 'Playpen Sans';
  src: url('/static/fonts/PlaypenSans-Thin.ttf') format('truetype');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playpen Sans';
  src: url('/static/fonts/PlaypenSans-ExtraLight.ttf') format('truetype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playpen Sans';
  src: url('/static/fonts/PlaypenSans-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playpen Sans';
  src: url('/static/fonts/PlaypenSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playpen Sans';
  src: url('/static/fonts/PlaypenSans-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playpen Sans';
  src: url('/static/fonts/PlaypenSans-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playpen Sans';
  src: url('/static/fonts/PlaypenSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playpen Sans';
  src: url('/static/fonts/PlaypenSans-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* Color Palette */
:root {
  --cl-dark: #432323;
  --primary: #2f574a;
  --secondary: #5a9682;
  --cl-light: #E0D9D9;
  --cl-white: #ffffff;
  --remove-btn: #d9534f;
  --card-border: #900000;
  --section-border: #846547;
  --body-background: linear-gradient(180deg, #5a4530 0%, #846547 50%, #5a4530 100%);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
  --radius: 10px;
}

* { box-sizing: border-box; }
html {
  height: 100%;
}
body {
  margin: 0;
  font-family: "Playpen Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--cl-dark);
  background: var(--body-background);
}
button {
  font-family: inherit;
}
div {
  gap: 8px;
}
p {
  margin: 4px 0;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--primary);
  /* background: rgb(73, 0, 0); */
  color: var(--cl-light);
  box-shadow: var(--shadow-sm);
}
.brand {
  font-size: 1.4rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.brand img {
  height: 42px;
  margin-right: 10px;
}
.navbar .brand a {
  color: var(--cl-light);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
}
.navbar .nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.navbar .nav-link {
  color: var(--cl-light);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.2s ease;
}
.navbar .nav-link:hover {
  background: rgba(122, 0, 0, 0.932);
}

.nav-link {
  align-content: center;
}

#nav-auth {
  flex-direction: row;
}

.navbar .search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(224, 217, 217, 0.15);
  padding: 6px;
  border-radius: 8px;
}
.navbar .search input[type="search"] {
  border: none;
  outline: none;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--cl-white);
  min-width: 220px;
}
.navbar .search button {
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--secondary);
  color: var(--cl-white);
  cursor: pointer;
}

.search-friends {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-wishlists {
  display: flex;
  align-items: center;
  gap: 6px;
}

.avatar-link {
  display: inline-flex;
  align-items: center;
}
#avatar-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--cl-light);
  background: var(--cl-white);
}

/* Layout */
.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

.row {
  display: flex;
  flex-direction: row;
}

.donate-div {
    display: flex;
    flex-direction: row;
    justify-content: center;
}
.donate-div > div {
    max-width: 465px;
    padding: 0 20px;
}
@media (max-width: 768px) {
    .donate-div {
        flex-direction: column;
        align-items: center;
    }
}

/* Cards and grids */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--cl-white);
  border: 2px solid var(--card-border);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-sm);
  gap: 16px;
  overflow: hidden;
  word-wrap: break-word;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card .title {
  font-weight: 700;
  margin: 0 0 6px 0;
}
.card .subtitle {
  color: #5a5555;
  margin: 0 0 10px 0;
  font-size: 0.9rem;
}
.card .row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

a.card {
  text-decoration: none;
  color: inherit;
}

.card.collection-card {
  max-width: 12rem;
  max-width: 12rem;
}

.friend-card {
  width: 10rem;
  word-wrap: anywhere;
}

.member-card {
  display: flex;
  flex-direction: column;
  width: 10rem;
}

.wishlist-card {
  display: flex;
  flex-direction: column;
  max-width: 14rem;
  word-wrap: anywhere;
}

.wishlist-item-card {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  max-width: 13rem;
}

.item-card-title-view {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.item-link {
  text-decoration: none;
  word-break: break-all;
  background-color: var(--secondary);
  color: var(--cl-white);
}

.item-title-img-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: space-between;
  width: 50%;
}

.item-image-wrapper {
  /* To contain image and add border radius */
  border-radius: 12px;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

/* Ensure images inside the wrapper scale to fill while preserving aspect ratio.
   Use `object-fit: cover` to crop and fill, or `object-fit: contain` to fit fully
   inside the wrapper without cropping. */
.item-image-wrapper img {
  width: 100%;
  object-fit: cover; /* change to 'contain' if you prefer no cropping */
}

.user-search-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

#collection-description {
  max-width: 15rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
  font-weight: 600;
  max-width: 120px;
  color: var(--cl-dark)
}
.btn-primary {
  background: var(--secondary);
  color: var(--cl-white);
  text-decoration: none;
}
.btn-primary:hover { filter: brightness(0.98); }
.btn-secondary {
  background: var(--cl-light);
  color: var(--cl-dark);
  text-decoration: none;
}
.btn-link {
  background: transparent;
  color: var(--primary);
  padding: 0;
}

.btn-donate {
  background: #ff8985;
  color: var(--cl-white);
  text-decoration: none;
}

.btn-donate:hover {
  background: var(--secondary);
  filter: brightness(0.95);
}

.btn-donate img {
  height: 20px;
}

.remove-btn {
  background: var(--remove-btn);
  color: var(--cl-white);
}

.add-friend-btn {
  background: var(--secondary);
  color: var(--cl-white);
}

.wishlist-remove-btn {
  background: var(--remove-btn);
  color: var(--cl-white);
}

.wishlist-btn {
  position: relative;
}

/* Forms */
.form {
  display: grid;
  gap: 12px;
}
.input {
  /* display: grid; */
  gap: 6px;
}
.input label {
  font-size: 0.92rem;
  color: #594b4b;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="file"],
.input textarea,
.input select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #cfc7c7;
  background: var(--cl-white);
  outline: none;
}
.input textarea { min-height: 100px; resize: none;}

/* Tabs (for Login/Register) */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--cl-light);
  padding: 6px;
  border-radius: 10px;
  width: fit-content;
  margin-bottom: 12px;
}
.tab {
  border: none;
  background: transparent;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--cl-dark);
  font-weight: 600;
}
.tab.active {
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  color: var(--cl-white);
}

.section {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  background: var(--cl-white);
  padding: 16px;
  border: 3px solid var(--section-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  width: 100%;
  word-wrap: anywhere;
}

.section-header-row {
  /* When you want to combine a header and buttons */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  word-wrap: anywhere;
}

.section + .section { margin-top: 16px;}

.muted { color: #6c6464; }
.center { text-align: center; }
.right { text-align: right; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: none; /* toggled with .open */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  padding: 20px;
}
.modal.open { display: flex; }
.modal-content {
  background: var(--cl-white);
  border-radius: 12px;
  width: min(560px, 100%);
  max-height: 85vh;
  overflow: auto;
  padding: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid #e6dddd;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-title { font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #6c6464;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}
.modal-close:hover {
  background: var(--cl-light);
}

/* Lists */
.list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}
.list li { margin-bottom: 4px; }

/* Password Input with Toggle */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-input-wrapper input {
  flex: 1;
  padding-right: 70px;
}
.password-toggle {
  position: absolute;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
  transition: background 0.2s ease;
}
.password-toggle:hover {
  background: var(--cl-light);
}

/* Password Strength Indicator */
.password-strength {
  margin-top: 8px;
}
.password-strength-bar {
  height: 6px;
  background: #e0d9d9;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.password-strength-fill {
  height: 100%;
  width: 0%;
  transition: all 0.3s ease;
  border-radius: 3px;
}
.password-strength-fill.weak {
  background: #e74c3c;
  width: 33%;
}
.password-strength-fill.medium {
  background: #f39c12;
  width: 66%;
}
.password-strength-fill.strong {
  background: #27ae60;
  width: 100%;
}
.password-strength-text {
  font-size: 0.85rem;
  font-weight: 600;
}
.password-strength-text.weak {
  color: #e74c3c;
}
.password-strength-text.medium {
  color: #f39c12;
}
.password-strength-text.strong {
  color: #27ae60;
}

/* Hamburger Menu Button */
.hamburger {
  display: none; /* Hidden by default, shown on mobile */
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.hamburger:hover {
  background: rgba(122, 0, 0, 0.3);
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background: var(--cl-light);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Hamburger animation when active */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Responsive */
@media (max-width: 768px) {
  /* Show hamburger menu on mobile */
  .hamburger {
    display: flex;
  }

  #nav-auth {
    flex-direction: column;
  }
  
  /* Hide nav links by default on mobile */
  .navbar .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
    gap: 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    align-content: center;
  }
  
  /* Show nav links when active */
  .navbar .nav-links.active {
    max-height: 500px;
    opacity: 1;
    padding: 16px 20px;
  }
  
  /* Stack nav items vertically */
  .navbar .nav-link {
    width: 100%;
    text-align: center;
  }

  .navbar .avatar-link {
    align-self: flex-end;
  }

  .avatar-link img {
    margin: 0 auto;
  }
  
  /* Adjust search bar for mobile */
  .navbar .search {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }
  
  .navbar .search input[type="search"] {
    width: 100%;
    min-width: unset;
  }
  
  .navbar .search button {
    width: 100%;
  }
  
  .search-friends {
    width: 100%;
    flex-direction: row;
    gap: 8px;
  }
  
  .search-friends input {
    width: 100%;
  }
  
  .search-friends button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .navbar { gap: 10px; }
}
