/**
 * Collections System Styles
 * Phase 1: Save to Collections Feature
 */

/* ========= Save Button ========= */
.btn-save-recipe {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--color-border, #e0e0e0);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-save-recipe:hover {
  border-color: var(--color-brand-primary, #2d6a4f);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-save-recipe.saved {
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
  border-color: var(--color-brand-primary, #2d6a4f);
}

.btn-save-recipe .icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* ========= Collection Modal ========= */
.collection-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.collection-modal {
  background: white;
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-gray-600, #5a5a5a); /* WCAG AA: 5.9:1 contrast */
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.collections-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.collection-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.collection-option:hover {
  background: #f8f9fa;
  border-color: var(--color-brand-primary, #2d6a4f);
}

.collection-option input[type='checkbox'] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.collection-name {
  flex: 1;
  font-weight: 500;
}

.collection-count {
  color: var(--color-gray-600, #5a5a5a); /* WCAG AA: 5.9:1 contrast */
  font-size: 0.875rem;
}

.create-collection {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

.create-collection input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
}

.create-collection button {
  padding: 0.75rem 1.5rem;
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.create-collection button:hover {
  background: var(--color-brand-dark, #1b4332);
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.btn-remove {
  padding: 0.75rem 1.5rem;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-remove:hover {
  background: #c82333;
}

.btn-done {
  padding: 0.75rem 1.5rem;
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-done:hover {
  background: var(--color-brand-dark, #1b4332);
}

/* ========= Collections Page ========= */
.collections-page {
  padding: 2rem;
}

.collections-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.collections-header h1 {
  margin: 0;
}

.btn-new-collection {
  padding: 0.75rem 1.5rem;
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-new-collection:hover {
  background: var(--color-brand-dark, #1b4332);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.collection-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.collection-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-color: var(--color-brand-primary, #2d6a4f);
}

.collection-thumbnail {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #f0f0f0;
}

.collection-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collection-count {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.collection-info {
  padding: 1.25rem;
}

.collection-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
}

.collection-date {
  color: var(--color-gray-600, #5a5a5a); /* WCAG AA: 5.9:1 contrast */
  font-size: 0.875rem;
  margin: 0;
}

.btn-collection-menu {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.btn-collection-menu:hover {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ========= Collection Menu ========= */
.collection-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.collection-menu {
  background: white;
  border-radius: 12px;
  padding: 0.5rem;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.collection-menu button {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.collection-menu button:hover {
  background: #f0f0f0;
}

/* ========= Responsive ========= */
@media (max-width: 768px) {
  .collections-page {
    padding: 1rem;
  }

  .collections-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .collections-grid {
    grid-template-columns: 1fr;
  }

  .collection-modal {
    width: 95%;
  }
}
