/* ===================================================
   FAMILLE CALVET - Apple Glass Design System (iOS / visionOS)
   =================================================== */

/* --- CSS Variables (Apple Human Interface Guidelines) --- */
:root {
  --ios-blue:       #0A84FF;
  --ios-blue-rgb:   10, 132, 255;
  --ios-green:      #30D158;
  --ios-green-rgb:  48, 209, 88;
  --ios-orange:     #FF9F0A;
  --ios-orange-rgb: 255, 159, 10;
  --ios-red:        #FF453A;
  --ios-red-rgb:    255, 69, 58;
  --ios-purple:     #BF5AF2;
  --ios-pink:       #FF375F;
  --ios-teal:       #64D2FF;
  --ios-yellow:     #FFD60A;

  --bg-primary:     #050508;
  --bg-secondary:   rgba(255, 255, 255, 0.04);
  --bg-tertiary:    rgba(255, 255, 255, 0.08);

  --text-primary:   #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-tertiary:  rgba(255, 255, 255, 0.38);

  /* Apple Glassmorphism */
  --glass-bg:             rgba(22, 22, 28, 0.65);
  --glass-bg-elevated:    rgba(32, 32, 40, 0.75);
  --glass-border:         rgba(255, 255, 255, 0.12);
  --glass-border-light:   rgba(255, 255, 255, 0.18);
  --glass-specular:       inset 0 1px 0 0 rgba(255, 255, 255, 0.18);
  --glass-blur:           28px;
  --glass-saturate:       190%;

  --tab-height:     82px;
  --header-height:  56px;
  --safe-top:       env(safe-area-inset-top, 44px);
  --safe-bottom:    env(safe-area-inset-bottom, 34px);

  --radius-xs:      6px;
  --radius-sm:      10px;
  --radius-md:      16px;
  --radius-lg:      22px;
  --radius-xl:      30px;
  --radius-full:    9999px;

  --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md:      0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg:      0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glass:   0 8px 32px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 0 rgba(255, 255, 255, 0.15);

  --transition-fast: 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  background-color: #050508;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

/* --- Prevent iOS Safari Auto-Zoom on Form Controls --- */
input,
textarea,
select,
button {
  -webkit-text-size-adjust: 100%;
}

input,
textarea,
select,
.ios-input,
.ios-select,
.chat-textarea,
.gif-search-input {
  font-size: 16px !important;
}

/* Ambient dynamic background lighting */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

body::before {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(10, 132, 255, 0.5) 0%, rgba(191, 90, 242, 0.2) 60%, transparent 100%);
  top: -80px;
  right: -80px;
  animation: floatAmbient1 14s ease-in-out infinite alternate;
}

body::after {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(100, 210, 255, 0.4) 0%, rgba(48, 209, 88, 0.15) 60%, transparent 100%);
  bottom: 40px;
  left: -80px;
  animation: floatAmbient2 18s ease-in-out infinite alternate;
}

@keyframes floatAmbient1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, 60px) scale(1.15); }
}

@keyframes floatAmbient2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, -40px) scale(1.1); }
}

/* --- SVG Icon Utilities --- */
.svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.svg-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- Utility --- */
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.full-width { width: 100%; }

/* ===================================================
   SCREENS
   =================================================== */
.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #050508;
  transition: opacity var(--transition-slow);
}
.screen.active { opacity: 1; pointer-events: all; }
.screen.hidden { opacity: 0; pointer-events: none; display: none !important; }

/* ===================================================
   LOGIN SCREEN
   =================================================== */
#login-screen {
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-blur-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.3;
}
.login-blur-circle.c1 { width: 340px; height: 340px; background: var(--ios-blue); top: -80px; left: -100px; }
.login-blur-circle.c2 { width: 280px; height: 280px; background: var(--ios-purple); bottom: 80px; right: -80px; }
.login-blur-circle.c3 { width: 220px; height: 220px; background: var(--ios-teal); bottom: -60px; left: 30%; }

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  padding-top: max(24px, var(--safe-top));
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon-svg {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.3) 0%, rgba(191, 90, 242, 0.25) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ios-blue);
  box-shadow: 0 12px 30px rgba(10, 132, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.logo-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin-bottom: 6px;
}

.logo-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ===================================================
   APPLE GLASS CARD
   =================================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Specular light shimmer on top edge */
.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  pointer-events: none;
}

/* ===================================================
   FORMS & INPUTS (iOS Glass)
   =================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: block;
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
  z-index: 2;
  transition: color var(--transition-fast);
}

.input-wrapper:focus-within .input-icon-svg {
  color: var(--ios-blue);
}

.ios-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  padding: 13px 16px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-appearance: none;
}

.input-wrapper .ios-input {
  padding-left: 42px;
  padding-right: 42px;
}

.ios-input:focus {
  border-color: var(--ios-blue);
  background: rgba(10, 132, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.ios-input::placeholder {
  color: var(--text-tertiary);
}

.ios-textarea {
  resize: none;
  min-height: 80px;
}

.ios-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  padding: 10px 14px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.ios-select:focus {
  border-color: var(--ios-blue);
}

.ios-select option {
  background: #1C1C22;
  color: white;
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}

.toggle-password:active { color: var(--text-primary); }

.error-message {
  background: rgba(255, 69, 58, 0.15);
  border: 1px solid rgba(255, 69, 58, 0.35);
  border-radius: var(--radius-sm);
  color: #FFA39E;
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 12px;
  text-align: center;
  backdrop-filter: blur(10px);
}

/* ===================================================
   BUTTONS (Apple Cupertino Style)
   =================================================== */
.ios-btn-primary {
  width: 100%;
  background: linear-gradient(180deg, #0A84FF 0%, #0066CC 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 20px;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: opacity var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ios-btn-primary:active {
  opacity: 0.85;
  transform: scale(0.98);
}

.ios-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.ios-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 18px;
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  backdrop-filter: blur(12px);
}

.ios-btn-secondary:active { background: rgba(255, 255, 255, 0.14); }

.ios-btn-danger {
  background: rgba(255, 69, 58, 0.15);
  border: 1px solid rgba(255, 69, 58, 0.3);
  border-radius: var(--radius-md);
  color: var(--ios-red);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 18px;
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ios-btn-danger:active { background: rgba(255, 69, 58, 0.25); }

.ios-btn-sm {
  background: rgba(10, 132, 255, 0.12);
  border: 1px solid rgba(10, 132, 255, 0.25);
  border-radius: var(--radius-full);
  color: var(--ios-blue);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
}

.ios-btn-sm:active { background: rgba(10, 132, 255, 0.22); transform: scale(0.97); }
.ios-btn-sm.danger { color: var(--ios-red); background: rgba(255, 69, 58, 0.12); border-color: rgba(255, 69, 58, 0.25); }
.ios-btn-sm.danger:active { background: rgba(255, 69, 58, 0.22); }

.ios-btn-icon {
  background: linear-gradient(180deg, #0A84FF 0%, #0066CC 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  width: 42px;
  height: 42px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.35);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.ios-btn-icon:active { transform: scale(0.92); opacity: 0.85; }

/* ===================================================
   APP HEADER (Apple Glass Bar)
   =================================================== */
.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  padding-top: env(safe-area-inset-top, 12px);
  height: calc(52px + env(safe-area-inset-top, 12px));
  position: relative;
  z-index: 100;
}

.glass-header {
  background: rgba(10, 10, 14, 0.65);
  backdrop-filter: blur(35px) saturate(200%);
  -webkit-backdrop-filter: blur(35px) saturate(200%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.header-avatar {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
  color: var(--text-secondary);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.header-avatar:active {
  transform: scale(0.94);
  border-color: var(--ios-blue);
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.header-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.header-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.94);
}

/* ===================================================
   MAIN CONTENT
   =================================================== */
.app-content {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.tab-content {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 16px));
  -webkit-overflow-scrolling: touch;
  display: none;
}

.tab-content.active { display: block; }
.tab-content.chat-tab { padding: 0; display: none; flex-direction: column; }
.tab-content.chat-tab.active { display: flex; }

/* ===================================================
   SECTION HEADERS
   =================================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .section-title-icon {
  width: 26px;
  height: 26px;
  color: var(--ios-blue);
}

.section-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  margin-top: 22px;
}

/* ===================================================
   CALENDAR
   =================================================== */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 12px 18px;
}

.cal-nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ios-blue);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.cal-nav-btn:active { background: rgba(10, 132, 255, 0.2); transform: scale(0.92); }

.cal-month-display {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  text-align: center;
}

.cal-month-display span + span {
  margin-left: 6px;
  color: var(--text-secondary);
  font-weight: 400;
}

.calendar-grid-container {
  padding: 14px;
  margin-bottom: 16px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  padding: 4px 0;
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  transition: background var(--transition-fast), transform var(--transition-fast);
  position: relative;
}

.cal-day:active { background: rgba(255, 255, 255, 0.1); transform: scale(0.92); }
.cal-day.other-month { color: var(--text-tertiary); opacity: 0.4; }
.cal-day.today { font-weight: 700; color: var(--ios-blue); }
.cal-day.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background: var(--ios-blue);
  border-radius: 50%;
}

.cal-day.selected {
  background: var(--ios-blue);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(10, 132, 255, 0.4);
}
.cal-day.selected::after { background: white; }

.cal-day.has-event::before {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 5px;
  height: 5px;
  background: var(--ios-orange);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--ios-orange);
}

.events-list {
  margin-bottom: 16px;
}

.events-list-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.event-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 3px solid var(--ios-blue);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.event-card:active { transform: scale(0.99); background: rgba(255, 255, 255, 0.08); }

.event-info { flex: 1; min-width: 0; }
.event-title { font-size: 15px; font-weight: 600; margin-bottom: 3px; word-break: break-word; }
.event-time { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }
.event-creator { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }

.event-delete {
  background: rgba(255, 69, 58, 0.1);
  border: 1px solid rgba(255, 69, 58, 0.2);
  color: var(--ios-red);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.event-delete:active { background: rgba(255, 69, 58, 0.25); transform: scale(0.9); }

/* ===================================================
   SHOPPING LIST
   =================================================== */
.add-item-card {
  margin-bottom: 12px;
  padding: 12px 14px;
}

.add-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }

.pill-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
}

.pill-btn.active {
  background: linear-gradient(180deg, #0A84FF 0%, #0066CC 100%);
  border-color: rgba(255, 255, 255, 0.25);
  color: white;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.35);
}

.shopping-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shopping-item {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity var(--transition-base), transform var(--transition-base);
  animation: slideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.shopping-item.checked {
  opacity: 0.45;
  background: rgba(255, 255, 255, 0.02);
}

.shopping-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  transition: all var(--transition-fast);
}

.shopping-checkbox.checked-box {
  background: var(--ios-green);
  border-color: var(--ios-green);
  box-shadow: 0 0 10px rgba(48, 209, 88, 0.4);
}

.shopping-item-info { flex: 1; min-width: 0; }
.shopping-item-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.shopping-item-name {
  font-size: 15px;
  font-weight: 500;
  word-break: break-word;
}
.shopping-item.checked .shopping-item-name { text-decoration: line-through; color: var(--text-secondary); }

.shopping-cat-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.shopping-item-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.shopping-item-delete {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-tertiary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.shopping-item-delete:active {
  color: var(--ios-red);
  background: rgba(255, 69, 58, 0.15);
  border-color: rgba(255, 69, 58, 0.3);
  transform: scale(0.92);
}

/* ===================================================
   MOVIES
   =================================================== */
.search-card {
  margin-bottom: 16px;
  padding: 12px 14px;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.movies-filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.movies-filter-row::-webkit-scrollbar { display: none; }

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

@media (min-width: 500px) {
  .movies-grid { grid-template-columns: repeat(4, 1fr); }
}

.movie-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.movie-card:active { transform: scale(0.96); }

.movie-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.05);
}

.movie-poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.movie-card-info {
  padding: 8px;
}

.movie-card-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.movie-card-year {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.movie-status-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 10, 14, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  padding: 3px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.movie-status-badge.status-wanted { color: var(--ios-orange); }
.movie-status-badge.status-downloading { color: var(--ios-blue); }
.movie-status-badge.status-downloaded { color: var(--ios-green); }
.movie-status-badge.status-watched { color: var(--text-secondary); }

.movie-add-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(180deg, #0A84FF 0%, #0066CC 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: white;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-fast);
}

.movie-add-btn:active { transform: scale(0.9); }
.movie-add-btn.added { background: linear-gradient(180deg, #30D158 0%, #249A42 100%); }

/* ===================================================
   CHAT
   =================================================== */
.online-bar {
  display: flex;
  gap: 14px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(18, 18, 24, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: 64px;
  align-items: center;
  scrollbar-width: none;
  flex-shrink: 0;
}
.online-bar::-webkit-scrollbar { display: none; }

.online-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.online-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  overflow: visible;
}

.online-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.online-avatar .default-avatar-svg {
  width: 22px;
  height: 22px;
  color: var(--text-tertiary);
}

.online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 11px;
  height: 11px;
  background: var(--ios-green);
  border-radius: 50%;
  border: 2px solid #121218;
  box-shadow: 0 0 6px rgba(48, 209, 88, 0.6);
}

.online-user-name {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 44px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

.message-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.message-group.own { align-items: flex-end; }
.message-group.other { align-items: flex-start; }

.message-sender-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  padding: 0 4px;
}

.message-sender-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.message-sender-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-sender-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.message-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.message-bubble:active { opacity: 0.85; transform: scale(0.99); }

.message-group.own .message-bubble {
  background: linear-gradient(180deg, #0A84FF 0%, #0066CC 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.25);
}

.message-group.other .message-bubble {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 0 6px;
}

.message-group.own .message-meta {
  justify-content: flex-end;
}

.message-group.other .message-meta {
  justify-content: flex-start;
}

.message-time {
  font-size: 10px;
  color: var(--text-tertiary);
}

.message-status {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: -0.1px;
}

.message-status.hidden {
  display: none !important;
}

.message-status.visible {
  display: inline-block;
  animation: fadeInStatus 0.3s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes fadeInStatus {
  from { opacity: 0; transform: translateY(2px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.message-reply-preview {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 4px;
  max-width: 78%;
  border-left: 2px solid rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.message-group.other .message-reply-preview {
  border-left-color: var(--ios-blue);
  background: rgba(10, 132, 255, 0.1);
}

.reply-name { font-size: 11px; font-weight: 600; color: var(--ios-blue); display: block; margin-bottom: 1px; }
.reply-text { font-size: 11px; color: var(--text-secondary); }

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  padding: 0 4px;
}

.reaction-chip {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.reaction-chip:active { background: rgba(10, 132, 255, 0.25); transform: scale(0.95); }
.reaction-chip .count { font-size: 10px; color: var(--text-secondary); font-weight: 600; }

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.typing-bubble {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

.reply-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(20, 20, 26, 0.85);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.reply-preview .reply-content { flex: 1; }
.reply-label { font-size: 11px; font-weight: 600; color: var(--ios-blue); display: block; }
#reply-text { font-size: 12px; color: var(--text-secondary); }

.reply-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 16px;
  padding-bottom: calc(76px + max(env(safe-area-inset-bottom, 12px), 12px));
  border-top: 1px solid var(--glass-border);
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  flex-shrink: 0;
  background: rgba(12, 12, 16, 0.75);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.chat-textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  padding: 9px 16px;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.4;
  -webkit-appearance: none;
  transition: border-color var(--transition-fast);
}

.chat-textarea:focus {
  border-color: var(--ios-blue);
  background: rgba(10, 132, 255, 0.05);
}

.chat-textarea::placeholder { color: var(--text-tertiary); }

.send-btn {
  background: linear-gradient(180deg, #0A84FF 0%, #0066CC 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: white;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(10, 132, 255, 0.35);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  margin-bottom: 2px;
}

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

/* Chat Input Tools & Actions */
.chat-input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.chat-action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ios-blue);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.chat-action-btn:active {
  background: rgba(10, 132, 255, 0.25);
  transform: scale(0.92);
}

.chat-action-btn.active {
  background: var(--ios-blue);
  color: white;
  border-color: transparent;
}

.chat-action-btn.uploading {
  opacity: 0.6;
  pointer-events: none;
  animation: pulseBtn 1s infinite alternate;
}

@keyframes pulseBtn {
  from { transform: scale(0.95); opacity: 0.5; }
  to { transform: scale(1.05); opacity: 0.9; }
}

.chat-gif-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.2px;
  padding: 1.5px 5px;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  line-height: 1;
  text-transform: uppercase;
}

/* GIF Picker Drawer */
.gif-picker-drawer {
  background: rgba(16, 16, 22, 0.95);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-top: 1px solid var(--glass-border);
  border-radius: 20px 20px 0 0;
  max-height: 360px;
  height: min(360px, 46vh);
  min-height: 240px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  animation: slideUpGif 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

.gif-picker-drawer.hidden {
  display: none !important;
}

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

.gif-picker-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
  flex-shrink: 0;
}

.gif-search-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.gif-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.gif-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 32px 8px 34px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.gif-search-input:focus {
  border-color: var(--ios-blue);
  background: rgba(255, 255, 255, 0.12);
}

.gif-search-clear {
  position: absolute;
  right: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.gif-picker-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.gif-picker-close-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.92);
}

.gif-category-tags {
  display: flex;
  gap: 8px;
  padding: 4px 14px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.gif-category-tags::-webkit-scrollbar {
  display: none;
}

.gif-tag-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.gif-tag-pill:active {
  transform: scale(0.94);
}

.gif-tag-pill.active {
  background: var(--ios-blue);
  color: white;
  border-color: transparent;
  font-weight: 600;
}

.gif-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 115px;
  gap: 8px;
  padding: 6px 14px 20px;
  -webkit-overflow-scrolling: touch;
}

.gif-item {
  position: relative;
  width: 100%;
  height: 115px;
  min-width: 0;
  min-height: 115px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  display: block;
  box-sizing: border-box;
  transition: transform var(--transition-fast);
}

.gif-item:active {
  transform: scale(0.96);
}

.gif-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}

.gif-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px 10px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* Chat Media Bubbles (Photos & GIFs) */
.message-bubble.media-bubble {
  padding: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
  overflow: hidden;
}

.message-bubble.media-bubble:active {
  opacity: 0.9;
}

.chat-media-img {
  max-width: 250px;
  max-height: 320px;
  border-radius: 18px;
  display: block;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.message-group.own .chat-media-img {
  border-bottom-right-radius: 4px;
}

.message-group.other .chat-media-img {
  border-bottom-left-radius: 4px;
}

.chat-gif-img {
  max-width: 240px;
  max-height: 280px;
  border-radius: 18px;
  display: block;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.message-group.own .chat-gif-img {
  border-bottom-right-radius: 4px;
}

.message-group.other .chat-gif-img {
  border-bottom-left-radius: 4px;
}

/* Fullscreen Photo Lightbox */
.chat-photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 20px;
  animation: fadeInModal 0.2s ease;
}

.chat-photo-lightbox.hidden {
  display: none !important;
}

.chat-photo-lightbox img {
  max-width: 95vw;
  max-height: 85vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
}

.lightbox-close-btn {
  position: absolute;
  top: max(env(safe-area-inset-top, 24px), 24px);
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.lightbox-close-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.92);
}

/* ===================================================
   TAB BAR (Apple App Store / visionOS Floating Island Dock)
   =================================================== */
.tab-bar {
  position: absolute;
  bottom: max(env(safe-area-inset-bottom, 12px), 12px);
  left: 12px;
  right: 12px;
  margin: 0 auto;
  width: calc(100% - 24px);
  max-width: 420px;
  height: 64px;
  background: rgba(26, 26, 32, 0.82);
  backdrop-filter: blur(40px) saturate(210%);
  -webkit-backdrop-filter: blur(40px) saturate(210%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 5px 6px;
  box-sizing: border-box;
  z-index: 1000;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9999px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 12px;
  height: 52px;
  flex: 1;
  max-width: 92px;
  transition: all 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
  position: relative;
}

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

/* Inactive icons: crisp bright silver/white like App Store */
.tab-btn .tab-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.95);
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1), color 0.22s ease;
}

/* Active Tab: Signature Apple App Store Frosted Capsule Pill */
.tab-btn.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tab-btn.active .tab-icon {
  color: var(--ios-blue);
  transform: scale(1.04);
  filter: drop-shadow(0 0 6px rgba(10, 132, 255, 0.55));
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.1px;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.tab-btn.active .tab-label {
  color: var(--ios-blue);
  font-weight: 700;
}

.tab-badge {
  position: absolute;
  top: 2px;
  right: 14px;
  background: var(--ios-red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #1a1a20;
  box-shadow: 0 2px 6px rgba(255, 69, 58, 0.6);
}

/* ===================================================
   MODALS (Apple Glass Sheet)
   =================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  padding-bottom: max(16px, var(--safe-bottom));
  animation: fadeIn 0.2s ease;
}

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

.modal {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: rgba(24, 24, 30, 0.85);
  backdrop-filter: blur(35px) saturate(200%);
  -webkit-backdrop-filter: blur(35px) saturate(200%);
  border: 1px solid var(--glass-border-light);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-shrink: 0;
  position: relative;
}

/* Apple drag handle bar at modal top */
.modal-header::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.modal-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:active {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(0.92);
}

.modal-body {
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-shrink: 0;
}

.modal-footer button { flex: 1; }

/* ===================================================
   COLOR PICKER
   =================================================== */
.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.color-dot.active {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px #121218, 0 0 0 5px white;
}

/* ===================================================
   TOGGLE SWITCH (iOS Native Glass)
   =================================================== */
.ios-toggle {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
}

.ios-toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 31px;
  transition: background var(--transition-base);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 27px;
  height: 27px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.ios-toggle input:checked + .toggle-slider {
  background: var(--ios-green);
}

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

/* ===================================================
   AVATAR PHOTO UPLOAD (Apple Glass Style)
   =================================================== */
.avatar-upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.avatar-upload-preview {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

.avatar-upload-preview:hover {
  border-color: var(--ios-blue);
  transform: scale(1.02);
}

.avatar-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  border-radius: 50%;
}

.avatar-preview-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: white;
  border-radius: 50%;
}

.avatar-upload-overlay span:last-child {
  font-size: 11px;
  font-weight: 600;
}

.avatar-upload-preview:hover .avatar-upload-overlay,
.avatar-upload-preview:active .avatar-upload-overlay {
  opacity: 1;
}

.avatar-upload-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-upload-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ===================================================
   EMPTY STATE (Apple Refined Minimal)
   =================================================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-icon-svg {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.empty-state p {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state span {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ===================================================
   TOAST NOTIFICATION (Apple Island / Capsule)
   =================================================== */
.toast {
  position: fixed;
  top: max(54px, calc(var(--safe-top) + 20px));
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(24, 24, 30, 0.88);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: calc(100vw - 40px);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: rgba(48, 209, 88, 0.4); }
.toast.error { border-color: rgba(255, 69, 58, 0.4); }

/* ===================================================
   DIVIDER
   =================================================== */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: 20px 0;
}

/* ===================================================
   MOVIE DETAIL
   =================================================== */
.movie-detail-backdrop {
  width: calc(100% + 40px);
  margin: -20px -20px 16px;
  height: 180px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.movie-detail-header {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}

.movie-detail-poster {
  width: 80px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.movie-detail-info h4 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.movie-detail-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.movie-rating {
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-yellow);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.movie-overview {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.movie-status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-badge {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
}

.status-wanted { background: rgba(255, 159, 10, 0.15); border: 1px solid rgba(255, 159, 10, 0.3); color: var(--ios-orange); }
.status-downloading { background: rgba(10, 132, 255, 0.15); border: 1px solid rgba(10, 132, 255, 0.3); color: var(--ios-blue); }
.status-downloaded { background: rgba(48, 209, 88, 0.15); border: 1px solid rgba(48, 209, 88, 0.3); color: var(--ios-green); }
.status-watched { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); color: var(--text-secondary); }

/* ===================================================
   SCROLLBAR (Desktop only)
   =================================================== */
@media (min-width: 768px) {
  ::-webkit-scrollbar { width: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (min-width: 768px) {
  .login-container { padding: 40px; }
  .modal { align-items: center; }
  .modal-overlay { align-items: center; }
  .movies-grid { grid-template-columns: repeat(4, 1fr); }
}
