/* --- Character Counter (Absolute Positioning Setup) --- */

  body {
    background: #f8f9fa;
    padding: 2rem;
  }

  .form-section {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  }
	
  /* Grid container */
  .grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 across */
    gap: 16px;
  }

  /* Each item card */
  .item {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
  }

  .item:hover {
    transform: scale(1.03);
  }

  .item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
  }

  .item h4 {
    margin: 10px 0 5px;
    font-size: 1rem;
  }

  .price {
    color: #007bff;
    font-weight: bold;
    font-size: 0.9rem;
  }

  /* Responsive breakpoints */
  @media (max-width: 1024px) {
    .grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  @media (max-width: 768px) {
    .grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (max-width: 480px) {
    .grid {
      grid-template-columns: 1fr;
    }
  }

  /* Input wrapper for embedded counter */
  .input-wrapper {
    position: relative;
    width: 100%;
  }

  .input-wrapper input,
  .input-wrapper textarea {
    width: 100%;
    padding-right: 3.2rem; /* room for counter */
    box-sizing: border-box;
  }

  /* Counter inside input */
  .char-counter {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 0.7rem;
    color: rgba(100,100,100,0.6);
    pointer-events: none;
    background: rgba(255,255,255,0.7);
    padding: 0 3px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease;
  }

  .char-counter.visible {
    opacity: 1;
  }

  .char-counter.warning {
    color: #d9534f;
    font-weight: 600;
  }

 /* Inline radio buttons */
  .inline-radios {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .inline-radios label {
    margin-bottom: 0;
  }

  /* Responsive layout — left column under right */
  @media (max-width: 768px) {
    .right-partition { order: 1; }
    .left-partition  { order: 2; }
  }

/* --- Color Variables --- */
:root,
[data-bs-theme="light"] {
  --counter-color: #6c757d;
  --counter-warning: #dc3545;
}

[data-bs-theme="dark"],
body.bg-dark {
  --counter-color: #adb5bd;
  --counter-warning: #ff6b6b;
}

.char-counter.near-limit {
  color: var(--counter-warning);
  font-weight: 600;
}

/* --- Back to Top Button --- */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 25px;
  display: none;
  background-color: #0d6efd; /* Bootstrap primary blue */
  color: white;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 50%;
  font-size: 20px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  transition: opacity 0.3s ease, background-color 0.3s ease;
  z-index: 9999;
}

#backToTop:hover {
  background-color: #0b5ed7; /* Slightly darker */
}
