/**
 * Album Organize Styles
 * For managing album sections, featured photos, and photo organization
 */

.organize-container {
  max-width: 1400px;
  margin: 0 auto;
}

.organize-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.organize-header h1 {
  font-family: 'Inter', sans-serif;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 800;
  color: var(--white);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.organize-header p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.organize-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 16px;
  overflow-x: auto;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-color: var(--blue);
  color: var(--white);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Sections Tab */
#sectionsList {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
}

.section-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 122, 255, 0.3);
}

.section-info {
  flex: 1;
}

.section-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
}

.section-info p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.section-actions {
  display: flex;
  gap: 8px;
}

.section-actions button {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
}

.section-actions button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--blue-light);
  color: var(--blue-light);
}

.section-actions button.delete {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
}

.section-actions button.delete:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: #ff6b6b;
}

.add-section-btn {
  width: 100%;
  padding: 16px;
  background: rgba(0, 122, 255, 0.08);
  border: 1.5px dashed rgba(0, 122, 255, 0.3);
  border-radius: 12px;
  color: var(--blue-light);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 16px;
}

.add-section-btn:hover {
  background: rgba(0, 122, 255, 0.12);
  border-color: var(--blue-light);
}

/* Featured Tab */
#featuredGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* Photo Items (used by both featured and organize grids) */
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.03);
}

.photo-item.featured {
  border-color: var(--blue);
  box-shadow: 0 0 12px rgba(0, 122, 255, 0.4);
}

.photo-item.current-featured {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(209, 159, 75, 0.4);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.photo-item:hover img {
  transform: scale(1.05);
}

.photo-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.photo-item:hover .photo-checkbox,
.photo-item.featured .photo-checkbox {
  opacity: 1;
}

.featured-order-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--gold);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.remove-featured-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  background: rgba(255, 59, 48, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  transform: scale(0.8);
}

.photo-item.current-featured:hover .remove-featured-btn {
  opacity: 1;
  transform: scale(1);
}

.remove-featured-btn:hover {
  background: rgba(255, 59, 48, 1);
  transform: scale(1.1) !important;
}

.featured-photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.featured-photo.selected {
  border-color: var(--blue);
  box-shadow: 0 0 12px rgba(0, 122, 255, 0.4);
}

.featured-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.featured-photo:hover img {
  transform: scale(1.08);
}

.featured-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--blue);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4);
}

.photo-order {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

/* Organize Tab */
#organizeGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

/* Section dropdown styling */
#targetSection {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px !important;
}

#targetSection option {
  background: var(--dark);
  color: var(--white);
  padding: 8px;
}

#targetSection:hover {
  border-color: rgba(255,255,255,0.2);
}

.organize-photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.organize-photo.selected {
  border-color: var(--blue);
}

.organize-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.organize-photo-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
}

.organize-photo:hover .organize-photo-checkbox,
.organize-photo.selected .organize-photo-checkbox {
  opacity: 1;
}

.organize-photo.selected .organize-photo-checkbox {
  background: var(--blue);
  border-color: var(--blue);
}

.organize-photo.selected .organize-photo-checkbox::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.organize-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.filter-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.organize-actions {
  display: flex;
  gap: 12px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 24px;
}

.organize-actions button {
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.organize-actions .btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.organize-actions .btn-primary:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.organize-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}

.organize-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: rgba(255, 255, 255, 0.3);
}

.empty-state svg {
  display: block;
  margin: 0 auto 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 15px;
  margin-bottom: 8px;
}

.empty-state button {
  margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .organize-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .organize-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #featuredGrid,
  #organizeGrid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
  }

  .organize-actions {
    flex-direction: column;
  }

  .organize-actions button {
    width: 100%;
  }
}
