/* GLOBAL LAYOUT */

body {
  background-color: #111;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  overflow: hidden; /* no scroll */
  font-family: Arial, sans-serif;
}

/* PHONE SHELL */

.phone {
  position: relative;
  width: 360px;
  height: 100vh;             /* fill viewport height */
  max-height: 800px;          /* keeps proportions on big screens */
  border: 8px solid #222;
  border-radius: 40px;
  background-color: #000;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 30px;
  background-color: #111;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
  z-index: 10;
}

.home-button {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background-color: #111;
  border-radius: 50%;
  box-shadow: inset 0 0 10px #000;
  z-index: 5;
}

/* SCREEN AREA */

.screen {
  position: absolute;
  top: 30px;
  left: 0;
  width: 100%;
  height: calc(100% - 80px); /* leave space for notch & home button */
  background-color: #000;
  color: #fff;
  overflow: hidden;
}

/* BOOT / GLITCH / SYSTEM TEXT */

.boot-screen,
.lock-screen,
.home-screen,
.app-screen {
  width: 100%;
  height: 100%;
}

.boot-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: #0fdaff;
  text-align: center;
}

.boot-glitch {
  animation: glitch 0.25s infinite;
  font-size: 16px;
  opacity: 0.8;
}

@keyframes glitch {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, -1px); }
  60% { transform: translate(-1px, 0); }
  80% { transform: translate(1px, 1px); }
  100% { transform: translate(0, 0); }
}

.boot-hint {
  margin-top: 16px;
  font-size: 15px;
  opacity: 0.6;
}

/* LOCK SCREEN */

.lock-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 16px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.02), transparent 70%),
    #000;
}

.lock-time {
  font-size: 44px;
  font-weight: 300;
}

.lock-date {
  font-size: 16px;
  opacity: 0.7;
  margin-bottom: 8px;
}

.lock-notifications {
  font-size: 15px;
  opacity: 0.85;
  margin-top: 16px;
}

.lock-notification {
  padding: 4px 6px;
  margin-bottom: 4px;
  border-left: 2px solid #444;
}

.lock-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.lock-hint {
  font-size: 14px;
  opacity: 0.6;
}

.pin-display {
  letter-spacing: 6px;
  font-size: 26px;
  margin: 4px 0;
}

.pin-dots span {
  display: inline-block;
  width: 10px;
  text-align: center;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}

.pin-key {
  padding: 8px 0;
  text-align: center;
  border-radius: 8px;
  background-color: #111;
  border: 1px solid #222;
  font-size: 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, transform 0.05s;
}

.pin-key:active {
  background-color: #222;
  transform: scale(0.97);
}

.pin-error {
  font-size: 13px;
  color: #ff4c4c;
  min-height: 12px;
}

/* shake anim for wrong PIN */
.shake {
  animation: shakeAnim 0.2s;
}
@keyframes shakeAnim {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* HOME SCREEN SA WALLPAPER-om */

.home-screen {
  position: relative;
  background: url("../img/wallpaper_lena.png") no-repeat center center;
  background-size: cover;
  overflow: hidden;
}

/* Tamni overlay koji se fade-in/fade-out animira kad se otključa telefon */
.home-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 1);      /* kreće skroz tamno */
  z-index: 0;
  animation: overlayFadeIn 0.8s ease-out forwards;
}

/* Ikonice i status bar iznad overlay-a */
.app-grid,
.status-bar,
#unknown-banner {
  position: relative;
  z-index: 1;
}

@keyframes overlayFadeIn {
  from { opacity: 1; }
  to   { opacity: 0.4; }  /* ostane blago zatamljeno da se sve lepo vidi */
}


.status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 8px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.app-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #222, #000);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.app-label {
  margin-top: 4px;
  opacity: 0.8;
}

/* fake notification bubble */
.unknown-message-banner {
  margin-top: 12px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.02);
  border-left: 2px solid #ff0044;
  font-size: 13px;
  opacity: 0.9;
}

/* APP SCREENS */

.app-screen {
  padding: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin-bottom: 4px;
}

.app-title {
  font-weight: bold;
}

.app-back {
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
}

.app-content {
  font-size: 14px;
  line-height: 1.4;
  overflow-y: auto;
}

/* simple log style for Messages, Calls */
.message-row,
.call-row,
.note-row {
  margin-bottom: 4px;
}

.message-from {
  font-weight: bold;
  font-size: 14px;
}

.message-text {
  font-size: 14px;
  opacity: 0.9;
}

/* Chapter 1 completion banner */

.chapter-banner {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid #444;
  opacity: 0;
  animation: bannerFade 2s forwards;
}

@keyframes bannerFade {
  0% { opacity: 0; transform: translate(-50%, 4px); }
  20% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 4px); }
}

.gallery-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery-item {
  background: #050505;
  border-radius: 8px;
  padding: 6px;
  border: 1px solid #222;
}

.gallery-img {
  width: 100%;
  border-radius: 6px;
  display: block;
  object-fit: cover;
}

.gallery-caption {
  margin-top: 4px;
  font-size: 12px;
  color: #ddd;
  opacity: 0.9;
}

.gallery-hint {
  margin-top: 4px;
  font-size: 10px;
  color: #888;
  font-style: italic;
}

/* Glitch / shake efekat za ekran */
.screen-glitch {
  animation: screenGlitch 0.18s linear 0s 1;
}

@keyframes screenGlitch {
  0%   { transform: translate(0, 0); filter: none; }
  25%  { transform: translate(-2px, 1px); filter: contrast(1.4) brightness(0.9); }
  50%  { transform: translate(2px, -1px); filter: hue-rotate(10deg); }
  75%  { transform: translate(-1px, 2px); filter: contrast(1.6) brightness(0.8); }
  100% { transform: translate(0, 0); filter: none; }
}

/* Blink efekat preko bannera poruke */
.unknown-message-banner {
  margin-top: 12px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.8);
  border-left: 2px solid #ff0044;
  font-size: 14px;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.25s ease-out;
}

.unknown-message-banner.show {
  opacity: 1;
  transform: translateY(0);
}

.audio-entry {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #222;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
}

.audio-entry strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

audio {
  width: 100%;
  outline: none;
  border-radius: 4px;
}

.audio-note {
  font-size: 14px;
  color: #bbb;
  margin-top: 4px;
  font-style: italic;
}

/* Poruke */
.messages-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

.message-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 17px;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
}

.message-bubble::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
}

.message-sent {
  align-self: flex-end;
  background: #007aff;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-sent::after {
  right: -5px;
  border-left: 6px solid #007aff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.message-received {
  align-self: flex-start;
  background: #2f2f2f;
  color: #fff;
  border-bottom-left-radius: 4px;
}

.message-received::after {
  left: -5px;
  border-right: 6px solid #2f2f2f;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.message-time {
  font-size: 14px;
  color: #aaa;
  margin-top: 2px;
  text-align: right;
}

/* Typing indicator bubble */

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.9;
}

.typing-dot {
  width: 5px;
  height: 5px;
  background-color: #ddd;
  border-radius: 50%;
  animation: typingBlink 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBlink {
  0% { opacity: 0.2; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-1px); }
  60% { opacity: 0.6; transform: translateY(0); }
  100% { opacity: 0.2; }
}

/* NOTES APP */

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 2px 10px;
}

.note-card {
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid #222;
  cursor: default;
}

.note-title {
  font-size: 17px;
  font-weight: 600;
  color: #f5f5f5;
  margin-bottom: 2px;
}

.note-meta {
  font-size: 13px;
  color: #777;
  margin-bottom: 4px;
}

.note-body {
  font-size: 15px;
  color: #ddd;
  line-height: 1.5;
}

.note-hint {
  font-size: 14px;
  color: #ffda6b;
  margin-top: 4px;
  font-style: italic;
}

.note-faded {
  opacity: 0.55;
  font-style: italic;
}

/* CALLS APP */

.calls-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 10px;
}

.call-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #181818;
  font-size: 15px;
}

.call-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
}

.call-icon.missed {
  background-color: #c0392b; /* crveno */
}

.call-icon.incoming {
  background-color: #27ae60; /* zeleno */
}

.call-icon.outgoing {
  background-color: #2980b9; /* plavo */
}

.call-main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.call-name {
  font-weight: 600;
  color: #f5f5f5;
}

.call-label {
  font-size: 13px;
  color: #999;
}

.call-time {
  font-size: 13px;
  color: #777;
  text-align: right;
  min-width: 60px;
}

/* ECHO folder */
.echo-locked {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #333;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.echo-locked:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #888;
  transform: scale(1.02);
}

.echo-locked::before {
  content: "📁 ";
  opacity: 0.8;
}

.echo-unlocked::before {
  content: "🎥 ";
  opacity: 0.8;
}

.video-frame {
  background: #000;
  border-radius: 8px;
  border: 1px solid #333;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.video-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  position: absolute;
  transition: opacity 0.6s ease-in-out;
}

.video-frame img.show {
  opacity: 1;
}

.video-caption {
  font-size: 13px;
  line-height: 1.6;
  color: #eee;
  min-height: 90px;
  margin-top: 10px;
  transition: opacity 0.6s ease;
}

.video-caption.fade {
  opacity: 0;
}

.home-corrupted .home-overlay {
  background: rgba(0, 0, 0, 0.55);
}

.home-corrupted .app-icon {
  animation: iconGlitch 2.4s infinite steps(2, end);
}

@keyframes iconGlitch {
  0%, 90% { transform: none; opacity: 1; }
  92% { transform: translateX(-1px); opacity: 0.85; }
  95% { transform: translateX(2px); opacity: 1; }
  98% { transform: translateX(-2px); opacity: 0.7; }
}

.ending-screen .app-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
}

.ending-illustration-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;     /* puni portret prostor */
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #222;
  background: #000;
}

.ending-illustration {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: endingFadeIn 400ms ease-out forwards;
  opacity: 0;
}

.ending-caption {
  text-align: center;
  font-size: 12px;
  opacity: .8;
}

.ending-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}

.btn-ghost {
  padding: 8px 14px;
  background: #1a1a1a;
  color: #bbb;
  border: 1px solid #333;
  border-radius: 8px;
}

.btn-solid {
  padding: 8px 14px;
  background: #0f0f0f;
  color: #0fdaff;
  border: 1px solid #144;
  border-radius: 8px;
}

.ending-glitch {
  pointer-events: none;
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(180deg, rgba(0,255,128,0.02) 0 2px, transparent 2px 4px);
  animation: scanline 3.2s linear infinite;
}

.ending-fade {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.35) 85%);
}

@keyframes endingFadeIn {
  to { opacity: 1; }
}

@keyframes scanline {
  from { transform: translateY(-100%); }
  to   { transform: translateY(100%); }
}

body {
  transition: background-image 1.5s ease-in-out;
}

.home-screen {
  position: relative;
  overflow: hidden;
}

.home-overlay {
  position: absolute;
  inset: 0;
  background-image: url('../img/wallpaper_lena.png'); /* tvoj default */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: .35;             /* koliko jako da se vidi pozadina */
  pointer-events: none;      /* da ne blokira klikove na ikone */
}

/* Chapter 3 wallpaper */
.home-corrupted .home-overlay {
  background-image: url('../img/chapter3_wallpaper.png');
  opacity: 0.45;
}

.home-screen { position: relative; overflow: hidden; }

.home-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* (ostaješ pri inline background-image iz JS-a, ovo je samo layout) */





