/* ============================================================
   SUBMIT REFERRAL VIEW
   ============================================================ */
.content-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

/* Subtle top-left glass reflection on content cards */
.content-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

/* Temperature / Hotness Slider */
.temp-slider-container {
  margin: 16px 0 24px;
}

.temp-bars {
  display: none !important;
}

.temp-selector {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.temp-btn {
  flex: 1;
  background: rgba(15, 23, 42, 0.04);
  border: 2px solid transparent;
  padding: 0;
  height: 18px;
  border-radius: 99px;
  text-indent: -9999px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 10px;
}
.temp-btn[data-val="1"] { background-color: #3b82f6 !important; }
.temp-btn[data-val="2"] { background-color: #06b6d4 !important; }
.temp-btn[data-val="3"] { background-color: #fbbf24 !important; }
.temp-btn[data-val="4"] { background-color: #f97316 !important; }
.temp-btn[data-val="5"] { background-color: #ef4444 !important; }

.temp-btn.active {
  border-color: #ffffff !important;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.6);
  transform: scaleY(1.2);
}

/* ============================================================

   SHOP & ACTIVITY FILTER BAR
   ============================================================ */
.shop-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.shop-filters::-webkit-scrollbar {
  display: none;
}

.shop-filter-btn {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  flex-shrink: 0;
}

.shop-filter-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.shop-filter-btn.active {
  background: rgba(214, 25, 32, 0.12);
  border-color: rgba(214, 25, 32, 0.4);
  color: var(--primary-light);
  box-shadow: 0 0 10px rgba(214, 25, 32, 0.15);
}


/* ============================================================

/* ============================================================
   TOAST NOTIFICATIONS â€” PREMIUM
   ============================================================ */
.toast-container {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-inverse);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(-10px);
  animation: toastIn 0.35s var(--ease-out-back) forwards;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

/* Progress bar at bottom */
.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  animation: toastProgress 4s linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes toastIn {
  to { opacity: 1; transform: translateY(0); }
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}
.toast.toast-success::after {
  background: var(--success);
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
}
.toast.toast-error::after {
  background: var(--danger);
}

.toast.toast-info {
  border-left: 4px solid var(--info);
}
.toast.toast-info::after {
  background: var(--info);
}

/* ============================================================

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: safe center;
  justify-content: center;
  overflow-y: auto;
  padding: 16px 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(214, 25, 32, 0.05);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.35s var(--ease-out-back);
}
.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

/* CRM Partner Modal — Fix flex layout per desktop */
#modal-partner-crm .btn-primary {
  width: auto;
  flex-shrink: 0;
}
#modal-partner-crm .form-control {
  min-width: 0;
}
#modal-partner-crm select.form-control {
  min-width: 160px;
}
#modal-partner-crm #crm-actions-grid .btn-primary {
  width: 100%;
}


/* ============================================================

/* ============================================================
   ACCORDION STYLES (PROFILO)
   ============================================================ */
.accordion-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(214, 25, 32, 0.15), 0 4px 16px rgba(0, 0, 0, 0.2);
}

.accordion-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.03);
  user-select: none;
  position: relative;
  transition: background 0.2s ease;
}

.accordion-item.active .accordion-header {
  background: rgba(214, 25, 32, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.acc-icon {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--primary-light);
  flex-shrink: 0;
}

.accordion-item.active .acc-icon {
  transform: rotate(180deg);
}

.accordion-content {
  overflow: hidden;
  max-height: 0;
  padding: 0 16px;
  opacity: 0;
  transition: max-height 0.45s ease, padding 0.35s ease, opacity 0.3s ease;
}

.accordion-item.active .accordion-content {
  padding: 16px;
  opacity: 1;
}

/* ============================================================

/* ============================================================
   FAB ADD REFERRAL
   ============================================================ */
.fab-add-referral {
  position: fixed;
  bottom: 85px;
  right: 20px;
  z-index: 900;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px rgba(214, 25, 32, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab-add-referral:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 12px 30px rgba(214, 25, 32, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.fab-add-referral:active {
  transform: scale(0.95);
}

@keyframes popInList {
  0% { opacity: 0; transform: translateY(20px) scale(0.9); }
  50% { transform: translateY(-5px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.animated-list-item {
  animation: popInList 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
}



/* ============================================================
   AGENT CARDS — Consulente Assegnato (Client Profile)
   ============================================================ */
.agent-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  padding: 4px;
}

@media (max-width: 480px) {
  .agent-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
  }
  .agent-card {
    flex: 1 1 calc(50% - 4px);
    max-width: calc(50% - 4px);
    min-width: 0;
    padding: 14px 6px 12px !important;
    box-sizing: border-box;
    overflow: hidden;
  }
  .agent-card-name {
    font-size: 0.82rem !important;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .agent-card-avatar {
    width: 56px !important;
    height: 56px !important;
  }
}

.agent-card {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md, 14px);
  padding: 20px 12px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(135deg, rgba(214, 25, 32, 0.12), rgba(214, 25, 32, 0.03));
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.agent-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.agent-card:active {
  transform: translateY(0) scale(0.97);
}

.agent-card.selected {
  border-color: var(--primary, #d61920);
  background: rgba(214, 25, 32, 0.1);
  box-shadow: 0 0 0 1px rgba(214, 25, 32, 0.25), 0 4px 16px rgba(214, 25, 32, 0.15);
}

.agent-card.selected::before {
  background: linear-gradient(135deg, rgba(214, 25, 32, 0.2), rgba(214, 25, 32, 0.06));
}

.agent-card-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #cc0000;
  margin: 0 auto 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  border: 3px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.agent-card.selected .agent-card-avatar {
  border-color: var(--primary, #d61920);
  box-shadow: 0 4px 16px rgba(214, 25, 32, 0.3);
}

.agent-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-card-avatar .agent-initials {
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.agent-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.agent-card-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  position: relative;
  z-index: 1;
  letter-spacing: 0.3px;
}

.agent-card-role.role-admin {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(234, 179, 8, 0.08));
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.agent-card-role.role-agent {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.05));
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.agent-card-info-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-light, #94a3b8);
  margin-top: 10px;
  opacity: 0.6;
  transition: opacity 0.2s;
  position: relative;
  z-index: 1;
}

.agent-card:hover .agent-card-info-hint {
  opacity: 1;
  color: var(--primary-light, #ff616b);
}

/* Selected checkmark */
.agent-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary, #d61920);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2;
}

.agent-card.selected .agent-card-check {
  opacity: 1;
  transform: scale(1);
}

.agent-card-check svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  stroke-width: 3;
  fill: none;
}

/* ============================================================
   CONTACT PREFERENCES TOGGLE (Staff Profile)
   ============================================================ */
.contact-pref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.contact-pref-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.contact-pref-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.contact-pref-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.contact-pref-toggle input[type="checkbox"]:checked {
  background: var(--primary, #d61920);
  border-color: var(--primary, #d61920);
}

.contact-pref-toggle input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
}

.contact-pref-toggle:has(input:checked) {
  border-color: rgba(214, 25, 32, 0.3);
  background: rgba(214, 25, 32, 0.08);
}

.contact-pref-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

/* ============================================================
   AGENT DETAIL MODAL — Mini Scheda Tecnica
   ============================================================ */
.modal-agent-detail .modal-content {
  max-width: 380px;
  max-height: 90dvh;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0d1525;
}

.agent-modal-header {
  position: relative;
  padding: 32px 24px 20px;
  text-align: center;
  background: linear-gradient(180deg, rgba(214, 25, 32, 0.15) 0%, rgba(214, 25, 32, 0.02) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.agent-modal-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(214, 25, 32, 0.1), transparent 70%);
  pointer-events: none;
}

.agent-modal-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: #cc0000;
  margin: 0 auto 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 40px rgba(214, 25, 32, 0.1);
  position: relative;
  z-index: 1;
}

.agent-modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-modal-avatar .agent-initials {
  color: #fff;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.agent-modal-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.agent-modal-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agent-modal-role-badge.role-admin {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(234, 179, 8, 0.1));
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.agent-modal-role-badge.role-agent {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.08));
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.agent-modal-body {
  padding: 20px 24px 24px;
}

.agent-modal-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.agent-modal-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.agent-modal-info-row:last-child {
  border-bottom: none;
}

.agent-modal-info-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--primary-light, #ff616b);
}

.agent-modal-info-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.agent-modal-info-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.agent-modal-info-value a {
  color: var(--primary-light, #ff616b);
  text-decoration: none;
  transition: opacity 0.2s;
}

.agent-modal-info-value a:hover {
  opacity: 0.8;
}

.agent-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.agent-modal-actions .btn-agent-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm, 10px);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.agent-modal-actions .btn-agent-call {
  background: var(--primary, #d61920);
  color: #fff;
}

.agent-modal-actions .btn-agent-call:hover {
  background: #b71418;
  box-shadow: 0 4px 14px rgba(214, 25, 32, 0.3);
}

.agent-modal-actions .btn-agent-wa {
  background: #25D366;
  color: #fff;
}

.agent-modal-actions .btn-agent-wa:hover {
  background: #1fb855;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
}

.agent-modal-actions .btn-agent-tg {
  background: #0088cc;
  color: #fff;
}

.agent-modal-actions .btn-agent-tg:hover {
  background: #0077b3;
  box-shadow: 0 4px 14px rgba(0, 136, 204, 0.3);
}

.agent-modal-actions .btn-agent-email {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.agent-modal-actions .btn-agent-email:hover {
  background: rgba(148, 163, 184, 0.3);
  box-shadow: 0 4px 14px rgba(148, 163, 184, 0.2);
}

.agent-modal-footer {
  padding: 0 24px 20px;
  text-align: center;
}

.agent-modal-footer .btn-select-agent {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm, 10px);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, var(--primary, #d61920), #b71418);
  color: #fff;
  box-shadow: 0 4px 16px rgba(214, 25, 32, 0.25);
}

.agent-modal-footer .btn-select-agent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(214, 25, 32, 0.35);
}

.agent-modal-footer .btn-select-agent.already-selected {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow: none;
  cursor: default;
}

.agent-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 5;
}

.agent-modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.agent-modal-close svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
  stroke-width: 2;
  fill: none;
}

/* Stagger animation for agent cards */
@keyframes agentCardIn {
  0% { opacity: 0; transform: translateY(16px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.agent-card {
  animation: agentCardIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
}
