/* ============================================
   WebSoApps - Mobile Native App Design System
   Inspired by iOS/Android native feel
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Nunito+Sans:wght@400;600;700&display=swap');

:root {
  --primary: #1C1C2E;
  --surface: #FFFFFF;
  --surface-2: #F2F2F7;
  --surface-3: #E5E5EA;
  --accent: #5E5CE6;
  --accent-2: #FF6B6B;
  --green: #34C759;
  --yellow: #FFD60A;
  --orange: #FF9F0A;
  --red: #FF3B30;
  --blue: #007AFF;
  --purple: #AF52DE;
  --text: #1C1C2E;
  --text-2: #6E6E73;
  --text-3: #AEAEB2;
  --border: #E5E5EA;
  --nav-height: 80px;
  --header-height: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================
   APP SHELL
   ============================================ */

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  max-width: 430px;
  margin: 0 auto;
  background: var(--surface-2);
  box-shadow: 0 0 60px rgba(0,0,0,0.15);
}

/* ============================================
   STATUS BAR (simulated)
   ============================================ */

.status-bar {
  height: calc(44px + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--surface);
  display: flex;
  align-items: flex-end;
  padding-bottom: 8px;
  padding-left: 20px;
  padding-right: 20px;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 100;
}

.status-bar.transparent {
  background: transparent;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

/* ============================================
   SCREENS
   ============================================ */

.screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: none;
  flex-direction: column;
}

.screen.active { display: flex; }

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 100px;
}

/* ============================================
   NAVIGATION BAR (iOS style)
   ============================================ */

.nav-bar {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 4px 0;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-icon {
  font-size: 24px;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  transition: color 0.15s;
  letter-spacing: 0.01em;
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}

.nav-item.active .nav-label {
  color: var(--accent);
}

.nav-dot {
  position: absolute;
  top: 0;
  right: calc(50% - 18px);
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ============================================
   HEADER (iOS navigation bar style)
   ============================================ */

.page-header {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.page-header h1 {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 800;
  flex: 1;
  letter-spacing: -0.02em;
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.back-btn:active { transform: scale(0.9); }

.header-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.header-action:active { transform: scale(0.9); }

/* ============================================
   HERO / GREETING SECTION
   ============================================ */

.hero {
  background: linear-gradient(135deg, var(--accent) 0%, #3d3bcc 100%);
  padding: 24px 20px 40px;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.hero::after {
  content: '';
  position: absolute;
  right: 40px;
  bottom: -60px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.hero-greeting {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 4px;
  font-weight: 600;
}

.hero-name {
  font-family: 'Nunito', sans-serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero-cards {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.hero-cards::-webkit-scrollbar { display: none; }

.hero-card {
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 110px;
  text-align: center;
  flex-shrink: 0;
}

.hero-card-val {
  font-family: 'Nunito', sans-serif;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.hero-card-label {
  font-size: 11px;
  opacity: 0.8;
  font-weight: 600;
}

/* ============================================
   SECTION CONTAINERS
   ============================================ */

.section {
  padding: 20px 16px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-action {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 12px; }

.card-inner {
  padding: 16px;
}

/* List card - multiple items in one card */
.list-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  position: relative;
  transition: background 0.1s;
}

.list-item:active { background: var(--surface-2); }

.list-item + .list-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 56px;
  right: 0;
  height: 1px;
  background: var(--border);
}

.list-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.list-content { flex: 1; min-width: 0; }

.list-title {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-3);
}

.list-chevron::after {
  content: '›';
  font-size: 20px;
  color: var(--text-3);
}

/* Stat cards row */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 0;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-val {
  font-family: 'Nunito', sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

/* ============================================
   QUICK ACTIONS GRID
   ============================================ */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.quick-item:active .quick-icon { transform: scale(0.92); }

.quick-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quick-label {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: var(--text-2);
  line-height: 1.2;
}

/* ============================================
   HOMEWORK / CONTENT CARDS
   ============================================ */

.hw-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hw-card + .hw-card { margin-top: 10px; }

.hw-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.hw-card.subject-math::before { background: var(--blue); }
.hw-card.subject-science::before { background: var(--green); }
.hw-card.subject-english::before { background: var(--purple); }
.hw-card.subject-default::before { background: var(--accent); }

.hw-subject {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
}

.hw-title {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.hw-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 10px;
}

.hw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
}

.hw-due {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.hw-due.overdue { color: var(--red); }

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: 48px;
  border-radius: 14px;
  border: none;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-danger { background: var(--red); color: white; }
.btn-success { background: var(--green); color: white; }
.btn-ghost { background: transparent; color: var(--accent); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-full { width: 100%; }

.btn-sm { height: 36px; font-size: 13px; padding: 0 14px; border-radius: 10px; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.icon-btn:active { transform: scale(0.9); background: var(--surface-3); }

.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 20px rgba(94,92,230,0.4);
  z-index: 50;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab:active { transform: scale(0.9); }

/* ============================================
   FORMS (mobile-style)
   ============================================ */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  height: 52px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-control:focus { border-color: var(--accent); }

textarea.form-control {
  height: auto;
  padding: 14px 16px;
  resize: none;
  line-height: 1.5;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236E6E73' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ============================================
   BADGES & PILLS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
}

.badge-green { background: rgba(52,199,89,0.15); color: var(--green); }
.badge-red { background: rgba(255,59,48,0.12); color: var(--red); }
.badge-yellow { background: rgba(255,214,10,0.2); color: #8a7000; }
.badge-blue { background: rgba(0,122,255,0.12); color: var(--blue); }
.badge-purple { background: rgba(175,82,222,0.12); color: var(--purple); }
.badge-gray { background: var(--surface-2); color: var(--text-2); }
.badge-accent { background: rgba(94,92,230,0.12); color: var(--accent); }

/* ============================================
   SHEETS (bottom sheet)
   ============================================ */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: flex-end;
  backdrop-filter: blur(4px);
}

.sheet-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.sheet {
  width: 100%;
  max-height: 90dvh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  margin: 12px auto 4px;
  flex-shrink: 0;
}

.sheet-header {
  padding: 4px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sheet-title {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.sheet-body {
  padding: 0 20px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.sheet-footer {
  padding: 16px 20px calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   LOGIN SCREENS
   ============================================ */

.login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--accent) 0%, #3d3bcc 40%, #1C1C2E 100%);
  padding: 0;
  overflow: hidden;
}

.login-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 30px 20px;
  color: white;
}

.login-logo {
  font-family: 'Nunito', sans-serif;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.login-logo span { opacity: 0.65; }

.login-subtitle {
  font-size: 15px;
  opacity: 0.7;
  font-weight: 600;
  margin-bottom: 40px;
}

.login-card {
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 32px 24px calc(32px + var(--safe-bottom));
  flex-shrink: 0;
}

.login-title {
  font-family: 'Nunito', sans-serif;
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-hint {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* PIN INPUT */
.pin-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}

.pin-dot {
  width: 56px;
  height: 56px;
  border: 2px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  transition: all 0.15s;
  background: var(--surface-2);
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.pin-dot.active {
  border-color: var(--accent);
  background: var(--surface);
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.numpad-btn {
  height: 64px;
  border: none;
  border-radius: 16px;
  background: var(--surface-2);
  font-size: 24px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.numpad-btn:active { transform: scale(0.92); background: var(--surface-3); }
.numpad-btn.action-btn { background: var(--surface-3); font-size: 18px; }

/* ============================================
   MESSAGES / CHAT
   ============================================ */

.chat-container {
    display: none
}

.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
}

.bubble-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.bubble-wrap.mine { flex-direction: row-reverse; }

.bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bubble {
  max-width: 72%;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.45;
  position: relative;
}

.bubble.theirs {
  background: var(--surface);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}

.bubble.mine {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.bubble-time {
  font-size: 10px;
  opacity: 0.55;
  margin-top: 4px;
  text-align: right;
}

.chat-input-bar {
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 12px 16px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  outline: none;
  resize: none;
  background: var(--surface-2);
  transition: border-color 0.2s;
  line-height: 1.4;
  overflow-y: auto;
}

.chat-input:focus { border-color: var(--accent); }

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  color: white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.send-btn:active { transform: scale(0.9); }

/* ============================================
   FEES
   ============================================ */

.fee-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.fee-progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

.fee-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 30px;
  text-align: center;
  gap: 12px;
}

.empty-icon { font-size: 56px; margin-bottom: 8px; }

.empty h3 {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.empty p { font-size: 14px; color: var(--text-2); line-height: 1.5; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: calc(100% - 40px);
  max-width: 390px;
}

.toast {
  background: var(--primary);
  color: white;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.warning { background: var(--orange); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================
   DIVIDERS & MISC
   ============================================ */

.divider {
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-2);
}

.spacer { flex: 1; }

/* Segmented control (iOS style) */
.segment-ctrl {
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.segment-btn {
  flex: 1;
  height: 34px;
  border: none;
  border-radius: 8px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--text-2);
  transition: all 0.2s;
}

.segment-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface-2);
}

.upload-area:active, .upload-area.drag { border-color: var(--accent); background: rgba(94,92,230,0.05); }

/* ============================================
   SCREEN TRANSITIONS
   ============================================ */

.screen { transition: opacity 0.2s; }

.page-push {
  animation: pushIn 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.page-pop {
  animation: popOut 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes pushIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   RESPONSIVE / DESKTOP WRAPPER
   ============================================ */

@media (min-width: 500px) {
  #app {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 40px;
    overflow: hidden;
    margin: 20px auto;
    height: calc(100dvh - 40px);
    box-shadow: 0 30px 80px rgba(0,0,0,0.2);
  }
}

/* Color vars for themes */
.theme-teacher { --accent: #007AFF; }
.theme-student { --accent: #34C759; }
.theme-principal { --accent: #5E5CE6; }

/* ============================================
   CHAT ENHANCEMENTS (v2)
   ============================================ */

.chat-container { display: block !important; }

.bubble-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
  padding-left: 2px;
}

.bubble-wrap.mine .bubble-name { display: none; }

.principal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(94,92,230,0.12);
  color: #5E5CE6;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
}

.principal-interrupt {
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(94,92,230,0.08);
  border-left: 3px solid #5E5CE6;
  border-radius: 0 12px 12px 0;
}

.chat-header-pic {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.notif-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.notif-item.unread { background: rgba(94,92,230,0.04); }

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.notif-dot.read { background: transparent; }

.notif-content { flex: 1; }
.notif-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.notif-sub { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.chat-option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px;
}

.chat-option-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}

.chat-option-card:active { transform: scale(0.96); }
.chat-option-card.selected { border-color: var(--accent); background: rgba(94,92,230,0.06); }

.chat-option-icon { font-size: 28px; margin-bottom: 8px; }
.chat-option-label { font-weight: 700; font-size: 13px; }
.chat-option-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.people-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.people-list-item:active { background: var(--surface-2); }

.group-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bubble-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* ============================================================
   SCHOOL APP RICH CHAT STYLES
   Adapted from excellentcarcare with school accent #5E5CE6
   ============================================================ */

/* Chat Screen Layout */
#screen-chat {
  display: none;
  flex-direction: column;
  background: #E8E4F0;
  position: absolute;
  inset: 0;
  z-index: 10;
}
#screen-chat.active { display: flex; }

/* Chat Header */
.rich-chat-header {
  background: linear-gradient(135deg, #5E5CE6 0%, #3d3bcc 100%);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(94,92,230,0.3);
  transition: background 0.2s;
  min-height: 56px;
}
.rich-chat-header.selection-mode {
  background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
}
.rich-normal-header { display: flex; flex: 1; align-items: center; gap: 10px; }
.rich-normal-header.hidden { display: none; }
.rich-selection-header { display: none; flex: 1; align-items: center; gap: 12px; }
.rich-selection-header.active { display: flex; }
.rich-back-btn {
  background: none; border: none; color: white;
  font-size: 20px; cursor: pointer; padding: 6px; flex-shrink: 0;
}
.rich-header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0; overflow: hidden;
}
.rich-header-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.rich-header-info { flex: 1; min-width: 0; }
.rich-header-name { font-size: 15px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rich-header-sub { font-size: 11px; opacity: 0.85; }
.rich-sel-count { font-size: 17px; font-weight: 600; }
.rich-sel-actions { display: flex; gap: 16px; margin-left: auto; }
.rich-sel-btn { background: none; border: none; color: white; font-size: 19px; cursor: pointer; padding: 6px; }

/* Messages Area */
.rich-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  background: #E8E4F0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rich-messages::-webkit-scrollbar { width: 4px; }
.rich-messages::-webkit-scrollbar-thumb { background: rgba(94,92,230,0.3); border-radius: 2px; }

/* Date Dividers */
.rich-date-divider { text-align: center; margin: 12px 0; }
.rich-date-divider span {
  display: inline-block;
  background: rgba(255,255,255,0.85);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: #555;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Messages */
.rich-msg {
  display: flex;
  margin-bottom: 4px;
  align-items: flex-end;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  transition: background 0.2s;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  position: relative;
  border-radius: 4px;
  padding: 2px 4px;
}
.rich-msg:active { background: rgba(0,0,0,0.03); }
.rich-msg.selection-mode { cursor: pointer; }
.rich-msg.selected {
  background: rgba(94,92,230,0.15) !important;
  border-left: 3px solid #5E5CE6;
}
.rich-msg.selected.just-selected { animation: richSelPulse 0.3s ease; }
@keyframes richSelPulse {
  0% { background: rgba(94,92,230,0.3); }
  100% { background: rgba(94,92,230,0.15); }
}
.rich-msg.deleted .rich-msg-bubble {
  background: #f0f0f0 !important;
  font-style: italic;
  color: #888;
}
@keyframes richMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.rich-msg { animation: richMsgIn 0.2s ease; }
.rich-msg.highlight { animation: richHighlight 1.5s ease; }
@keyframes richHighlight {
  0% { background: transparent; }
  15% { background: rgba(94,92,230,0.18); }
  100% { background: transparent; }
}

/* Sent = right, received = left */
.rich-msg.sent { justify-content: flex-end; }
.rich-msg.received { justify-content: flex-start; }

/* Bubbles */
.rich-msg-bubble {
  padding: 7px 11px;
  position: relative;
  word-wrap: break-word;
  max-width: 72%;
  min-width: 80px;
}
.rich-msg.sent .rich-msg-bubble {
  background: #DDD9F8;
  border-radius: 10px 2px 10px 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.rich-msg.received .rich-msg-bubble {
  background: #ffffff;
  border-radius: 2px 10px 10px 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Sender label (groups) */
.rich-sender-label {
  font-size: 12px;
  color: #5E5CE6;
  font-weight: 700;
  margin-bottom: 3px;
}

/* Principal interrupt */
.rich-msg.principal-interrupt .rich-msg-bubble {
  border-left: 3px solid #5E5CE6;
}
.rich-principal-badge {
  display: inline-block;
  background: #5E5CE6;
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 5px;
  font-weight: 600;
  vertical-align: middle;
}

/* Reply preview inside bubble */
.rich-reply-preview {
  background: rgba(94,92,230,0.08);
  border-left: 3px solid #5E5CE6;
  padding: 6px 8px;
  margin-bottom: 6px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.rich-reply-preview:hover { background: rgba(94,92,230,0.14); }
.rich-reply-header { color: #5E5CE6; font-weight: 700; font-size: 11px; margin-bottom: 2px; }
.rich-reply-text { color: #777; font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Message text */
.rich-msg-text { font-size: 14px; line-height: 1.45; margin-bottom: 3px; color: #111; }
.rich-msg-time {
  font-size: 11px; color: #888;
  display: flex; align-items: center; justify-content: flex-end; gap: 3px;
  margin-top: 2px;
}
.rich-msg.sent .rich-msg-time { color: #6060C0; }
.rich-read-tick { color: #5E5CE6; font-size: 14px; }

/* Media in bubbles */
.rich-media-wrap {
  margin: 3px 0;
  max-width: 260px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #eee;
}
.rich-media-wrap img, .rich-media-wrap video {
  max-width: 100%; width: 100%; height: auto;
  max-height: 240px; display: block;
  object-fit: contain; border-radius: 8px;
  cursor: pointer; transition: filter 0.3s, opacity 0.3s;
}
.rich-media-wrap img.loading { filter: blur(8px); opacity: 0.6; }
.rich-media-wrap img.loaded { filter: none; opacity: 1; }
.rich-media-spinner {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #5E5CE6;
  border-radius: 50%;
  animation: richSpin 0.8s linear infinite;
  pointer-events: none;
}
@keyframes richSpin { to { transform: translate(-50%,-50%) rotate(360deg); } }

/* Video container */
.rich-video-wrap {
  position: relative; display: inline-block;
  max-width: 260px; max-height: 260px;
  cursor: pointer;
}
.rich-video-wrap img, .rich-video-wrap video {
  max-width: 260px; max-height: 260px;
  width: auto; height: auto;
  border-radius: 8px; display: block;
}
.rich-video-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 52px; height: 52px;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 22px;
  pointer-events: none;
}
.rich-video-dur {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.65);
  color: white; padding: 1px 5px;
  border-radius: 4px; font-size: 11px; font-weight: 500;
}

/* Document bubble */
.rich-doc {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; background: rgba(0,0,0,0.04);
  border-radius: 8px; cursor: pointer; transition: background 0.2s;
  max-width: 240px; min-width: 180px;
}
.rich-doc:hover { background: rgba(0,0,0,0.07); }
.rich-doc-preview {
  width: 48px; height: 48px; border-radius: 6px;
  overflow: hidden; flex-shrink: 0; background: #f0f0f0; position: relative;
}
.rich-doc-preview img { width: 100%; height: 100%; object-fit: cover; }
.rich-doc-preview-badge {
  position: absolute; bottom: 0; right: 0;
  background: rgba(94,92,230,0.9); padding: 3px;
  border-radius: 3px 0 0 0; color: white; font-size: 11px;
}
.rich-doc-icon {
  width: 40px; height: 40px; background: #5E5CE6;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; flex-shrink: 0;
}
.rich-doc-icon.doc-word { background: #2b579a; }
.rich-doc-icon.doc-excel { background: #217346; }
.rich-doc-icon.doc-ppt { background: #d24726; }
.rich-doc-icon.doc-txt { background: #6c757d; }
.rich-doc-info { flex: 1; min-width: 0; }
.rich-doc-name { font-size: 13px; font-weight: 600; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rich-doc-size { font-size: 11px; color: #888; margin-top: 1px; }

/* Voice message */
.rich-voice {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; background: rgba(94,92,230,0.08);
  border-radius: 18px; min-width: 140px;
}
.rich-voice-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: #5E5CE6; border: none;
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.rich-voice-dur { font-size: 13px; color: #444; }

/* Message options button (on hover) */
.rich-msg-options {
  position: absolute; top: 6px; right: 6px;
  display: none;
}
.rich-msg:hover .rich-msg-options { display: block; }
.rich-msg-options-btn {
  background: rgba(0,0,0,0.08); border: none;
  border-radius: 50%; width: 22px; height: 22px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #444; font-size: 11px;
}
.rich-options-menu {
  position: fixed; background: white;
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 140px; z-index: 9999; overflow: hidden;
  animation: richMenuIn 0.15s ease;
}
@keyframes richMenuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.rich-option-item {
  padding: 11px 15px; cursor: pointer;
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; color: #222; transition: background 0.15s;
}
.rich-option-item:hover { background: #f5f5f5; }
.rich-option-item.danger { color: #e31e24; }
.rich-option-item.danger:hover { background: #fff0f0; }
.rich-option-item i { width: 14px; text-align: center; }

/* Input area */
.rich-reply-bar {
  background: white; padding: 8px 14px;
  border-left: 3px solid #5E5CE6;
  display: none; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.rich-reply-bar.show { display: flex; }
.rich-reply-bar-content { flex: 1; }
.rich-reply-bar-header { font-size: 11px; color: #5E5CE6; font-weight: 700; margin-bottom: 3px; }
.rich-reply-bar-text { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rich-reply-bar-close { background: none; border: none; color: #aaa; cursor: pointer; font-size: 20px; padding: 0 6px; }

.rich-input-area {
  background: #f0eef8;
  padding: 8px 12px;
  display: flex; align-items: flex-end; gap: 8px;
  flex-shrink: 0;
}
.rich-attach-btn {
  background: none; border: none; color: #7070C0;
  font-size: 22px; cursor: pointer; padding: 8px;
  position: relative; flex-shrink: 0;
}
.rich-attach-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  background: white; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 6px; display: none; flex-direction: column; gap: 2px;
  min-width: 170px; z-index: 100;
}
.rich-attach-menu.show { display: flex; }
.rich-attach-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s;
}
.rich-attach-option:hover { background: #f5f5f5; }
.rich-attach-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 15px; flex-shrink: 0;
}
.rich-attach-icon.img { background: #7f66ff; }
.rich-attach-icon.vid { background: #f15c5c; }
.rich-attach-icon.doc { background: #5157ae; }
.rich-attach-label { font-size: 14px; color: #222; }
.rich-input-wrapper {
  flex: 1; background: white; border-radius: 22px;
  padding: 7px 13px; display: flex; align-items: flex-end; gap: 6px;
}
.rich-textarea {
  flex: 1; border: none; outline: none;
  font-family: inherit; font-size: 14px;
  resize: none; max-height: 100px; overflow-y: auto;
  background: transparent; line-height: 1.4;
}
.rich-emoji-btn { background: none; border: none; color: #888; font-size: 18px; cursor: pointer; }
.rich-send-btn, .rich-voice-rec-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: none; background: #5E5CE6;
  color: white; font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform 0.15s;
}
.rich-send-btn:hover, .rich-voice-rec-btn:hover { transform: scale(1.05); }
.rich-send-btn { display: none; }
.rich-send-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }
.rich-voice-rec-btn.recording { background: #f15c5c; animation: richPulse 1s infinite; }
@keyframes richPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Media fullscreen modal */
.rich-media-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.92); z-index: 9998;
  align-items: center; justify-content: center;
}
.rich-media-modal.show { display: flex; }
.rich-media-modal-close {
  position: absolute; top: 18px; right: 18px;
  background: rgba(255,255,255,0.15); border: none;
  color: white; font-size: 28px; width: 46px; height: 46px;
  border-radius: 50%; cursor: pointer;
}
.rich-media-modal-content { max-width: 92%; max-height: 90%; }
.rich-media-modal-content img, .rich-media-modal-content video {
  max-width: 100%; max-height: 90vh; border-radius: 8px;
}

/* Attachment preview modal */
.rich-attach-preview-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.95); z-index: 9999;
  flex-direction: column;
}
.rich-attach-preview-modal.show { display: flex; }
.rich-attach-preview-header {
  padding: 14px 18px; display: flex; align-items: center; gap: 12px;
  background: rgba(0,0,0,0.3);
}
.rich-attach-preview-close { background: none; border: none; color: white; font-size: 26px; cursor: pointer; }
.rich-attach-preview-title { color: white; font-size: 17px; font-weight: 600; }
.rich-attach-preview-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow: auto;
}
.rich-attach-preview-container { max-width: 560px; max-height: 65vh; display: flex; flex-direction: column; gap: 8px; }
.rich-attach-preview-item {
  background: rgba(255,255,255,0.08); border-radius: 10px;
  padding: 12px; position: relative;
}
.rich-attach-preview-item img, .rich-attach-preview-item video {
  max-width: 100%; max-height: 360px; border-radius: 6px; display: block; margin: 0 auto;
}
.rich-attach-preview-doc {
  display: flex; align-items: center; gap: 12px; color: white;
}
.rich-attach-preview-doc-icon {
  width: 46px; height: 46px; background: #5E5CE6;
  border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 22px; color: white;
}
.rich-attach-preview-doc-name { font-size: 15px; font-weight: 600; }
.rich-attach-preview-doc-size { font-size: 13px; opacity: 0.7; margin-top: 2px; }
.rich-attach-preview-footer {
  background: rgba(0,0,0,0.3); padding: 12px 18px;
  display: flex; align-items: center; gap: 8px;
}
.rich-attach-caption {
  flex: 1; background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 22px; padding: 10px 18px;
  color: white; font-family: inherit; font-size: 14px; outline: none;
}
.rich-attach-caption::placeholder { color: rgba(255,255,255,0.5); }
.rich-attach-send-btn {
  width: 46px; height: 46px; background: #5E5CE6;
  border: none; border-radius: 50%; color: white;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.rich-attach-send-btn:hover { transform: scale(1.06); }
.rich-uploading {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: rgba(0,0,0,0.8); padding: 18px 26px;
  border-radius: 10px; color: white;
  display: none; flex-direction: column; align-items: center; gap: 12px;
}
.rich-uploading.show { display: flex; }
.rich-uploading-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #5E5CE6;
  border-radius: 50%; animation: richSpin 0.8s linear infinite;
}

/* Delete modal */
.rich-delete-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 10000;
  align-items: center; justify-content: center;
}
.rich-delete-modal.show { display: flex; }
.rich-delete-content {
  background: white; border-radius: 14px;
  padding: 22px; max-width: 360px; width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.rich-delete-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.rich-delete-msg { font-size: 14px; color: #666; margin-bottom: 20px; }
.rich-delete-opts { display: flex; flex-direction: column; gap: 10px; }
.rich-delete-btn {
  padding: 11px; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-align: left; transition: opacity 0.15s;
}
.rich-delete-btn:hover { opacity: 0.85; }
.rich-delete-for-me { background: #f0f0f0; color: #222; }
.rich-delete-for-all { background: #5E5CE6; color: white; }
.rich-delete-cancel { background: #e5e5ea; color: #555; }

/* Prevent media interaction in selection mode */
.rich-msg.selection-mode .rich-media-wrap,
.rich-msg.selection-mode .rich-video-wrap,
.rich-msg.selection-mode .rich-doc,
.rich-msg.selection-mode .rich-voice { pointer-events: none !important; }
