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

body {
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at center, #2a2a35 0%, #0d0d12 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  color: #fff;
}

/* Device Wrapper for realistic look */
.device-wrapper {
  position: relative;
  border-radius: 50px;
  padding: 12px;
  background: #222;
  box-shadow: inset 0 0 4px rgba(255,255,255,0.2), 
              0 20px 50px rgba(0,0,0,0.8),
              0 0 0 2px #444;
}

/* Phone Frame */
.phone-frame {
  width: 375px;
  height: 812px;
  background-color: #000;
  background-image: url('assets/wall.jpeg');
  background-size: cover;
  background-position: center;
  border-radius: 40px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Hardware Notch / Island (Visual Only) */
.phone-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 30px;
  background: #000;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  z-index: 2000;
}

/* Status Bar */
.status-bar {
  height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  position: absolute;
  width: 100%;
}

.status-icons {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-right: -10px;
}

.battery-icon { margin-left: 2px; }

/* Screen Content Area */
.screen {
  flex: 1;
  position: relative;
  overflow: hidden;
  z-index: 10;
}

/* App Containers */
.app {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  transform: scale(0.95) translateY(20px);
}

.app.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1) translateY(0);
}

/* Sub App Generic Structure (Apps that cover wallpaper) */
.sub-app {
  background: #000;
  z-index: 15;
}

/* Home Screen Grid */
.home-grid {
  padding: 60px 20px 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 10px;
  align-content: start;
}

.app-icon {
  background: none;
  border: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s;
}

.app-icon:active { transform: scale(0.9); }

.icon-bg {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* App App-specific icons gradients */
.phone    { background: linear-gradient(135deg, #30d158, #28a745); }
.messages { background: linear-gradient(135deg, #0ceb50, #0abe40); }
.viber    { background: linear-gradient(135deg, #8f5db7, #7360f2); }
.instagram{ background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.photos   { background: linear-gradient(135deg, #ff2a5f, #ff7b00, #ffb627, #37e6b0, #2b6bf3); }
.camera   { background: linear-gradient(135deg, #a0a0a0, #666666); }
.bank     { background: linear-gradient(135deg, #6a11cb, #2575fc); }
.nav      { background: linear-gradient(135deg, #11998e, #38ef7d); }
.email    { background: linear-gradient(135deg, #007aff, #5ac8fa); }
.files    { background: linear-gradient(135deg, #FFaa00, #ffcc00); }
.browser  { background: linear-gradient(135deg, #f0f0f0, #e0e0e0); color: #000; }
.browser i{ color: #0a84ff; }
.weather  { background: linear-gradient(135deg, #5ac8fa, #007aff); }
.settings { background: linear-gradient(135deg, #555, #333); }
.notes    { background: linear-gradient(135deg, #ffcc00, #ff9500); color: #fff;}
.calendar { background: #fff; color: #ff3b30; }

.app-icon span {
  font-size: 11px;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* App Headers */
.app-header {
  height: 80px;
  padding: 36px 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(20,20,20,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 50;
}
.glass-header { 
  background: rgba(0,0,0,0.4); 
  border-bottom: none;
}
.back-btn {
  background: none;
  border: none;
  color: #0a84ff;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.header-action { font-size: 20px; color: #0a84ff; cursor: pointer; }
.text-action { font-size: 15px; font-weight: 500;}

/* Home Indicator */
.home-indicator-container {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  background: linear-gradient(transparent, rgba(0,0,0,0.6) 80%);
}
.home-indicator {
  width: 130px;
  height: 5px;
  background: #fff;
  border-radius: 100px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.8);
  cursor: pointer;
}

/* =========================================
   MESSAGES APP 
   ========================================= */
.chat-list-item {
  display: flex;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  align-items: center;
}
.chat-list-item:active { background: rgba(255,255,255,0.05); }
.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  color: #fff;
}
.chat-info { flex: 1; }
.chat-name { font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; margin-bottom: 4px;}
.chat-time { font-size: 12px; color: #888; font-weight: 400;}
.chat-preview { font-size: 14px; color: #aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;}

.chat-area {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #000;
}
.chat-date { text-align: center; font-size: 11px; color: #888; margin-bottom: 16px; margin-top: 16px;}
.bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
}
.bubble.left {
  background: #2c2c2e;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bubble.right {
  background: #0a84ff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-input-area {
  min-height: 50px;
  padding: 10px 16px 30px;
  background: rgba(30,30,30,0.85);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.chat-input-area i { font-size: 22px; color: #888; }
.msg-input {
  flex: 1;
  background: #000;
  border: 1px solid #333;
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 15px;
  outline: none;
}

/* =========================================
   PHOTOS APP 
   ========================================= */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 40px;
}
.gallery-item {
  width: 100%;
  aspect-ratio: 4/5;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}
.gallery-item:active { opacity: 0.7; }

/* =========================================
   CAMERA APP 
   ========================================= */
.camera-app { background: #000; justify-content: space-between; }
.camera-header {
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  color: #fff;
  font-size: 24px;
  z-index: 10;
}
.camera-modes {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 15px 0;
  font-size: 12px;
  color: #fff;
  font-weight: 500;
  background: #000;
}
.camera-modes .active { color: #fed000; }
.shutter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px 40px;
  background: #000;
}
.shutter-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px;
  cursor: pointer;
}
.shutter-inner {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 50%;
}
.shutter-btn:active .shutter-inner { transform: scale(0.85); transition: 0.1s; }
.cam-preview {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  overflow: hidden;
}
.cam-preview img { width: 100%; height: 100%; object-fit: cover;}
.cam-back { color: #fff; font-size: 24px; background: rgba(255,255,255,0.1); width:44px; height:44px; border-radius: 50%; display:flex; justify-content:center; }

.toast {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #30d158;
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 4px 15px rgba(48,209,88,0.4);
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =========================================
   LOCK SCREEN
   ========================================= */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  background: transparent;
  transition: opacity 0.5s;
}
.lock-blur {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 201;
}

.lock-container {
  z-index: 202;
  text-align: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lock-icon { font-size: 32px; margin-bottom: 12px; }
.lock-container h2 { font-weight: 600; font-size: 22px; text-shadow: 0 1px 4px rgba(0,0,0,0.5);}
.subtitle { font-size: 14px; color: #ddd; margin-bottom: 24px; text-shadow: 0 1px 2px rgba(0,0,0,0.5);}

.input-wrapper {
  display: flex; gap: 8px; align-items: center;
}
#password-input {
  padding: 12px 16px;
  width: 200px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  font-size: 16px;
  text-align: center;
  outline: none;
}
#password-input:focus { border-color: rgba(255,255,255,0.6); }
#password-input::placeholder { color: #aaa; }

#unlock-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  display: flex; justify-content:center; align-items:center;
  transition: background 0.2s;
}
#unlock-btn:hover { background: rgba(255,255,255,0.4); }

.error { color: #ff453a; margin-top: 12px; font-weight: 500; font-size: 14px; min-height: 20px;}

/* =========================================
   NAVIGATION APP 
   ========================================= */
.route-list li {
  cursor: pointer;
  transition: background 0.2s;
  padding: 8px 12px;
  border-radius: 12px;
}
.route-list li:hover {
  background: rgba(255,255,255,0.08);
}

/* =========================================
   EMAIL APP 
   ========================================= */
.email-list-item {
  display: flex;
  padding: 16px;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  align-items: flex-start;
}
.email-list-item:active { background: rgba(255,255,255,0.05); }
.email-avatar-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: #fff;
  font-weight: bold;
}
.email-info { flex: 1; overflow: hidden; }
.email-header { display: flex; justify-content: space-between; margin-bottom: 2px; align-items: baseline; }
.email-sender { font-weight: 600; font-size: 15px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-time { font-size: 12px; color: #888; white-space: nowrap; margin-left:8px; }
.email-subj { font-weight: 600; font-size: 14px; color: #ddd; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-snippet { font-size: 14px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-unread .email-sender, .email-unread .email-subj { color: #0a84ff; }
.email-unread .email-avatar-sm { box-shadow: 0 0 0 2px #0a84ff; }

/* Animations */
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-6px); }
  100% { transform: translateX(0); }
}
.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }

/* =========================================
   TIMELINE VIEW (NAV APP)
   ========================================= */
.timeline-line {
  position: absolute; left: 36px; top: 0px; bottom: 0; width: 2px; background: #e0e0e0; z-index: 0;
}
.timeline-item {
  display: flex; gap: 16px; position: relative; z-index: 1; margin-bottom: 24px;
}
.timeline-icon {
  width: 42px; height: 42px; border-radius: 50%; display: flex; justify-content: center; align-items: center; background: #fff; border: 2px solid transparent; flex-shrink: 0; z-index: 2; box-shadow: 0 0 0 4px #fff;
}
.visit-icon { background: #6b868e; }
.visit-icon .inner-dot { width: 12px; height: 12px; background: #fff; border-radius: 50%; }
.move-icon { border-color: #5f6368; box-sizing: border-box; }
.missing-icon { background: #d93025; }
.timeline-details { flex: 1; padding-top: 4px; }
.timeline-title-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.timeline-title { font-size: 16px; font-weight: 600; color: #202124; white-space: normal; word-wrap: break-word; line-height: 1.3; }
.timeline-subtitle { font-size: 13px; color: #5f6368; margin-bottom: 4px; line-height: 1.4; padding-right: 20px;}
.timeline-time { font-size: 13px; color: #5f6368; margin-bottom: 12px; }
.timeline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btn { border: none; border-radius: 20px; padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; color: #fff; transition: 0.2s; }
.action-btn:active { opacity: 0.8; transform: scale(0.95); }
.yes-btn, .add-btn, .edit-btn { background: #007b83; }
.fab-btn { position: absolute; bottom: 24px; right: 24px; width: 56px; height: 56px; border-radius: 50%; background: #fff; border: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; justify-content: center; align-items: center; font-size: 24px; color: #007b83; cursor: pointer; z-index: 10; transition: 0.2s; }
.fab-btn:active { transform: scale(0.9); }

/* =========================================
   UX ENHANCEMENTS (Glitch, Notifications, Audio)
   ========================================= */

/* Glitch Effect */
@keyframes glitch-anim {
  0% { transform: translate(0) }
  20% { transform: translate(-2px, 2px) }
  40% { transform: translate(-2px, -2px) }
  60% { transform: translate(2px, 2px) }
  80% { transform: translate(2px, -2px) }
  100% { transform: translate(0) }
}
.glitch-effect {
  animation: glitch-anim 0.2s infinite;
  filter: hue-rotate(90deg) contrast(150%);
}

/* Push Notifications */
.ios-notification {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 9999;
  transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: #fff;
  pointer-events: none;
}
.ios-notification.show { top: 50px; }
.notif-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; justify-content: center; align-items: center; font-size: 20px; color: #fff;}
.notif-content { flex: 1; overflow: hidden; }
.notif-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.notif-body { font-size: 13px; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Phone Calls History */
.call-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.call-item.missed .call-name { color: #ff3b30; }
.call-info { flex: 1; }
.call-name { font-size: 16px; font-weight: 500; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.call-type { font-size: 13px; color: #888; }
.call-time { font-size: 13px; color: #888; }

/* Calendar */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 20px;}
.cal-day-header { text-align: center; font-size: 11px; color: #888; margin-bottom: 8px;}
.cal-day { padding: 10px 0; text-align: center; font-size: 16px; border-radius: 50%; position: relative; cursor: pointer; }
.cal-day.has-event::after { content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: #ff3b30; }
.cal-day.active { background: #ff3b30; color: #fff; font-weight: bold; }

/* Fake Audio Player Bubble */
.audio-player-bubble { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.2); padding: 8px 12px; border-radius: 20px; margin-bottom: 6px; width: 200px;}
.audio-play-btn { width: 30px; height: 30px; border-radius: 50%; background: #0a84ff; display: flex; justify-content: center; align-items: center; color: #fff; font-size: 14px; cursor: pointer;}
.audio-waveform { flex: 1; height: 2px; background: #555; position: relative; }
.audio-waveform::before { content: ''; position: absolute; left: 0; top: -5px; width: 10px; height: 12px; background: #0a84ff; border-radius: 6px;}
.audio-duration { font-size: 11px; color: #888; }
.audio-transcript { font-size: 12px; font-style: italic; color: #888; margin-top: 4px; border-left: 2px solid #555; padding-left: 8px; }
