/* === ManitTV — Tatlı Tema === */

:root {
  --pink: #FF6B9D;
  --pink-light: #FF8FB1;
  --pink-dark: #E84575;
  --purple: #C44569;
  --bg-dark: #1A1A2E;
  --bg-card: #16213E;
  --bg-surface: #0F3460;
  --text-primary: #FFF5F5;
  --text-muted: #B8B8D0;
  --danger: #FF4757;
  --success: #2ED573;
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* === Screens === */
.screen {
  display: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}
.screen.active {
  display: flex;
}

/* === LOGIN === */
#login-screen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #16213E 50%, #1A1A2E 100%);
  position: relative;
  overflow: hidden;
}

.login-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

/* Floating hearts background */
.floating-hearts {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}
.heart {
  position: absolute;
  font-size: 24px;
  opacity: 0.15;
  animation: floatHeart 6s ease-in-out infinite;
}
.heart:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; font-size: 28px; }
.heart:nth-child(2) { left: 80%; top: 10%; animation-delay: 1s; font-size: 20px; }
.heart:nth-child(3) { left: 50%; top: 70%; animation-delay: 2s; font-size: 32px; }
.heart:nth-child(4) { left: 25%; top: 85%; animation-delay: 3s; font-size: 18px; }
.heart:nth-child(5) { left: 70%; top: 60%; animation-delay: 4s; font-size: 26px; }

@keyframes floatHeart {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.15; }
  25% { transform: translateY(-20px) rotate(10deg); opacity: 0.25; }
  50% { transform: translateY(-10px) rotate(-5deg); opacity: 0.2; }
  75% { transform: translateY(-25px) rotate(5deg); opacity: 0.3; }
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(255, 107, 157, 0.1);
  border: 1px solid rgba(255, 107, 157, 0.15);
}

.logo {
  text-align: center;
  margin-bottom: 30px;
}
.logo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 10px;
}
.logo h1 {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pink), var(--pink-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}
.input-group input {
  width: 100%;
  padding: 14px 18px 14px 48px;
  background: var(--bg-surface);
  border: 2px solid rgba(255, 107, 157, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s;
}
.input-group input:focus {
  border-color: var(--pink);
}
.input-group input::placeholder {
  color: var(--text-muted);
}
.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

/* === Buttons === */
.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.25s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white;
  font-size: 16px;
  border-radius: var(--radius-sm);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
  transform: translateY(-2px);
}
.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.error-msg {
  color: var(--danger);
  text-align: center;
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

/* === APP SCREEN === */
#app-screen {
  flex-direction: column;
  background: #000;
}

/* Status bar */
#status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid rgba(255, 107, 157, 0.15);
  z-index: 10;
  flex-shrink: 0;
}
.status-logo {
  font-weight: 700;
  font-size: 14px;
  color: var(--pink-light);
}
.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}
.status-badge.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}
.status-badge.connecting .status-dot {
  background: #FFA502;
  animation: pulse 1s infinite;
}
.status-badge.disconnected .status-dot {
  background: var(--text-muted);
}
.status-right {
  font-size: 14px;
  color: var(--text-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Video */
#video-container {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#remote-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  /* GPU hardware acceleration for smooth Android playback */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
#video-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 5;
  transition: opacity 0.3s;
}
#video-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
#waiting-msg {
  text-align: center;
}
#waiting-msg p {
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 12px;
}
.pulse-heart {
  font-size: 48px;
  animation: heartbeat 1.5s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
}

/* Controls */
#controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-top: 1px solid rgba(255, 107, 157, 0.15);
  flex-shrink: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.control-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-action {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.btn-action:hover {
  box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}
.btn-action.btn-danger {
  background: linear-gradient(135deg, var(--danger), #c0392b);
}

.btn-round {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid rgba(255, 107, 157, 0.2);
  font-size: 20px;
  transition: all 0.25s;
}
.btn-round:hover {
  border-color: var(--pink);
  background: rgba(255, 107, 157, 0.1);
}
.btn-round.active {
  background: var(--pink);
  border-color: var(--pink);
}
.btn-round.muted {
  background: var(--danger);
  border-color: var(--danger);
}

/* Reconnect overlay */
#reconnect-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.reconnect-content {
  text-align: center;
}
.reconnect-content p {
  color: var(--text-muted);
  margin-top: 12px;
  font-size: 16px;
}

/* === Fullscreen mode === */
#app-screen.fullscreen #status-bar,
#app-screen.fullscreen #controls {
  position: fixed;
  left: 0; right: 0;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.3s;
}
#app-screen.fullscreen #status-bar {
  top: 0;
}
#app-screen.fullscreen #controls {
  bottom: 0;
}
#app-screen.fullscreen:hover #status-bar,
#app-screen.fullscreen:hover #controls,
#app-screen.fullscreen.show-controls #status-bar,
#app-screen.fullscreen.show-controls #controls {
  opacity: 1;
}
#app-screen.fullscreen #video-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

/* === CSS-based mobile fullscreen (iOS fallback) === */
#app-screen.mobile-fullscreen {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 99999 !important;
  flex-direction: column !important;
  display: flex !important;
  background: #000 !important;
}
#app-screen.mobile-fullscreen #status-bar {
  display: none !important;
}
#app-screen.mobile-fullscreen #video-container {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 99999 !important;
}
#app-screen.mobile-fullscreen #remote-video {
  object-fit: contain;
  width: 100% !important;
  height: 100% !important;
  background: #000;
}
#app-screen.mobile-fullscreen #controls {
  position: fixed !important;
  bottom: 0 !important; left: 0 !important; right: 0 !important;
  z-index: 100000 !important;
  opacity: 0;
  transition: opacity 0.3s;
  background: linear-gradient(transparent, rgba(0,0,0,0.85)) !important;
  border-top: none !important;
  padding: 20px 12px calc(env(safe-area-inset-bottom, 0px) + 16px) !important;
}
#app-screen.mobile-fullscreen.show-controls #controls {
  opacity: 1 !important;
}
#app-screen.mobile-fullscreen #video-overlay {
  z-index: 99999 !important;
}

/* Video element fullscreen (iOS native) */
video::-webkit-media-controls-fullscreen-button {
  display: none;
}
#remote-video::backdrop {
  background: #000;
}
#remote-video:fullscreen {
  object-fit: contain;
  width: 100%;
  height: 100%;
}

/* === Mobile === */
@media (max-width: 600px) {
  .login-card {
    padding: 30px 20px;
  }
  .logo-icon {
    font-size: 40px;
  }
  .logo h1 {
    font-size: 26px;
  }
  #status-bar {
    padding: 8px 12px;
  }
  .status-logo {
    font-size: 12px;
  }
  #controls {
    padding: 10px 12px;
  }
  .btn-action {
    padding: 8px 14px;
    font-size: 13px;
  }
  .btn-round {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
  .btn-label {
    display: none;
  }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
  #status-bar {
    padding: 4px 12px;
  }
  #controls {
    padding: 6px 12px;
  }
  .btn-round {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}
