/* public/css/style.css */

body {
  font-family: 'Spectral', serif;
  background-color: #0d0d0d;
  background-size: cover;
  color: #eee;
  margin: 0;
  padding: 0;
}

header {
  text-align: center;
  padding-top: 2rem;
  background: rgba(0, 0, 0, 0.7);
}

header h1 {
  font-family: "Girassol", serif;
  font-size: 2.5rem;
  color: #f0d090;
  text-shadow: 0 0 10px #f0d090;
  margin-bottom: 0;
}

h2, h3, h4 {
  font-family: "Girassol", serif;
  color: #f0d090;
}

.download-icon {
  font-family: "Girassol", serif;
}

button, input, select {
  font-family: 'Spectral', serif;
}

.sticky-controls {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(13, 13, 13, 0.8);
  padding: 0.5rem 1rem;
  border-bottom: 2px solid #f0d090;
  z-index: 999;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

#search, #filter-category, #filter-subcategory, #sort-order, #icon-style {
  padding: 0.5rem;
  border: none;
  border-radius: 8px;
  background: #222;
  color: #eee;
}

#search {
  width: 25em;
}

/* Icon Preview Styling - Updated */
.icon-preview {
  position: relative;
  width: 100%;
  margin: 0 auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-card h3 { text-align: center; }

/* Background and frame fill the entire preview area */
.icon-preview .preview-bg,
.icon-preview .preview-frame {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 320px;
  width:100%;
  object-fit: cover;
  z-index: 1;
}

/* Frame goes above background */
.icon-preview .preview-frame {
  z-index: 2;
}

/* Icon is centered and 256px size */
.icon-preview .preview-icon {
  position: relative;
  width: 100%;
  object-fit: contain;
  z-index: 3;
}

/* Shadow effect for icon only */
.shadow {
  filter: drop-shadow(4px 4px 6px rgba(0, 0, 0, 0.5));
}

#search::placeholder, #filter-tag::placeholder {
  color: #bbb;
}

#icon-count-container {
	position: absolute; right: 55px; top: 55px;
	opacity: .8;
	flex-wrap: nowrap;
	flex-direction: row;
	display: flex;
}
#icon-count-container button {
	padding: 0; margin-left: 2em;
	background: none;
	border: none;
	color: #eee;
	font-size: .9rem;
}

#icon-grid {
    display: flex;
    justify-content: space-evenly;
    gap: 1rem;
    padding: 1rem;
    flex-direction: row;
    flex-wrap: wrap;
}

.icon-card {
  background: rgba(20, 20, 20, 0.85);
  border: 2px solid #f0d090;
  border-radius: 12px;
  padding: .5rem;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  max-width: 340px;
  min-width: 160px;
  margin: 0 auto;
}

.icon-card:hover {
  box-shadow: 0 0 20px #f0d09088;
}

.image-wrapper {
  position: relative;
}

.existing-tags {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  align-items: flex-end;
}

.existing-tags .tag {
  background: #f0d090;
  color: #000;
  padding: 4px;
  border-radius: 6px;
  font-size: 0.5rem;
  font-weight: bold;
  white-space: nowrap;
}

.selected {
  background-color: #333;
  color: #fff;
  border: 1px solid #000;
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.title-bar h3 {
  font-size: 1.1rem;
  margin: 0;
  color: #f0d090;
  text-shadow: 0 0 1px #f0d090;
  letter-spacing: .09em;
}

.download-btn {
  font-size: 1rem;
  text-decoration: none;
  color: #f0d090;
  transition: transform 0.2s ease;
}

.download-btn:hover {
  transform: scale(1.2);
}

.tag-form {
  margin-top: 0.5rem;
  position: relative;
}

.add-tag-input {
  width: 100%;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid #666;
  background: #222;
  color: #eee;
  font-size: 0.8rem;
  display: none; /* Hidden by default */
}

.add-tag-btn {
  margin-top: 6px;
  background: #f0d090;
  color: #000;
  border: none;
  padding: 3px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .6rem;
  transition: background 0.2s ease;
}

.add-tag-btn:hover {
  background: #f5e0a0;
}

.tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #222;
  border: 1px solid #666;
  border-radius: 6px;
  margin-top: 4px;
  z-index: 10;
  max-height: 150px;
  overflow-y: auto;
  display: none; /* Hidden initially */
}

.suggestion-item {
	position: relative;
  padding: 5px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #eee;
  z-index: 1000;
}

.suggestion-item:hover {
  background: #444;
}

#terms-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #f0d090;
  color: #000;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  text-align: center;
  line-height: 32px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 0 5px #000;
  z-index: 9999;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: rgba(20,20,20,0.95);
  border: 2px solid #f0d090;
  border-radius: 8px;
  padding: 1rem;
  width: 35%;
  min-width: 550px;
  color: #eee;
  z-index: 10000;
  font-size: .8rem;
}

.modal-content h2 {
  margin-top: 0;
  color: #f0d090;
}

.modal-content button {
  margin-top: 1rem;
  padding: 0.4rem 1rem;
  border: none;
  border-radius: 6px;
  background: #f0d090;
  color: #000;
  cursor: pointer;
}

.category-header {
  font-size: 1.1rem;
  font-weight: bold;
  color: #f0d090;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.4rem 1rem;
  border-left: 4px solid #f0d090;
  margin-top: 2rem;
  grid-column: 1 / -1;
}

/* CSS for sliding preview controls */
.preview-controls-container {
  position: relative;
  display: inline-block;
  margin-left: 1rem;
}

.preview-toggle {
  background: #f0d090;
  color: #222;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  font-family: 'Spectral', serif;
}

.preview-toggle:hover {
  background: #f5e0a0;
}

.preview-controls {
  position: absolute;
  top: calc(100% + 15px);
  right: 0;
  background: rgba(20, 20, 20, 0.95);
  border: 2px solid #f0d090;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 250px;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transform: translateY(-20px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
}

.preview-controls.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.preview-controls label {
  display: flex;
  align-items: center;
  color: #f0d090;
  font-weight: bold;
  font-size: 0.9rem;
}

.preview-controls select {
  flex: 1;
  background: #222;
  color: #f0d090;
  border: 1px solid #f0d090;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  margin-left: 0.4rem;
  cursor: pointer;
}

.preview-controls select:hover {
  background: #333;
}

.shadow-control {
  display: flex;
  align-items: center;
  color: #f0d090;
  font-weight: bold;
  font-size: 0.9rem;
}

.shadow-control input[type="checkbox"] {
  margin-right: 0.5rem;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #f0d090;
}
.search-wrapper {
  position: relative;
  width: 25em;
  max-height: 2em;
}

#search-suggestions {
  position: absolute;
  left: 25px;
  right: 25px;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid #eee;
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 1001;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
}

#search-suggestions .suggestion {
  padding: 0.5rem 1rem;
  color: #f0d090;
  font-family: 'Spectral', serif;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 1px solid #444;
}

#search-suggestions .suggestion:last-child {
  border-bottom: none;
}

#search-suggestions .suggestion:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Style the scrollbar track */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

/* Track background */
::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 4px;
}

/* Scrollbar thumb */
::-webkit-scrollbar-thumb {
  background-color: #f0d090;
  border-radius: 6px;
  border: 2px solid #1a1a1a;
}

/* On hover */
::-webkit-scrollbar-thumb:hover {
  background-color: #ffe0a0;
}

.bg-download {
  color: green;
  font-size: 20px;
  text-decoration: none;
  margin-left: 10px;
}

.share-btn.success {
  background-color: #4CAF50; /* green */
  color: white;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.preview-bg.square {
  border-radius: 0;
}

.preview-bg.circle {
  border-radius: 50%;
}

