/* =============================================================================
   PaisaSavy Mobile-App UI Design System (Bottom Sheets, Drawers, Toasts, Pills)
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Floating Toast Snackbars
   ----------------------------------------------------------------------------- */
.mobile-toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 90vw;
  width: 380px;
  pointer-events: none;
}

@media (max-width: 576px) {
  .mobile-toast-container {
    top: auto;
    bottom: calc(64px + 1rem); /* Clear bottom nav on mobile */
    left: 1rem;
    right: 1rem;
    width: auto;
  }
}

.mobile-toast {
  position: relative;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: rgba(18, 22, 34, 0.96);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 0.865rem;
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  transform: translateY(-12px) scale(0.96);
  opacity: 0;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.mobile-toast.hide {
  transform: translateY(10px) scale(0.92);
  opacity: 0;
}

.mobile-toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.mobile-toast.toast-success .mobile-toast-icon {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.mobile-toast.toast-error .mobile-toast-icon {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.mobile-toast.toast-warning .mobile-toast-icon {
  background: rgba(245, 158, 11, 0.16);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.mobile-toast.toast-info .mobile-toast-icon {
  background: rgba(99, 102, 241, 0.16);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.mobile-toast-content {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.mobile-toast-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: color 0.15s ease;
}

.mobile-toast-close:hover {
  color: #ffffff;
}

/* Light mode toasts */
[data-bs-theme="light"] .mobile-toast {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
}

[data-bs-theme="light"] .mobile-toast-close {
  color: rgba(0, 0, 0, 0.4);
}

/* -----------------------------------------------------------------------------
   2. Mobile Bottom-Sheet & Action Drawer System
   ----------------------------------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  background: #0f131c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
  z-index: 99995;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.mobile-bottom-sheet.active {
  transform: translateY(0);
}

/* Desktop adaptive modal view */
@media (min-width: 768px) {
  .mobile-bottom-sheet.desktop-adaptive {
    top: 50%;
    bottom: auto;
    border-radius: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
    left: 50%;
    right: auto;
    max-height: 82vh;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  }

  .mobile-bottom-sheet.desktop-adaptive.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* Sheet Top Handle */
.sheet-handle-bar {
  width: 100%;
  padding-top: 10px;
  padding-bottom: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: grab;
}

.sheet-handle {
  width: 44px;
  height: 4.5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
}

[data-bs-theme="light"] .sheet-handle {
  background: rgba(0, 0, 0, 0.2);
}

/* Sheet Header */
.sheet-header {
  padding: 0.75rem 1.25rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sheet-header-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sheet-header-subtitle {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 2px;
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}

.sheet-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Sheet Scrollable Body */
.sheet-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}

/* Sheet Footer */
.sheet-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  gap: 0.75rem;
}

/* Light mode bottom sheet */
[data-bs-theme="light"] .mobile-bottom-sheet {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-bs-theme="light"] .sheet-header {
  border-bottom-color: #e2e8f0;
}

[data-bs-theme="light"] .sheet-header-title {
  color: #0f172a;
}

[data-bs-theme="light"] .sheet-header-subtitle {
  color: #64748b;
}

[data-bs-theme="light"] .sheet-close-btn {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

[data-bs-theme="light"] .sheet-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-bs-theme="light"] .sheet-footer {
  border-top-color: #e2e8f0;
  background: #f8fafc;
}

/* -----------------------------------------------------------------------------
   3. Rich Scenario Cards in Bottom Sheet
   ----------------------------------------------------------------------------- */
.scenario-card-item {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.scenario-card-item:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.scenario-card-item.selected {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
  border-color: #6366f1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35), 0 4px 14px rgba(99, 102, 241, 0.15);
}

.scenario-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.scenario-card-item.selected .scenario-card-icon {
  background: #6366f1;
  color: #ffffff;
  border-color: #818cf8;
}

.scenario-card-details {
  flex: 1;
  min-width: 0;
}

.scenario-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.scenario-condition-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  line-height: 1;
}

.scenario-badge-bull {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.scenario-badge-bear {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.scenario-badge-inflation {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.scenario-badge-growth {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.scenario-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 0.25rem;
  line-height: 1.35;
}

.scenario-card-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.scenario-card-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.scenario-meta-chip {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.scenario-radio-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s ease;
}

.scenario-card-item.selected .scenario-radio-check {
  border-color: #6366f1;
  background: #6366f1;
  color: #ffffff;
}

.scenario-card-item.selected .scenario-radio-check::after {
  content: '✓';
  font-size: 0.7rem;
  font-weight: 900;
}

/* Light mode scenario cards */
[data-bs-theme="light"] .scenario-card-item {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-bs-theme="light"] .scenario-card-item:hover {
  background: #f8fafc;
  border-color: #a5b4fc;
}

[data-bs-theme="light"] .scenario-card-item.selected {
  background: #f0f4ff;
  border-color: #6366f1;
}

[data-bs-theme="light"] .scenario-card-title {
  color: #0f172a;
}

[data-bs-theme="light"] .scenario-card-desc {
  color: #64748b;
}

[data-bs-theme="light"] .scenario-meta-chip {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

/* -----------------------------------------------------------------------------
   4. Mobile Action Confirmation Sheet (Replacing confirm())
   ----------------------------------------------------------------------------- */
.confirm-sheet-content {
  text-align: center;
  padding: 0.75rem 0.5rem;
}

.confirm-sheet-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.confirm-sheet-icon.danger {
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.confirm-sheet-icon.warning {
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.confirm-sheet-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.5rem;
}

.confirm-sheet-message {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.btn-sheet-confirm {
  width: 100%;
  padding: 0.85rem;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-sheet-danger {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-sheet-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-sheet-primary {
  background: #6366f1;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-sheet-primary:hover {
  background: #4f46e5;
  transform: translateY(-1px);
}

.btn-sheet-cancel {
  width: 100%;
  padding: 0.8rem;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sheet-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

[data-bs-theme="light"] .confirm-sheet-title {
  color: #0f172a;
}

[data-bs-theme="light"] .confirm-sheet-message {
  color: #64748b;
}

[data-bs-theme="light"] .btn-sheet-cancel {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

[data-bs-theme="light"] .btn-sheet-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* -----------------------------------------------------------------------------
   5. Segmented Control Touch Pills (Replacing <select> in Profile)
   ----------------------------------------------------------------------------- */
.segmented-control {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  width: 100%;
  box-sizing: border-box;
}

.segmented-pill {
  flex: 1;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  text-align: center;
  white-space: nowrap;
}

.segmented-pill:hover {
  color: #f1f5f9;
}

.segmented-pill.active {
  background: #6366f1;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

[data-bs-theme="light"] .segmented-control {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

[data-bs-theme="light"] .segmented-pill {
  color: #64748b;
}

[data-bs-theme="light"] .segmented-pill:hover {
  color: #0f172a;
}

[data-bs-theme="light"] .segmented-pill.active {
  background: #4f46e5;
  color: #ffffff;
}
