/* ============================================================
   Franchise Consultation Modal — dùng chung mọi page extend base_website.html
   ============================================================ */
.consult-status { display: none; }

.franchise-modal *,
.franchise-modal *::before,
.franchise-modal *::after {
  font-family: 'Nunito Sans', system-ui, -apple-system, sans-serif;
}

.franchise-modal .modal-dialog { max-width: 720px; }
.franchise-modal .modal-content {
  border: 0; border-radius: 16px; overflow: hidden; background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}

.franchise-modal .modal-header {
  border-bottom: 1px solid #eef2f7;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f0fbfd 0%, #ecfeff 100%);
  align-items: center;
}
.franchise-modal-title-wrap { display: flex; align-items: center; gap: 12px; }
.franchise-modal .modal-title {
  color: #0f172a; font-weight: 900; font-size: 1.08rem; line-height: 1.2;
  margin: 0;
}
.franchise-modal-sub {
  font-size: .68rem; font-weight: 700; color: #14b8a6;
  text-transform: uppercase; letter-spacing: .06em; margin: 2px 0 0;
}
.franchise-title-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e88a8 0%, #0891b2 50%, #14b8a6 100%);
  color: #fff; font-size: 16px; flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(8, 145, 178, .3);
}
.franchise-modal .btn-close { opacity: .55; transition: opacity .14s, transform .14s; }
.franchise-modal .btn-close:hover { opacity: 1; transform: rotate(90deg); }

.franchise-modal .modal-body {
  padding: 18px 20px 12px; background: #fff;
  max-height: calc(100vh - 220px); overflow-y: auto;
}

.franchise-modal-intro {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px; padding: 10px 14px;
  background: linear-gradient(135deg, rgba(8, 145, 178, .06), rgba(20, 184, 166, .06));
  border: 1px solid rgba(8, 145, 178, .18);
  border-left: 3px solid #0891b2;
  border-radius: 10px;
  font-size: .82rem; font-weight: 600; color: #475569; line-height: 1.5;
}
.franchise-modal-intro i { color: #0891b2; font-size: .92rem; margin-top: 2px; flex-shrink: 0; }

.franchise-form-section {
  background: #fafcfe;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.franchise-form-section:last-child { margin-bottom: 0; }
.franchise-form-section-title {
  font-size: .7rem; font-weight: 800; color: #0e6989;
  text-transform: uppercase; letter-spacing: .06em;
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 7px;
}
.franchise-form-section-title i { color: #0891b2; font-size: .82rem; }

.franchise-modal .form-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  color: #64748b; font-weight: 800; margin-bottom: .35rem;
}
.franchise-modal .text-danger { color: #ef4444 !important; }

.franchise-modal .form-control,
.franchise-modal .form-select {
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  padding: .54rem .8rem;
  font-size: .88rem; font-weight: 600;
  color: #0f172a; background: #fff;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
  height: auto; min-height: 40px;
}
.franchise-modal .form-control::placeholder { color: #94a3b8; font-weight: 500; }
.franchise-modal .form-control:hover,
.franchise-modal .form-select:hover { border-color: rgba(8, 145, 178, .42); }
.franchise-modal .form-control:focus,
.franchise-modal .form-select:focus {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, .14);
  background: #fff;
}
.franchise-modal textarea.form-control { min-height: 76px; resize: vertical; }
.franchise-modal input[type="datetime-local"] { color-scheme: light; }

.franchise-input-wrap { position: relative; }
.franchise-input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: .82rem; pointer-events: none; z-index: 1;
  transition: color .15s;
}
.franchise-input-with-icon { padding-left: 36px !important; }
.franchise-input-wrap:focus-within .franchise-input-icon { color: #0891b2; }

.franchise-modal .modal-footer {
  border-top: 1px solid #eef2f7;
  padding: 12px 20px;
  background: #fafcfe;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.franchise-modal-trust {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; color: #64748b;
}
.franchise-modal-trust i { color: #14b8a6; font-size: .82rem; }
.franchise-modal-actions { display: inline-flex; gap: 8px; align-items: center; }

.franchise-btn-secondary {
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  color: #475569; font-weight: 700; font-size: .82rem;
  padding: .48rem 1.15rem; background: #fff;
  transition: all .14s;
}
.franchise-btn-secondary:hover {
  border-color: #cbd5e1; color: #0f172a; background: #f8fafc;
}
.franchise-btn-primary {
  border: 0; border-radius: 999px;
  color: #fff; font-weight: 800; font-size: .85rem;
  padding: .56rem 1.4rem;
  background: linear-gradient(135deg, #0891b2 0%, #14b8a6 100%);
  box-shadow: 0 8px 18px rgba(8, 145, 178, .4);
  transition: filter .14s, transform .14s, box-shadow .14s;
  display: inline-flex; align-items: center;
}
.franchise-btn-primary:hover {
  filter: brightness(1.06); transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(8, 145, 178, .5); color: #fff;
}
.franchise-btn-primary:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.franchise-modal .consult-status.alert {
  border-radius: 10px; padding: 10px 14px;
  font-size: .82rem; font-weight: 600; margin-bottom: 12px;
  border: 1px solid transparent;
}
.franchise-modal .consult-status.alert-success {
  background: #f0fdf4; color: #15803d; border-color: #86efac;
}
.franchise-modal .consult-status.alert-danger {
  background: #fef2f2; color: #b91c1c; border-color: #fecaca;
}

@media (max-width: 576px) {
  .franchise-modal .modal-dialog { margin: 8px; }
  .franchise-modal .modal-header { padding: 14px 16px; }
  .franchise-modal .modal-body { padding: 14px 16px; }
  .franchise-modal .modal-footer { padding: 12px 16px; flex-direction: column; align-items: stretch; }
  .franchise-form-section { padding: 12px 14px; }
  .franchise-modal-trust { display: none; }
  .franchise-modal-actions { width: 100%; justify-content: flex-end; }
}

/* Select2 styling */
.franchise-modal .select2-container--default .select2-selection--single {
  height: 40px !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: .54rem .8rem !important;
  display: flex; align-items: center;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.franchise-modal .select2-container--default .select2-selection--single:hover {
  border-color: rgba(8, 145, 178, .42) !important;
}
.franchise-modal .select2-container--default.select2-container--focus .select2-selection--single,
.franchise-modal .select2-container--default.select2-container--open .select2-selection--single {
  border-color: #0891b2 !important;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, .14);
}
.franchise-modal .select2-container--default .select2-selection__rendered {
  color: #0f172a !important;
  font-size: 14px; font-weight: 600;
  line-height: 1.4 !important;
  padding-left: 0 !important; padding-right: 24px !important;
}
.franchise-modal .select2-container--default .select2-selection__placeholder {
  color: #94a3b8 !important; font-weight: 500;
}
.franchise-modal .select2-container--default .select2-selection__arrow {
  height: 100% !important; top: 0 !important; right: 6px !important;
}
.franchise-modal .select2-container--default .select2-selection__arrow b {
  border-color: #64748b transparent transparent transparent !important;
}

#franchiseConsultationModal .select2-dropdown {
  border: 1px solid rgba(30, 136, 168, .25);
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .14);
  overflow: hidden;
  font-family: 'Nunito Sans', system-ui, sans-serif;
  z-index: 1080;
}
#franchiseConsultationModal .select2-search--dropdown { padding: 10px 12px 8px; }
#franchiseConsultationModal .select2-search--dropdown .select2-search__field {
  height: 38px; padding: 0 12px 0 36px;
  border: 1.5px solid #dbe5ef; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: #0f172a;
  background: #f8fafc url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.35-4.35'/></svg>") no-repeat 12px center;
  outline: none;
  transition: border-color .14s, box-shadow .14s, background-color .14s;
}
#franchiseConsultationModal .select2-search--dropdown .select2-search__field:focus {
  border-color: #1e88a8;
  box-shadow: 0 0 0 3px rgba(30, 136, 168, .12);
  background-color: #fff;
}
#franchiseConsultationModal .select2-results__options { padding: 4px; max-height: 280px; }
#franchiseConsultationModal .select2-results__option {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600; color: #0f172a;
  margin: 1px 0;
  transition: background .14s, color .14s;
}
#franchiseConsultationModal .select2-results__option--highlighted[aria-selected],
#franchiseConsultationModal .select2-results__option--highlighted {
  background: linear-gradient(135deg, rgba(8, 145, 178, .1), rgba(20, 184, 166, .1)) !important;
  color: #0e6989 !important;
  font-weight: 700;
}
#franchiseConsultationModal .select2-results__option[aria-selected="true"] {
  background: linear-gradient(135deg, #1e88a8, #0891b2) !important;
  color: #fff !important;
  font-weight: 800;
}
#franchiseConsultationModal .select2-results__message {
  padding: 14px 12px;
  color: #94a3b8; font-size: 13px; text-align: center;
}

/* ═══════════════════ TOP LOADER BAR (như browser loading) ═══════════════════ */
/* Thin bar 3px ở đầu modal-content, hiện khi .is-active. Animation gradient + glow. */
.franchise-toploader {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(8, 145, 178, .08);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  overflow: hidden;
  opacity: 0;
  transition: opacity .25s ease;
  z-index: 5;
  pointer-events: none;
}
.franchise-toploader.is-active { opacity: 1; }
.franchise-toploader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0891b2 0%, #06b6d4 40%, #14b8a6 80%, #06b6d4 100%);
  background-size: 200% 100%;
  border-radius: inherit;
  transition: width .4s cubic-bezier(.4, 0, .2, 1), background .3s ease;
  animation: franchise-toploader-shimmer 1.4s linear infinite;
  box-shadow: 0 0 10px rgba(6, 182, 212, .55), 0 0 4px rgba(20, 184, 166, .4);
}
@keyframes franchise-toploader-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: 0 0; }
}
.franchise-toploader.is-success .franchise-toploader-bar {
  background: linear-gradient(90deg, #10b981, #059669);
  animation: none;
  box-shadow: 0 0 10px rgba(16, 185, 129, .6);
}
.franchise-toploader.is-error .franchise-toploader-bar {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  animation: none;
  box-shadow: 0 0 10px rgba(239, 68, 68, .6);
}

/* Đảm bảo modal-content có position relative để toploader absolute đúng vị trí */
.franchise-modal .modal-content {
  position: relative;
  overflow: hidden;        /* clip toploader gọn theo bo góc modal */
}

/* ═══════════════════ LOADING OVERLAY — beautiful card ═══════════════════ */
/* Phủ kín modal-content khi submit, hiển thị card có spinner + steps + progress bar */
.franchise-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(248, 250, 252, .92), rgba(236, 254, 255, .94));
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility 0s linear .35s;
}
.franchise-loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .35s ease, visibility 0s linear 0s;
}

.franchise-loading-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 28px 28px 24px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(8, 145, 178, .12);
  border-radius: 22px;
  box-shadow:
    0 24px 60px -16px rgba(8, 145, 178, .25),
    0 8px 24px -8px rgba(15, 23, 42, .08),
    inset 0 0 0 1px rgba(255, 255, 255, .8);
  transform: scale(.94);
  opacity: 0;
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), opacity .3s ease;
}
.franchise-loading-overlay.is-visible .franchise-loading-card {
  transform: scale(1);
  opacity: 1;
}

/* Animated rings + paper plane icon */
.franchise-loading-icon {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.franchise-loading-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid rgba(8, 145, 178, .5);
  animation: franchise-ring-pulse 2.2s ease-out infinite;
}
.franchise-loading-ring.delay-1 { animation-delay: .55s; border-color: rgba(20, 184, 166, .5); }
.franchise-loading-ring.delay-2 { animation-delay: 1.1s; border-color: rgba(6, 182, 212, .5); }
@keyframes franchise-ring-pulse {
  0%   { transform: scale(.4); opacity: 1; }
  80%  { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}
.franchise-loading-emoji {
  font-size: 36px;
  color: #0891b2;
  background: linear-gradient(135deg, #0891b2, #14b8a6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  z-index: 2;
  animation: franchise-emoji-float 2.5s ease-in-out infinite;
}
@keyframes franchise-emoji-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

.franchise-loading-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px;
  letter-spacing: -.01em;
}
.franchise-loading-step {
  font-size: 13.5px;
  color: #64748b;
  margin: 0 0 18px;
  min-height: 20px;
  transition: opacity .25s ease;
}

/* Progress bar in card */
.franchise-loading-bar {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
  position: relative;
}
.franchise-loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0891b2 0%, #06b6d4 40%, #14b8a6 80%, #06b6d4 100%);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
  animation: franchise-bar-shimmer 1.6s linear infinite;
  box-shadow: 0 0 12px rgba(6, 182, 212, .55);
}
@keyframes franchise-bar-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: 0 0; }
}
.franchise-loading-percent {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #0891b2;
  font-variant-numeric: tabular-nums;
}
.franchise-progress-pill-percent { font-weight: 800; font-size: 15px; }

/* Steps list */
.franchise-loading-steps {
  list-style: none;
  padding: 16px 0 0;
  margin: 16px 0 0;
  border-top: 1px dashed #e2e8f0;
  display: grid;
  gap: 8px;
  text-align: left;
}
.franchise-loading-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
  transition: color .25s ease, transform .25s ease;
}
.franchise-loading-steps li i {
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
  border-radius: 50%;
  font-size: 10px;
  transition: all .25s ease;
  flex-shrink: 0;
}
.franchise-loading-steps li.done { color: #475569; }
.franchise-loading-steps li.done i {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}
.franchise-loading-steps li.done i::before { content: "\f00c"; }   /* fa-check */
.franchise-loading-steps li.active {
  color: #0f766e;
  font-weight: 700;
  transform: translateX(2px);
}
.franchise-loading-steps li.active i {
  background: linear-gradient(135deg, #0891b2, #14b8a6);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(8, 145, 178, .15);
  animation: franchise-step-pulse 1.4s ease-in-out infinite;
}
@keyframes franchise-step-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(8, 145, 178, .15); }
  50%      { box-shadow: 0 0 0 7px rgba(8, 145, 178, .04); }
}

/* Success state */
.franchise-loading-overlay.is-success .franchise-loading-card {
  border-color: rgba(16, 185, 129, .35);
  box-shadow:
    0 24px 60px -16px rgba(16, 185, 129, .3),
    0 8px 24px -8px rgba(15, 23, 42, .08);
}
.franchise-loading-overlay.is-success .franchise-loading-ring { display: none; }
.franchise-loading-overlay.is-success .franchise-loading-emoji {
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  background-clip: text;
  font-size: 48px;
  animation: franchise-check-pop .6s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes franchise-check-pop {
  0%   { transform: scale(0) rotate(-180deg); }
  100% { transform: scale(1) rotate(0); }
}
.franchise-loading-overlay.is-success .franchise-loading-bar-fill {
  background: linear-gradient(90deg, #10b981, #059669);
  animation: none;
  box-shadow: 0 0 12px rgba(16, 185, 129, .55);
}
.franchise-loading-overlay.is-success .franchise-loading-percent { color: #059669; }

/* Error state */
.franchise-loading-overlay.is-error .franchise-loading-card {
  border-color: rgba(239, 68, 68, .35);
}
.franchise-loading-overlay.is-error .franchise-loading-ring { display: none; }
.franchise-loading-overlay.is-error .franchise-loading-emoji {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  -webkit-background-clip: text;
  background-clip: text;
  animation: franchise-shake .5s ease;
}
@keyframes franchise-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.franchise-loading-overlay.is-error .franchise-loading-bar-fill {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  animation: none;
}
.franchise-loading-overlay.is-error .franchise-loading-percent { color: #dc2626; }

/* Modal-footer: gọn lại — không cần pill nữa */
.franchise-modal .modal-footer {
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

/* Mobile tuning */
@media (max-width: 540px) {
  .franchise-loading-card { padding: 22px 18px 18px; }
  .franchise-loading-icon { width: 68px; height: 68px; }
  .franchise-loading-emoji { font-size: 28px; }
  .franchise-loading-title { font-size: 16px; }
}
