/*
 * ACCESS MANAGEMENT
 * Stiluri specifice pentru pagina de management accese (manageri și agenți)
 */

/* Top zones row (Arii, Merchandizer Zone) — collapsibles above the user cards */
.ac-zones-row {
  display: flex;
  gap: 2rem;
  flex-wrap: nowrap;
  margin-bottom: 1.5rem;
}

.ac-zone {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.ac-zone > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.ac-zone > summary::-webkit-details-marker {
  display: none;
}

.ac-zone > summary::after {
  content: '▾';
  font-size: 0.9rem;
  color: #888;
  transition: transform 0.2s ease;
}

.ac-zone[open] > summary::after {
  transform: rotate(180deg);
}

.ac-zone-body {
  padding: 0 1.5rem 1.5rem;
}

@media (max-width: 768px) {
  .ac-zones-row {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Cards Layout
 * auto-fit lays out as many 360px+ tracks as fit, but collapses any empty
 * tracks so the existing cards stretch to fill the whole row — no dead
 * space on the right when 3 cards live in a row that could hold 4.
 * The min(360px, 100%) trick caps the track at viewport width on very
 * narrow screens so the grid doesn't overflow. When the row can't hold
 * three 360px tracks, the third card wraps to a new row and stretches to
 * fill it. */
.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.card {
  min-width: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

/* Areas: narrower, shows all items without scroll */
.card-areas {
  flex: 0 0 auto;
  min-width: 220px;
  max-width: 280px;
  overflow: visible;
}

.card-areas .user-list {
  flex: 0 0 auto;
  overflow-y: visible;
}

.card .user-list {
  max-height: 55vh;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .cards-container {
    gap: 1rem;
  }

  .card .user-list {
    max-height: 50vh;
  }

  /* Items: stack vertically, align left */
  .user-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .user-info {
    text-align: left;
  }

  .user-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }

  .user-actions .area-select {
    flex: 1;
  }
}

@media (max-width: 480px) {

  .form-row {
    flex-direction: column;
  }

  .form-row input:not([type="checkbox"]),
  .form-row select,
  .form-row .btn {
    width: 100%;
  }

  .user-actions {
    align-self: flex-end;
  }
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #d12627;
}

/* Add Form */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0px 5px 0px 5px;
  background: #fffbf0;
  border: 2px solid #e1b922;
  border-radius: 8px;
}

.form-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.form-row input:not([type="checkbox"]),
.form-row select {
  margin: 5px;
}

.form-row input:not([type="checkbox"]),
.form-row select {
  flex: 1;
  padding: 12px;
  border: 2px solid #e1b922;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s;
}

.form-row input:not([type="checkbox"]):focus,
.form-row select:focus {
  outline: none;
  border-color: #d12627;
  box-shadow: 0 0 0 3px rgba(209, 38, 39, 0.1);
}

/* User List */
.user-list {
  overflow-y: auto;
}

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

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

.user-item:hover {
  background: #fff9e6;
}

.user-info {
  flex: 1;
}

.user-name {
  font-weight: 500;
  color: #333;
}

.user-email {
  font-size: 0.85rem;
  color: #666;
}

.user-manager {
  font-size: 0.85rem;
  color: #d12627;
  margin-top: 0.25rem;
}

.user-actions {
  display: flex;
  gap: 0.5rem;
}

/* Action Buttons */
.btn-icon {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-edit {
  background: #e1b922;
  color: #222;
}

.btn-edit:hover {
  background: #d12627;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(209, 38, 39, 0.3);
}

.btn-delete {
  background: #d12627;
  color: #fff;
}

.btn-delete:hover {
  background: #e1b922;
  color: #222;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(225, 185, 34, 0.3);
}

/* Area select in agent items */
.area-select {
  padding: 6px 10px;
  border: 2px solid #e1b922;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  min-width: 140px;
}

.area-select:focus {
  outline: none;
  border-color: #d12627;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: #999;
}

/* Manager Dropdown */
.manager-dropdown {
  position: relative;
}

.manager-dropdown select {
  width: 100%;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  pointer-events: auto;
  animation: toast-in 0.25s ease;
  max-width: 340px;
}

.toast--success { background: #28a745; }
.toast--error   { background: #d12627; }
.toast--warning { background: #e1b922; color: #222; }
.toast--info    { background: #1976d2; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(16px); }
}

.toast--hiding {
  animation: toast-out 0.25s ease forwards;
}

/* Override pentru scrollbar la listele de utilizatori */
.user-list::-webkit-scrollbar {
  width: 8px;
}

.user-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.user-list::-webkit-scrollbar-thumb {
  background: #e1b922;
  border-radius: 4px;
}

.user-list::-webkit-scrollbar-thumb:hover {
  background: #d12627;
}
