/**
 * Room Planner Styles
 */

.room-planner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

.room-planner__intro {
  grid-column: 1 / -1;
  text-align: center;
  margin-bottom: 1rem;
}

.room-planner__intro .lead {
  font-size: 1.15rem;
  color: #555;
  max-width: 600px;
  margin: 0 auto;
}

/* Room Selection */
.room-planner__rooms {
  grid-column: 1 / -1;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.room-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.room-card:hover {
  border-color: #4a90d9;
  background: #f0f7ff;
}

.room-card.active {
  background: #4a90d9;
  border-color: #4a90d9;
  color: #fff;
}

.room-card.active .room-card__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.room-card__icon {
  width: 48px;
  height: 48px;
  background: #f0f7ff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a90d9;
  transition: all 0.2s ease;
}

.room-card__icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.room-card__name {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Room Content */
.room-planner__content {
  grid-column: 1;
}

.room-header {
  margin-bottom: 1.5rem;
}

.room-header h2 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem 0;
  color: #1a1a2e;
}

.room-header p {
  color: #666;
  margin: 0;
}

/* Categories */
.room-categories {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.room-category {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.room-category__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.room-category__header:hover {
  background: #f8f9fa;
}

.room-category__info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.room-category__icon {
  color: #4a90d9;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-category__icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.room-category__info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.15rem 0;
  color: #333;
}

.room-category__info p {
  font-size: 0.85rem;
  color: #666;
  margin: 0;
}

.room-category__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.product-count {
  font-size: 0.85rem;
  color: #888;
}

.room-category__meta .icon {
  width: 1rem;
  height: 1rem;
  color: #888;
  transition: transform 0.2s ease;
}

/* Products in Category */
.room-category__products {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid #e5e7eb;
}

.room-product {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.room-product:last-of-type {
  border-bottom: none;
}

.room-product__image {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-product__image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.room-product__placeholder {
  color: #ccc;
}

.room-product__placeholder .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.room-product__info {
  flex: 1;
  min-width: 0;
}

.room-product__info h4 {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-product__price {
  font-size: 0.9rem;
  color: #4a90d9;
  font-weight: 600;
  margin: 0;
}

.room-product__actions {
  flex-shrink: 0;
}

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add:hover {
  background: #3a7bc8;
}

.btn-add.added {
  background: #28a745;
}

.btn-add.added:hover {
  background: #dc3545;
}


.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  color: #4a90d9;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.view-all-link:hover {
  color: #357abd;
}

.view-all-link .icon {
  width: 0.8rem;
  height: 0.8rem;
  transition: transform 0.2s ease;
}

.view-all-link:hover .icon {
  transform: translateX(4px);
}

/* Empty State */
.room-planner__empty {
  grid-column: 1;
  text-align: center;
  padding: 4rem 2rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.room-planner__empty .icon {
  width: 4rem;
  height: 4rem;
  color: #ccc;
  margin-bottom: 1rem;
}

.room-planner__empty h3 {
  margin: 0 0 0.5rem 0;
  color: #333;
}

.room-planner__empty p {
  color: #666;
  margin: 0;
}

/* Shopping Plan Sidebar */
.room-planner__plan {
  position: sticky;
  top: 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem;
}

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

.plan-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: #333;
}

.plan-header h3 .icon {
  margin-right: 0.5rem;
  color: #4a90d9;
  vertical-align: middle;
}

.plan-count {
  font-size: 0.85rem;
  color: #888;
  background: #f0f0f0;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
}

.plan-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #888;
}

.plan-empty p {
  margin: 0;
  font-size: 0.9rem;
}

.plan-items {
  max-height: 300px;
  overflow-y: auto;
}

.plan-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.plan-item:last-child {
  border-bottom: none;
}

.plan-item__info {
  flex: 1;
  min-width: 0;
}

.plan-item__title {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-item__price {
  display: block;
  font-size: 0.8rem;
  color: #4a90d9;
  font-weight: 500;
  margin-top: 0.15rem;
}

.plan-item__remove {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

.plan-item__remove:hover {
  color: #dc3545;
}

.plan-total {
  padding: 1rem 0;
  border-top: 2px solid #e5e7eb;
  margin-top: 0.5rem;
}

.plan-total__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plan-total__row span {
  font-size: 0.95rem;
  color: #666;
}

.plan-total__row strong {
  font-size: 1.25rem;
  color: #333;
}

.plan-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-clear-plan {
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear-plan:hover {
  color: #dc3545;
  border-color: #dc3545;
}

/* Responsive */
@media (max-width: 992px) {
  .room-planner {
    grid-template-columns: 1fr;
  }

  .room-planner__plan {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 16px 16px 0 0;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(calc(100% - 60px));
    transition: transform 0.3s ease;
  }

  .room-planner__plan.has-items {
    transform: translateY(calc(100% - 60px));
  }

  .room-planner__plan:hover,
  .room-planner__plan:focus-within {
    transform: translateY(0);
  }

  .room-planner__content,
  .room-planner__empty {
    grid-column: 1;
    padding-bottom: 80px;
  }
}

@media (max-width: 768px) {
  .room-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .room-card {
    padding: 1rem 0.75rem;
  }

  .room-card__icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .room-card__name {
    font-size: 0.85rem;
  }

  .room-product {
    gap: 0.75rem;
  }

  .room-product__image {
    width: 48px;
    height: 48px;
  }

  .room-product__info h4 {
    font-size: 0.85rem;
  }

  .btn-add {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
}

/* x-cloak for Alpine.js */
[x-cloak] {
  display: none !important;
}
