/* ═══════════════════════════════════════════════════════════
   ESIM MANAGEMENT  —  Sunset Orange Brand
   ═══════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Stat Cards ─────────────────────────────────────────── */
.esim-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
  padding: 0.6rem 0;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 19px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.navy-tint   { background: var(--brand-primary-soft); color: var(--brand-primary); }
.teal-tint   { background: var(--brand-teal-soft);    color: var(--brand-teal); }
.orange-tint { background: var(--brand-primary-soft); color: var(--brand-primary); }
.red-tint    { background: #FEF2F2; color: var(--danger); }

.stat-content { display: flex; flex-direction: column; }

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.stat-value-group { display: flex; align-items: baseline; gap: 2px; }

.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-unit { font-size: 1rem; font-weight: 800; color: var(--text-muted); }
.stat-sub  { font-size: 0.67rem; font-weight: 500; color: var(--text-muted); margin-top: 4px; }

/* ── Filter Bar ─────────────────────────────────────────── */
.esim-filter-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1px 0;
  gap: 16px;
}

.filter-tabs {
  display: flex;
  align-items: center;
  background: var(--white);
  padding: 5px;
  border-radius: 160px;
  border: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: var(--shadow-xs);
}

.filter-tabs::-webkit-scrollbar { display: none; }

.tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 15px;
  border-radius: 160px;
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-item.active { background: var(--brand-primary); color: var(--white); }

.count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.7rem;
  border-radius: 10px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.tab-item.active .count { background: rgba(255, 255, 255, 0.22); color: var(--white); }

.filter-actions { display: flex; gap: 12px; }

.action-outline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all .18s;
}

.action-outline:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

/* ── eSIM Manage Grid ───────────────────────────────────── */
.esim-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 10px 0;
}

.esim-card-pro {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  position: relative;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.esim-card-pro:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-primary-soft); }

.card-row-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.flag-wrapper {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.flag-wrapper img { width: 100%; height: 100%; object-fit: cover; }

.name-meta { flex: 1; min-width: 0; }

.name-meta h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.name-meta p { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }

.status-box { display: flex; align-items: center; gap: 8px; }

/* Status pills */
.status-pill-mini {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill-mini.connected {
  background: var(--brand-teal-soft);
  color: var(--brand-teal);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-pill-mini .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); }
.status-pill-mini.connected .dot { background: var(--brand-teal); animation: pulse-green 2s infinite; }

.status-pill-mini.ready {
  background: var(--brand-primary-soft);
  color: var(--brand-primary-deep);
  border: 1px solid rgba(242, 166, 90, 0.25);
}

.status-pill-mini.ready .dot { background: var(--brand-primary); }

.status-pill-mini.expired {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid rgba(153, 27, 27, 0.2);
}

.status-pill-mini.expired .dot { background: #DC2626; }

@keyframes pulse-green {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70%  { transform: scale(1);    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Data Section */
.data-compact-section { margin: 14px 0; }

.data-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }

.data-main .val { font-size: 1.6rem; font-weight: 900; letter-spacing: -1px; color: var(--text-main); }
.data-main .unit { font-size: 0.8rem; font-weight: 800; color: var(--text-main); }
.total-label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }

.progress-bar-thin { height: 6px; background: var(--bg-main); border-radius: 10px; overflow: hidden; position: relative; }

.bar-fill { height: 100%; border-radius: 20px; }
.bar-fill.teal { background: var(--brand-teal); }
.bar-fill.red  { background: #EF4444; }

.data-sub-labels { display: flex; justify-content: space-between; font-size: 0.65rem; font-weight: 700; color: var(--text-muted); margin-top: 6px; }

/* Action Buttons */
.action-grid-tight { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

.btn-sm-primary,
.btn-sm-outline {
  padding: 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all .18s;
}

.plan-tag-compact { font-size: 0.75rem; color: var(--brand-primary); font-weight: 600; }

.btn-sm-primary { background: var(--brand-primary); color: white; border: none; box-shadow: var(--glow-orange); }
.btn-sm-primary:hover { background: var(--brand-primary-deep); transform: translateY(-1px); }

.btn-sm-outline { background: white; border: 1.5px solid var(--brand-primary); color: var(--brand-primary); }
.btn-sm-outline:hover { background: var(--brand-primary-soft); }
.btn-sm-outline.danger { color: #DC2626; border-color: #FEE2E2; }

/* Expiry */
.expiry-row-slim {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-main);
  padding: 6px 12px;
  border-radius: 8px;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-container {
  background: var(--white);
  width: 100%;
  max-width: 500px;
  border-top-left-radius: 32px;
  border-top-right-radius: 32px;
  padding: 24px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container { transform: translateY(0); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

.modal-title-group { display: flex; gap: 14px; align-items: center; }
.modal-title-group.centered { justify-content: center; width: 100%; flex-direction: column; text-align: center; }

.modal-flag { width: 48px; height: 48px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }
.modal-flag img { width: 100%; height: 100%; object-fit: cover; }

.modal-header h2 { font-size: 1.25rem; font-weight: 800; color: var(--text-main); letter-spacing: -0.02em; margin-bottom: 2px; }
.modal-header p  { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

.close-modal {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-main);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all .15s;
}

.close-modal:hover { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }

.status-strip { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-size: 0.8rem; font-weight: 700; margin-bottom: 20px; }
.status-strip.connected { background: var(--brand-teal-soft); color: var(--brand-teal); }

.detail-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-item .label { font-size: 0.65rem; font-weight: 800; color: var(--text-muted); letter-spacing: 0.05em; }
.info-item .val   { font-size: 0.85rem; font-weight: 700; color: var(--text-main); }

.modal-usage-card { background: var(--bg-main); padding: 20px; border-radius: 20px; margin-bottom: 24px; border: 1px solid var(--border); }
.usage-header { display: flex; justify-content: space-between; font-weight: 600; font-size: 0.9rem; margin-bottom: 12px; }

.modal-progress { height: 10px; background: var(--border); border-radius: 10px; overflow: hidden; }
.modal-progress-fill { height: 100%; background: var(--brand-primary); border-radius: 10px; transition: width 1s ease; }

.modal-footer  { display: flex; flex-direction: column; gap: 12px; }
.usage-footer  { font-size: 12px; color: var(--text-muted); font-weight: 600; padding-top: 3px; }

.btn-full { width: 100%; padding: 16px; border-radius: 16px; font-weight: 800; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; border: none; transition: all .18s; }
.btn-full.primary   { background: var(--brand-primary); color: white; box-shadow: var(--glow-orange); }
.btn-full.primary:hover { background: var(--brand-primary-deep); transform: translateY(-1px); }
.btn-full.secondary { background: var(--white); border: 1.5px solid var(--brand-primary); color: var(--brand-primary); }

/* Delete variant */
.icon-circle.danger {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FEF2F2;
  color: #991B1B;
  font-size: 1.1rem;
  border: 1px solid rgba(153, 27, 27, 0.08);
}

.modal-container.delete-variant .modal-header h2 { color: #991B1B; }
.modal-container.delete-variant { max-width: 420px; }

.icon-circle.danger-light { width: 44px; height: 44px; background: #FEF2F2; color: #EF4444; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }

.danger-alert-box { display: flex; gap: 12px; background: #FFF5F5; border: 1px solid #FEE2E2; padding: 16px; border-radius: 16px; margin-bottom: 8px; }
.danger-alert-box i { color: #DC2626; font-size: 1.2rem; margin-top: 2px; }
.alert-content strong { display: block; color: #991B1B; font-size: 0.9rem; font-weight: 800; margin-bottom: 4px; }
.alert-content p { font-size: 0.8rem; line-height: 1.4; color: #7F1D1D; opacity: 0.8; }

.footer-grid-dual { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; }
.btn-full.danger-solid { background: #EF4444; color: white; border: none; }
.btn-full.danger-solid:hover { background: #DC2626; }

/* Balance mini card */
.balance-mini-card { display: flex; justify-content: space-between; align-items: center; background: var(--bg-main); padding: 14px 18px; border-radius: 14px; margin-bottom: 24px; border: 1px solid var(--border); }
.b-info span { font-size: 0.65rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
.b-info p    { font-size: 0.9rem; font-weight: 700; color: var(--brand-primary); }
.b-data span { font-size: 1rem; font-weight: 900; color: var(--text-main); }

/* Dropdown */
.select-wrapper { position: relative; width: 100%; }

#planDropdown {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-primary);
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 12px;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s;
}

#planDropdown:focus { border-color: var(--brand-primary); outline: none; background: var(--brand-primary-soft); }

.select-wrapper i { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-muted); font-size: 1.2rem; }

.plan-preview-box { margin-top: 16px; padding: 16px; background: var(--bg-main); border: 1px dashed var(--border); border-radius: 12px; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.preview-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.preview-row:last-child { margin-bottom: 0; }
.p-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

/* Notifications */
#notificationContainer { position: fixed; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 2000; }

.notification {
  min-width: 220px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  color: white;
  box-shadow: var(--shadow-lg);
  transform: translateY(-8px);
  opacity: 0;
  transition: all 260ms ease;
  font-weight: 700;
}

.notification.visible { transform: translateY(0); opacity: 1; }
.notification-body { font-size: 0.9rem; }
.notification.notification-info    { background: var(--brand-secondary); }
.notification.notification-success { background: var(--brand-teal); }
.notification.notification-error   { background: #EF4444; }
.notification.notification-warning { background: var(--brand-primary); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .esim-filter-container { flex-direction: column; align-items: flex-start; }
  .filter-tabs { display: none; }
}

@media (max-width: 640px) {
  .esim-stats-row            { grid-template-columns: 1fr; }
  .esim-manage-grid          { grid-template-columns: 1fr; gap: 12px; }
  .esim-card-pro             { padding: 17px; border-radius: 16px; }
  .card-row-top              { gap: 10px; margin-bottom: 10px; }
  .flag-wrapper              { width: 36px; height: 36px; border-radius: 8px; }
  .name-meta h3              { font-size: 0.85rem; }
  .status-pill-mini          { padding: 2px 8px; font-size: 0.55rem; }
  .data-main .val            { font-size: 1.2rem; }
  .progress-bar-thin         { height: 4px; }
  .action-grid-tight         { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .btn-sm-primary, .btn-sm-outline { padding: 8px 4px; font-size: 0.6rem; flex-direction: column; gap: 2px; }
  .btn-sm-primary i, .btn-sm-outline i { font-size: 1rem; }
  .stat-card { padding: 20px; }
}

@media (max-width: 480px) {
  .modal-container { padding: 24px; max-height: 85vh; min-height: 40vh; overflow-y: auto; }
  .modal-header h2 { font-size: 1rem; }
  .modal-header p  { font-size: 0.7rem; }
  .modal-flag      { width: 36px; height: 36px; border-radius: 10px; }
  .close-modal     { width: 32px; height: 32px; font-size: 1rem; }
  .detail-info-grid { gap: 12px; margin-bottom: 16px; }
}

@media (min-width: 769px) {
  .modal-overlay { align-items: center; }
  .modal-container { border-radius: 32px; transform: scale(0.9); }
  .modal-overlay.active .modal-container { transform: scale(1); }
}