/* Section padding */
section {
  margin: 7rem 3rem;
}

/* Grid layout */
#abefilm-history-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  box-sizing: border-box;
  margin-top: 2rem;
}
#abefilm-history-grid * {
  box-sizing: border-box;
}

/* Card base */
.history-card {
  position: relative;
  text-align: left;
  border-radius: 6px;
  overflow: hidden;
}

/* Image wrapper with fixed height */
.thumbnail-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  width: 100%;
  height: 250px;
}

/* Consistent image sizing */
.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

/* Hover dark overlay */
.thumbnail-wrapper::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.thumbnail-wrapper:hover::before {
  opacity: 1;
}
.history-card.edit-mode .thumbnail-wrapper:hover::before {
  display: none;
}

/* Play button */
.thumbnail-wrapper .play-button {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.thumbnail-wrapper:hover .play-button {
  opacity: 1;
}
.edit-mode .play-button {
  display: none !important;
}

/* Title and type */
.history-card p {
  margin: 10px 0;
  font-size: 14px;
  color: #eee;
  line-height: 1.2;
  word-break: break-word;
}
.history-card .type-label {
  font-size: 12px;
  color: #aaa;
  letter-spacing: 0.3px;
}

/* Card circle checkbox (on each card) */
.select-circle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border: 1px solid #fff;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.4);
  color: transparent;
  backdrop-filter: blur(3px);
  cursor: pointer;
  display: none;
  z-index: 5;
}
.history-card.selected .select-circle {
  background-color: var(--theme-color);
  border: none;
}
.history-card.selected .select-circle::after {
  content: "✓";
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Select All section */
.history-select-all-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 13px;
  color: #ccc;
  line-height: 1;
}

/* Unique Select All circle (not same as card checkboxes) */
.select-all-circle {
  width: 15px;
  height: 15px;
  border: 1px solid grey;
  border-radius: 50%;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  color: lightgrey;
  flex-shrink: 0;
  line-height: 1;
}

.select-all-circle.checked {
  background: var(--theme-color) !important;
  color: white !important;
  border: 1px solid var(--theme-color) !important;
}



.select-text {
  font-size: 16px;
}


/* Buttons wrapper */
.history-controls {
  display: flex;
  gap: 8px;
  margin: 2rem 0;
}
.history-controls button {
  background-color: var(--theme-color);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease, color 0.3s ease;

}
#cancelEdit {
    background: transparent;
    border: 1px solid var(--theme-color);
    color: var(--theme-color);
}

.history-controls button:hover {
  background-color: #229b4b;
}

#global-toast {
  position: fixed;
  top: 50%; /* center vertically */
  left: 50%; /* center horizontally */
  transform: translate(-50%, -50%); /* offset for exact center */

  background: #333;
  color: #fff;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 9999;
  max-width: 90%;
  max-height: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}
#global-toast.show-toast {
  opacity: 1;
}



.history-confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none; 
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.history-confirm-modal.show {
  display: flex !important;
}

.history-confirm-modal .modal-content {
  background: #13131f;
  padding: 30px;
  border-radius: 8px;
  color: var(--text-color);
  text-align: center;
  max-width: 90%;
  width: 350px;
}


.cancel-btn{
    background: transparent;
    border: 1px solid var(--theme-color);
    color: var(--theme-color);
    padding:8px 15px;
    border-radius: 4px;
}
.delete-btn{
    background: #e53935;
    color: white;
    border-radius: 4px;
    padding:8px 15px;
    border-radius: 4px;
    border:none;
}
.modal-actions {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* Responsive layout */
@media (max-width: 1280px) {
  #abefilm-history-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}
@media (max-width: 1024px) {
  #abefilm-history-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
@media (max-width: 768px) {
  #abefilm-history-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 576px) {
  #abefilm-history-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 400px) {
  #abefilm-history-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.abefilm-empty-history {
  text-align: center;
  padding: 40px 0;
}

.abefilm-empty-image {
  width: 120px;
  margin-bottom: 20px;
}

.abefilm-empty-title {
  color: #fff;
  font-size: 1.5em;
  margin-bottom: 10px;
}

.abefilm-empty-desc {
  color: #aaa;
  margin-bottom: 15px;
}

.abefilm-watch-now-btn {
    display: inline-block;
    background: var(--theme-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
}
