/* ============================================================
   SPLITEASY - GLASSMORPHIC DESIGN SYSTEM & COMPONENT STYLES
   ============================================================ */

#splitease-app {
  position: fixed;
  inset: 0;
  background: var(--bg, #F8F8F6);
  z-index: 9999;
  display: none;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-family: var(--font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  color: var(--text, #1A1A18);
}

/* NAVBAR */
.se-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface, #FFFFFF);
  border-bottom: 1px solid var(--border, #E8E8E4);
  box-shadow: var(--shadow, 0 2px 16px rgba(0,0,0,0.05));
  z-index: 10;
}

.se-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2, #F2F2F0);
  border: 1px solid var(--border, #E8E8E4);
  color: var(--text, #1A1A18);
  padding: 6px 12px;
  border-radius: var(--radius-sm, 8px);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.se-back-btn:active {
  transform: scale(0.96);
  opacity: 0.85;
}

.se-app-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.se-sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 4px;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.se-sync-dot.synced {
  background-color: var(--green, #22C55E);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.se-sync-dot.local {
  background-color: var(--red, #EF4444);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.se-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.se-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2, #F2F2F0);
  border: 1px solid var(--border, #E8E8E4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s;
}

.se-icon-btn:active {
  transform: scale(0.92);
}

/* PULL TO REFRESH INDICATOR */
.se-ptr-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  transition: height 0.15s ease-out, opacity 0.15s ease-out;
  opacity: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2, #6B6B65);
  user-select: none;
}

.se-ptr-indicator.visible {
  opacity: 1;
}

.se-ptr-spinner {
  font-size: 13px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.se-ptr-spinner.spinning {
  animation: se-ptr-spin 0.75s linear infinite;
}

@keyframes se-ptr-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* MAIN LAYOUT BODY */
.se-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* GROUP SELECTOR STRIP & TEMPLATE BADGES */
.se-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.se-group-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
}

.se-group-select {
  padding: 6px 10px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border, #E8E8E4);
  background: var(--surface, #FFFFFF);
  color: var(--text, #1A1A18);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  flex: 1;
}

.se-template-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.se-template-tour { background: var(--purple-soft, #EDE9FE); color: var(--purple, #8B5CF6); }
.se-template-flat { background: var(--accent-soft, #EBF1FD); color: var(--accent, #2D6BE4); }
.se-template-outing { background: var(--orange-soft, #FFEDD5); color: var(--orange, #F97316); }
.se-template-custom { background: var(--surface2, #F2F2F0); color: var(--text2, #6B6B65); }

.se-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--surface2, #F2F2F0);
  border: 1px dashed var(--accent, #2D6BE4);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent, #2D6BE4);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: transform 0.15s ease, background 0.15s ease;
}
.se-code-pill:active {
  transform: scale(0.95);
  background: var(--accent-soft, #EBF1FD);
}

/* SUMMARY BALANCE STATS (4 PARALLEL CARDS) */
.se-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}

.se-stat-card {
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--border, #E8E8E4);
  border-radius: var(--radius-sm, 8px);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  box-shadow: var(--shadow, 0 2px 12px rgba(0,0,0,0.02));
  min-width: 0;
}

.se-stat-title {
  font-size: 9px;
  font-weight: 600;
  color: var(--text2, #6B6B65);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.se-stat-value {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.se-val-green { color: var(--green, #22C55E); }
.se-val-red { color: var(--red, #EF4444); }
.se-val-neutral { color: var(--text, #1A1A18); }

/* TABS SYSTEM (Expenses vs Simplified Debts vs Members) */
.se-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1.5px solid var(--border, #E8E8E4);
  margin-bottom: 16px;
}

.se-tab-btn {
  padding: 8px 12px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2, #6B6B65);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.se-tab-btn.active {
  color: var(--accent, #2D6BE4);
}

.se-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--accent, #2D6BE4);
  border-radius: 3px 3px 0 0;
}

/* EXPENSE LEDGER ITEMS */
.se-ledger {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.se-expense-item {
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--border, #E8E8E4);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.se-expense-item:active {
  transform: scale(0.99);
}

.se-exp-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.se-exp-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-soft, #EBF1FD);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.se-exp-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.se-exp-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #1A1A18);
}

.se-exp-sub {
  font-size: 11px;
  color: var(--text2, #6B6B65);
}

.se-exp-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.se-exp-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #1A1A18);
}

.se-exp-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface2, #F2F2F0);
  color: var(--text3, #A8A8A0);
  font-weight: 600;
}

/* DEBT SIMPLIFICATION CARDS */
.se-debt-card {
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--border, #E8E8E4);
  border-radius: var(--radius, 14px);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.se-debt-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
}

.se-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.se-arrow {
  color: var(--accent, #2D6BE4);
  font-weight: 900;
}

/* MODAL DIALOGS */
.se-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.se-modal-overlay.show {
  display: flex !important;
}

.se-modal {
  background: var(--surface, #FFFFFF);
  border-radius: var(--radius, 14px);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg, 0 8px 40px rgba(0,0,0,0.2));
  display: flex;
  flex-direction: column;
}

.se-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #E8E8E4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.se-modal-title {
  font-size: 18px;
  font-weight: 800;
}

.se-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* INCLUDE ME TOGGLE CONTROL */
.se-toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2, #F2F2F0);
  padding: 12px 14px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border, #E8E8E4);
}

.se-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.se-toggle-title {
  font-size: 14px;
  font-weight: 700;
}

.se-toggle-sub {
  font-size: 12px;
  color: var(--text2, #6B6B65);
}

.se-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.se-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.se-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border, #CCC);
  transition: 0.3s;
  border-radius: 24px;
}

.se-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .se-slider {
  background-color: var(--green, #22C55E);
}

input:checked + .se-slider:before {
  transform: translateX(20px);
}

/* FLOATING ACTION BUTTON (+ EXPENSE) */
.se-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent, #2D6BE4);
  color: #fff;
  padding: 10px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(45,107,228,0.35);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s;
  z-index: 99;
}

.se-fab:active {
  transform: scale(0.95);
}
