/* ====== Login ====== */
#loginScreen {
  background: linear-gradient(135deg, #0f0f0f 0%, #1a1a2e 100%);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}

.login-card .text-muted {
  color: rgba(255, 255, 255, 0.6) !important;
}

.login-card .form-label.text-muted {
  color: rgba(255, 255, 255, 0.6) !important;
}

.login-card .form-control {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
}

.login-card .form-control::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.login-card .form-control:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: #0d6efd;
  color: #fff;
  box-shadow: none;
}

/* ====== Auth logo ====== */
.auth-logo {
  max-width: 120px;
  height: auto;
}

/* ====== Auth tabs ====== */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.auth-tab:hover {
  color: #fff;
}

.auth-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ====== Auth forms ====== */
.auth-form .btn-success {
  background: #198754;
  border: none;
}

.auth-form .btn-success:hover {
  background: #157347;
}

/* ====== Invite tabs ====== */
.invite-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 4px;
}

.invite-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.invite-tab:hover {
  color: #fff;
}

.invite-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ====== Code display ====== */
.code-display {
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 12px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 8px;
  font-family: "Courier New", monospace;
  color: #fff;
  text-align: center;
}

/* ====== Invite error ====== */
#inviteError {
  text-align: center;
}

/* ====== Call screen ====== */
#callScreen {
  background: #0f0f0f;
}

/* ====== Video container ====== */
.video-container {
  background: #1a1a1a;
  overflow: hidden;
}

.remote-video {
  object-fit: cover;
}

.local-video {
  position: absolute;
  top: auto;
  left: auto;
  bottom: 16px;
  right: 16px;
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: #000;
  z-index: 2;
  transform: scaleX(-1);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.local-video {
  transition: top 0.05s, left 0.05s;
}

.local-video.dragging {
  cursor: grabbing;
  transition: none;
}

.local-video:not(.mirrored) {
  transform: none;
}

.remote-label {
  position: absolute;
  top: 16px;
  left: 16px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  z-index: 3;
}

.remote-mic-icon {
  position: absolute;
  top: 16px;
  left: 16px;
  margin-left: 4px;
  color: #ff4d4d;
  font-size: 0.9rem;
  z-index: 4;
}

.remote-label + .remote-mic-icon {
  left: auto;
  right: 16px;
  margin-left: 0;
}

/* ====== Room code badge ====== */
.room-code-badge {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 3;
}

.room-code-text {
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 2px;
}

.room-code-badge .btn:hover {
  color: #fff !important;
}

/* ====== Overlay ====== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

#disconnectedOverlay {
  background: #000;
}

/* ====== Controls bar ====== */
.controls-bar {
  background: rgba(30, 30, 30, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-control {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  position: relative;
}

.btn-control.btn-danger {
  width: 52px;
  height: 52px;
}

/* inactive state (mic off, cam off) */
.btn-control.is-inactive {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ff4d4d !important;
  border-color: transparent;
}

/* ====== Responsive ====== */
/* ====== Screen Share Modal ====== */
.screen-share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.screen-share-modal {
  background: #1a1a2e;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 400px;
  width: 90%;
  color: #fff;
  overflow: hidden;
}

.screen-share-modal-header {
  padding: 20px 20px 0;
  text-align: center;
}

.screen-share-modal-body {
  padding: 16px 20px;
}

.screen-share-modal-body ul {
  padding-left: 20px;
  list-style: disc;
}

.screen-share-modal-body ul li {
  margin-bottom: 6px;
  line-height: 1.4;
}

.screen-share-modal-footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes screen-share-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(13, 110, 253, 0.15); }
}

.btn-control.is-screen-sharing {
  background: #0d6efd !important;
  color: #fff !important;
  animation: screen-share-pulse 1.5s infinite;
}

/* ====== Chat Panel ====== */
.chat-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 10;
  animation: chat-slide-in 0.2s ease-out;
}

@keyframes chat-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}

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

.chat-message {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-message.own {
  align-self: flex-end;
  background: #0d6efd;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.other {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.chat-message .msg-name {
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-message.own .msg-name {
  color: rgba(255, 255, 255, 0.7);
}

.chat-message.other .msg-name {
  color: #0d6efd;
}

.chat-link {
  color: #6ea8fe;
  text-decoration: underline;
  word-break: break-all;
}

.chat-link:hover {
  color: #9ec5fe;
}

.chat-message .msg-time {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
  text-align: right;
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.chat-input-wrap .form-control {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
}

.chat-input-wrap .form-control::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.chat-input-wrap .form-control:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: #0d6efd;
  color: #fff;
  box-shadow: none;
}

.chat-panel.d-none {
  display: none;
}

.chat-input-wrap .form-control:disabled,
.chat-panel-header button:disabled {
  opacity: 0.5;
}

/* ====== Emoji Picker ====== */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 8px;
  z-index: 20;
  margin-bottom: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
}

.emoji-grid span {
  cursor: pointer;
  font-size: 1.3rem;
  padding: 4px;
  text-align: center;
  border-radius: 6px;
  transition: background 0.15s;
}

.emoji-grid span:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #dc3545;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  text-align: center;
  z-index: 1;
}

/* ====== Waiting Approval Overlay ====== */
#waitingApprovalOverlay {
  z-index: 6;
}

#waitingApprovalOverlay .bi-hourglass-split {
  animation: approval-pulse 1.5s infinite;
}

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

/* ====== Time Warning ====== */
#timeWarning {
  animation: time-warning-blink 1s infinite;
}

@keyframes time-warning-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (max-width: 576px) {
  .local-video {
    width: 90px;
    height: 120px;
    bottom: 12px;
    right: 12px;
  }
}
