:root {
  --bg-primary: #090d16;
  --bg-secondary: #131b2e;
  --bg-card: #182238;
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 14px;
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: 'Roboto', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #0f0f0f;
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
}

/* ==================== 1. YouTube Disguised Login Screen ==================== */
#loginScreen.yt-home-screen {
  flex-direction: column;
  background: #0f0f0f;
  color: #f1f1f1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Master Top Navigation Bar */
.yt-header {
  height: 56px;
  padding: 0 16px;
  background: #0f0f0f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.yt-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 170px;
}

.yt-icon-btn {
  background: transparent;
  border: none;
  color: #f1f1f1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.yt-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.yt-logo-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.yt-play-icon {
  display: flex;
  align-items: center;
}

.yt-logo-text {
  font-family: 'Roboto', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  color: #ffffff;
}

.yt-country-code {
  font-size: 10px;
  color: #aaaaaa;
  font-weight: 500;
  margin-top: -10px;
  margin-left: 2px;
}

/* Mobile Action Icons (hidden on desktop) */
.yt-mobile-actions {
  display: none;
}

/* Search Bar (Center) */
.yt-header-center {
  flex: 1;
  max-width: 680px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 20px;
}

.yt-search-box {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 540px;
  height: 40px;
  background: #121212;
  border: 1px solid #303030;
  border-radius: 40px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s ease;
}

.yt-search-box:focus-within {
  border-color: #1c62b9;
}

#ytSearchInput {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 16px;
  color: #f1f1f1;
  font-size: 15px;
  font-family: inherit;
}

.yt-search-btn {
  width: 64px;
  height: 100%;
  background: #222222;
  border: none;
  border-left: 1px solid #303030;
  color: #f1f1f1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.yt-search-btn:hover {
  background: #2a2a2a;
}

.yt-mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #222222;
  border: none;
  color: #f1f1f1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.yt-mic-btn:hover {
  background: #2a2a2a;
}

/* Header Right: Stealth Login */
.yt-header-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.yt-header-login-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.yt-field-icon {
  position: absolute;
  left: 10px;
  color: #888888;
  pointer-events: none;
}

.yt-input-wrapper input {
  background: #181818;
  border: 1px solid #303030;
  border-radius: 20px;
  color: #f1f1f1;
  padding: 7px 12px 7px 30px;
  font-size: 13px;
  width: 125px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.yt-input-wrapper input:focus {
  border-color: #3ea6ff;
  width: 145px;
  background: #000000;
  box-shadow: 0 0 0 1px #3ea6ff;
}

.yt-login-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(62, 166, 255, 0.5);
  color: #3ea6ff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.yt-login-submit-btn:hover {
  background: rgba(62, 166, 255, 0.15);
  border-color: #3ea6ff;
}

.yt-login-toast {
  position: absolute;
  top: 48px;
  right: 0;
  background: #cc0000;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
  z-index: 120;
  white-space: nowrap;
  animation: fadeInScale 0.2s ease-out;
}

/* Body Layout: Sidebar + Main */
.yt-body-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #0f0f0f;
}

/* Left Navigation Sidebar */
.yt-sidebar {
  width: 230px;
  height: 100%;
  background: #0f0f0f;
  overflow-y: auto;
  padding: 12px 10px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.yt-sidebar::-webkit-scrollbar {
  width: 6px;
}
.yt-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.yt-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.yt-nav-item {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #f1f1f1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: background 0.15s ease;
}

.yt-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.yt-nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.yt-sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 10px 8px;
}

.yt-nav-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f1f1;
  padding: 8px 12px 4px;
}

.yt-sub-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.yt-sub-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.yt-sub-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
  text-transform: uppercase;
}

.yt-sub-name {
  font-size: 13px;
  color: #f1f1f1;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0070e0;
}

/* Channel Avatars */
.ary { background: #b91c1c; color: #fff; }
.geo { background: #047857; color: #fff; }
.hum { background: #d97706; color: #000; }
.green { background: #059669; color: #fff; }

/* Main Video Feed Area */
.yt-main-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background: #0f0f0f;
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
}

.yt-main-content::-webkit-scrollbar {
  width: 8px;
}
.yt-main-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Filter Chips Bar */
.yt-chips-bar {
  display: flex;
  gap: 12px;
  padding: 12px 0 16px;
  background: #0f0f0f;
  position: sticky;
  top: 0;
  z-index: 20;
  overflow-x: auto;
  scrollbar-width: none;
}
.yt-chips-bar::-webkit-scrollbar {
  display: none;
}

.yt-chip {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f1f1;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s ease;
}

.yt-chip:hover {
  background: rgba(255, 255, 255, 0.16);
}

.yt-chip.active {
  background: #f1f1f1;
  color: #0f0f0f;
  font-weight: 600;
}

/* Video Cards Grid */
.yt-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 32px 16px;
  padding-bottom: 40px;
}

.yt-video-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.yt-thumbnail-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #202020;
}

.yt-thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.yt-video-card:hover .yt-thumbnail-wrapper img {
  transform: scale(1.03);
}

.yt-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}

.yt-video-details {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.yt-channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  text-transform: uppercase;
}

.yt-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.yt-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #f1f1f1;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yt-channel-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: #aaaaaa;
  margin-top: 2px;
}

.yt-channel-name svg {
  color: #aaaaaa;
}

.yt-view-date {
  font-size: 12.5px;
  color: #aaaaaa;
}

/* ==================== 2. Active Call Screen ==================== */
#callScreen {
  flex-direction: column;
  background-color: #0b0f19;
  width: 100%;
  height: 100%;
}

.call-header {
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(19, 27, 46, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.user-avatar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
}

.user-label {
  color: var(--text-muted);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-badge.waiting {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.status-badge.waiting .status-dot {
  background: #fbbf24;
  animation: pulse 1.5s infinite;
}

.status-badge.connecting {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}
.status-badge.connecting .status-dot {
  background: #60a5fa;
  animation: pulse 1s infinite;
}

.status-badge.connected {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.status-badge.connected .status-dot {
  background: #34d399;
}

.timer {
  font-family: monospace;
  font-size: 0.95rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

/* Call Stage */
.call-stage {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  transition: padding-right 0.3s ease;
}

.video-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.video-wrapper {
  position: relative;
  background: #020617;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Remote Fullscreen Video */
.remote-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #090d16;
  color: var(--text-secondary);
  z-index: 5;
}

.avatar-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  border: 2px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.avatar-circle.small {
  width: 50px;
  height: 50px;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.primary-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #10b981;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 9999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
  font-family: inherit;
}

.primary-call-btn:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.6);
}

.primary-call-btn:active {
  transform: translateY(0);
}

.primary-call-btn.waiting {
  background: #334155;
  color: #94a3b8;
  box-shadow: none;
  cursor: default;
}

.primary-call-btn.waiting:hover {
  background: #334155;
  transform: none;
  box-shadow: none;
}

/* Local Floating PIP Video */
.local-wrapper {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 220px;
  height: 135px;
  z-index: 20;
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: border-color 0.2s ease;
  cursor: grab;
}

.local-wrapper:hover {
  border-color: var(--accent);
}

#localVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.video-name-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==================== 4. Side Chat Drawer ==================== */
.chat-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 360px;
  max-width: 100vw;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 90;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.chat-header {
  height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-title-group h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.chat-role-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-weight: 500;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
}

.icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.icon-btn.delete-btn:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-system-msg {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  gap: 3px;
}

.chat-msg.self {
  align-self: flex-end;
}

.chat-msg.partner {
  align-self: flex-start;
}

.chat-msg-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}

.chat-msg-sender {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chat-msg-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.chat-msg-bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg.self .chat-msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-msg.partner .chat-msg-bubble {
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border-color);
}

.chat-msg-img {
  width: 100%;
  max-width: 240px;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 4px;
  cursor: pointer;
  display: block;
  transition: transform 0.2s ease, opacity 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-msg-img:hover {
  opacity: 0.92;
  transform: scale(1.02);
}

.chat-msg-bubble:has(.chat-msg-img) {
  padding: 6px;
}

.chat-msg-caption {
  padding: 4px 6px 2px;
  font-size: 0.86rem;
  word-break: break-word;
}

.chat-form {
  padding: 10px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-secondary);
}

.chat-input-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  padding: 8px;
  border-radius: 8px;
  color: var(--text-muted);
}

.tool-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.chat-input-controls input[type="text"] {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
}

.chat-input-controls input[type="text"]:focus {
  border-color: var(--accent);
}

.chat-send-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--accent-hover);
}

/* ==================== Fullscreen Lightbox ==================== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeInScale 0.2s ease-out;
}

.lightbox-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

#lightboxImg {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

/* ==================== Call Controls ==================== */
.call-controls {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 20px;
  background: rgba(19, 27, 46, 0.7);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-color);
  z-index: 10;
}

.control-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.control-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

.control-btn.call-now-btn {
  background: #10b981;
  border-color: #10b981;
}

.control-btn.call-now-btn:hover {
  background: #059669;
  border-color: #059669;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5);
}

.control-btn.muted, .control-btn.off {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.control-btn.end-call {
  background: var(--danger);
  border-color: var(--danger);
}

.control-btn.end-call:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5);
}

.chat-btn-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unread-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: #3b82f6;
  border: 2px solid #182238;
  border-radius: 50%;
}

/* ==================== Modal Dialog ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.modal-description {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.modal-action-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: #fff;
  transition: var(--transition);
  text-align: left;
}

.modal-action-btn span {
  font-size: 0.9rem;
  font-weight: 600;
}

.modal-action-btn small {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-action-btn.danger {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.modal-action-btn.danger span {
  color: #f87171;
}

.modal-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
}

.modal-action-btn.cancel {
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 8px;
}

.modal-action-btn.cancel:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* Utilities */
.hidden {
  display: none !important;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* ==================== Responsive Design ==================== */

/* Tablet (Landscape & Portrait up to 1050px) */
@media (max-width: 1050px) {
  .yt-sidebar {
    width: 72px;
    padding: 10px 4px;
  }
  .yt-nav-item span,
  .yt-sidebar-divider,
  .yt-nav-section-title,
  .yt-sub-name,
  .yt-live-dot {
    display: none;
  }
  .yt-nav-item {
    justify-content: center;
    padding: 14px 0;
  }
  .yt-sub-item {
    justify-content: center;
    padding: 10px 0;
  }
  .yt-header-center {
    max-width: 440px;
    margin: 0 12px;
  }
  .yt-video-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px 14px;
  }
}

/* Medium Tablets & Large Phones (601px to 768px) */
@media (max-width: 768px) {
  .yt-sidebar {
    display: none;
  }

  .yt-header {
    height: 56px;
    padding: 0 14px;
  }

  .yt-header-left {
    min-width: auto;
    gap: 8px;
  }

  .yt-guide-btn {
    display: none;
  }

  .yt-country-code {
    display: none;
  }

  .yt-header-center {
    display: none;
  }

  .yt-header-right {
    flex: 1;
    justify-content: flex-end;
  }

  .yt-header-login-form {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    width: 100%;
  }

  .yt-input-wrapper {
    flex: 0 1 130px;
  }

  .yt-input-wrapper input {
    width: 100%;
    padding: 7px 10px 7px 28px;
    font-size: 13px;
  }

  .yt-input-wrapper input:focus {
    width: 100%;
  }

  .yt-login-submit-btn {
    padding: 7px 12px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .yt-main-content {
    padding: 0 14px 40px;
  }

  .yt-video-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px 12px;
  }
}

/* Mobile Phones (up to 600px - iPhone, Android, etc.) */
@media (max-width: 600px) {
  /* Dynamic Viewport & Full Sizing on Mobile */
  body, #app, #loginScreen.yt-home-screen {
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
  }

  /* 2-tier Authentic Mobile YouTube Header */
  .yt-header {
    height: auto;
    min-height: 56px;
    padding: 10px 12px 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 0;
    background: #0f0f0f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .yt-header-left {
    order: 1;
    min-width: auto;
    gap: 6px;
  }

  .yt-guide-btn {
    display: none;
  }

  .yt-country-code {
    display: none;
  }

  .yt-logo-badge {
    gap: 5px;
  }

  .yt-logo-text {
    font-size: 1.18rem;
    letter-spacing: -0.05em;
  }

  .yt-play-icon svg {
    width: 25px;
    height: 18px;
  }

  /* Disguise Mobile Top Action Icons */
  .yt-mobile-actions {
    order: 2;
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .yt-mobile-actions .yt-icon-btn {
    width: 36px;
    height: 36px;
    color: #f1f1f1;
  }

  .yt-header-center {
    display: none;
  }

  /* Full-width, finger-friendly login bar */
  .yt-header-right {
    order: 3;
    width: 100%;
    margin-top: 2px;
  }

  .yt-header-login-form {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .yt-input-wrapper {
    flex: 1;
    min-width: 0;
  }

  .yt-input-wrapper input {
    width: 100%;
    height: 38px;
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 8px;
    color: #f1f1f1;
    padding: 0 10px 0 28px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, background 0.15s ease;
  }

  .yt-input-wrapper input:focus {
    width: 100%;
    border-color: #3ea6ff;
    background: #141414;
    box-shadow: 0 0 0 1px #3ea6ff;
  }

  .yt-field-icon {
    left: 8px;
    width: 13px;
    height: 13px;
  }

  .yt-login-submit-btn {
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid rgba(62, 166, 255, 0.6);
    color: #3ea6ff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .yt-login-submit-btn:active {
    background: rgba(62, 166, 255, 0.2);
  }

  .yt-login-toast {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-sizing: border-box;
    white-space: normal;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
  }

  /* Body Content & Feed on Mobile */
  .yt-body-layout {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .yt-main-content {
    padding: 0 12px 30px;
    overflow-y: visible;
  }

  /* Chips Bar */
  .yt-chips-bar {
    padding: 8px 0 12px;
    gap: 8px;
    background: #0f0f0f;
  }

  .yt-chip {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  /* Video Grid: Single-column on mobile */
  .yt-video-grid {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-bottom: 30px;
  }

  .yt-video-card {
    gap: 8px;
  }

  .yt-thumbnail-wrapper {
    border-radius: 10px;
    aspect-ratio: 16 / 9;
  }

  .yt-video-details {
    gap: 12px;
    margin-top: 6px;
  }

  .yt-channel-avatar {
    width: 36px;
    height: 36px;
    font-size: 11px;
  }

  .yt-title {
    font-size: 14px;
    line-height: 1.35;
    font-weight: 500;
  }

  .yt-channel-name, .yt-view-date {
    font-size: 12px;
    margin-top: 3px;
  }

  /* Calling Screen Responsiveness on Mobile */
  .call-header {
    padding: 0 10px;
    height: 52px;
  }

  .user-info-pill {
    padding: 4px 10px;
    font-size: 0.8rem;
  }

  .status-badge {
    padding: 4px 10px;
    font-size: 0.8rem;
  }

  .primary-call-btn {
    padding: 10px 18px;
    font-size: 0.88rem;
  }

  .local-wrapper {
    width: 110px;
    height: 80px;
    bottom: 12px;
    right: 12px;
    border-radius: 10px;
  }

  .call-controls {
    gap: 8px;
    padding: 10px 8px;
  }

  .control-btn {
    width: 44px;
    height: 44px;
  }

  .chat-drawer {
    width: 100%;
  }
}

/* Extra Small Phones (iPhone SE, Galaxy A-series under 380px) */
@media (max-width: 380px) {
  .yt-header {
    padding: 8px 10px;
  }

  .yt-logo-text {
    font-size: 1.05rem;
  }

  .yt-header-login-form {
    gap: 6px;
  }

  .yt-input-wrapper input {
    height: 36px;
    padding: 0 6px 0 24px;
    font-size: 13px;
  }

  .yt-field-icon {
    left: 7px;
    width: 12px;
    height: 12px;
  }

  .yt-login-submit-btn {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
    gap: 4px;
  }

  .yt-login-submit-btn svg {
    width: 13px;
    height: 13px;
  }
}
