/* ==========================================
   ZRTC Apps - WebRTC 应用页面共用样式
   ========================================== */

/* --- ZRTC Brand Bar (standalone fallback) --- */
.app-brand {
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  padding: 16px 0;
  border-bottom: 3px solid var(--color-primary);
}
.app-brand__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.app-brand__logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary-light);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.app-brand__logo:hover {
  color: white;
}
.app-brand__tagline {
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: none;
}
@media (min-width: 500px) {
  .app-brand__tagline {
    display: inline;
  }
}
.app-brand__nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.app-brand__nav a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #cbd5e1;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.app-brand__nav a:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}
.app-brand__nav a.active {
  color: white;
  background: var(--color-primary);
}

/* --- ZRTC Footer (standalone fallback) --- */
.app-footer {
  background: #0f172a;
  color: #64748b;
  padding: 24px 0;
  text-align: center;
  font-size: 0.85rem;
}
.app-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.app-footer__inner a {
  color: var(--color-primary-light);
  text-decoration: none;
}
.app-footer__inner a:hover {
  color: white;
}

/* --- App Header --- */
.app-header {
  text-align: center;
  margin-bottom: 32px;
}
.app-header__icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-header__icon svg {
  width: 48px;
  height: 48px;
}
.app-header__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.app-header__desc {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* --- Tab Bar --- */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-text-light);
  transition: all 0.2s;
  font-family: inherit;
}
.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.tab-btn:hover {
  color: var(--color-primary);
}
.tab-content {
}
.tab-content.active {
  display: block;
}

/* --- App Container --- */
.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: calc(100vh - 200px);
}

.app-container--wide {
  max-width: 1200px;
}

.app-container--dark {
  background: #0f172a;
  color: #e2e8f0;
  max-width: 100%;
  min-height: 100vh;
}
.app-container--dark .card {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
.app-container--dark .card-title {
  color: #f1f5f9;
}
.app-container--dark input,
.app-container--dark textarea {
  background: #334155;
  border-color: #475569;
  color: #f1f5f9;
}
.app-container--dark .status-info {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}
.app-container--dark .status-success {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}
.app-container--dark .status-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* --- App Card --- */
.app-card {
  background: var(--color-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.app-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- App Buttons --- */
.app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}

.app-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.app-btn--primary {
  background: var(--color-primary);
  color: white;
}
.app-btn--primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.app-btn--success {
  background: var(--color-success);
  color: white;
}
.app-btn--success:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.app-btn--danger {
  background: #ef4444;
  color: white;
}
.app-btn--danger:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.app-btn--outline {
  background: transparent;
  border: 2px solid var(--border-color);
  color: inherit;
}
.app-btn--outline:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.app-btn--lg {
  padding: 16px 32px;
  font-size: 1.125rem;
  width: 100%;
}

.app-btn--sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.app-btn-group {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 20px;
}
@media (max-width: 600px) {
  .app-btn-group {
    flex-direction: column;
  }
}

/* --- App Input --- */
.app-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--color-bg-light);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1.125rem;
  font-family: var(--font-mono);
  outline: none;
  transition: var(--transition);
  color: inherit;
  letter-spacing: 2px;
  text-align: center;
}
.app-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* --- Status --- */
.app-status {
  padding: 16px;
  border-radius: var(--radius);
  margin: 16px 0;
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
}
.app-status--info {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--color-primary);
}
.app-status--success {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}
.app-status--error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}
.app-status--warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}

/* --- Dropzone --- */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--color-bg-light);
}
.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.05);
}
.dropzone__icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}
.dropzone__text {
  color: var(--color-text-light);
  font-size: 1.1rem;
}
.dropzone__hint {
  color: var(--color-text-light);
  font-size: 0.85rem;
  margin-top: 8px;
  opacity: 0.7;
}

/* --- Video Layout --- */
.video-layout {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 16px 0;
}

/* 远程视频全屏 */
.video-remote {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

/* 本地视频叠加到右上角（固定尺寸，类似 client.html） */
.local-preview {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 200px;
  height: 150px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 10;
  border: 2px solid rgba(255,255,255,0.25);
  background: #1e293b;
}
.local-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.local-preview__label {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  z-index: 11;
}
.local-preview__placeholder {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  color: #64748b;
  gap: 4px;
  z-index: 5;
}
.local-preview__placeholder svg {
  opacity: 0.5;
}
.local-preview__placeholder span {
  font-size: 0.7rem;
  opacity: 0.6;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .video-layout {
    aspect-ratio: 9/16;
  }
  .local-preview {
    width: 140px;
    height: 105px;
    top: 8px;
    right: 8px;
  }
}

.video-box__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(34, 197, 94, 0.9);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  z-index: 10;
}

/* --- Controls Bar --- */
.controls-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  flex-wrap: wrap;
}

.ctrl-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #334155;
  color: #e2e8f0;
}
.ctrl-btn:hover {
  transform: scale(1.1);
}
.ctrl-btn--active {
  background: var(--color-primary);
  color: white;
}
.ctrl-btn--danger {
  background: #ef4444;
  color: white;
}
.ctrl-btn--danger:hover {
  background: #dc2626;
}
.ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* --- Room Code Display --- */
.room-code-display {
  text-align: center;
  padding: 20px;
}
.room-code-display__code {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--color-primary);
  font-family: var(--font-mono);
  background: var(--color-bg-light);
  padding: 12px 32px;
  border-radius: var(--radius);
  display: inline-block;
  margin: 8px 0;
  user-select: all;
}

/* --- QR Container --- */
.qr-wrapper {
  background: white;
  padding: 12px;
  border-radius: var(--radius);
  display: inline-block;
}

/* --- File List --- */
.file-list {
  list-style: none;
  width: 100%;
}
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: var(--transition);
}
.file-item:hover {
  border-color: var(--color-primary-light);
}
.file-item__info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.file-item__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.file-item__name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-item__size {
  font-size: 0.8rem;
  color: var(--color-text-light);
  flex-shrink: 0;
}
.file-item__remove {
  background: none;
  border: none;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
  font-size: 1rem;
}
.file-item__remove:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
}

/* --- Progress --- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-bg-light);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}
.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* --- Share Panel --- */
.share-panel {
  display: flex;
  gap: 24px;
  align-items: center;
  margin: 24px 0;
  flex-wrap: wrap;
  justify-content: center;
}
.share-links {
  flex: 1;
  min-width: 200px;
}
.share-link-item {
  margin-bottom: 12px;
}
.share-link-item label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 4px;
  font-weight: 500;
}
.share-link-item .link-row {
  display: flex;
  gap: 8px;
}
.share-link-item input {
  flex: 1;
  padding: 10px 12px;
  background: var(--color-bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  outline: none;
  color: inherit;
}
.share-link-item input:focus {
  border-color: var(--color-primary);
}

/* --- Spinner --- */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* --- Pulse --- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* --- Entry page (room select) --- */
.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
  align-items: stretch;
}
@media (max-width: 700px) {
  .entry-grid {
    grid-template-columns: 1fr;
  }
}
.entry-card {
  background: var(--color-bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.entry-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
}
.entry-card__icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.entry-card__icon svg {
  width: 48px;
  height: 48px;
}
.entry-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.entry-card__desc {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.entry-card .app-btn--lg {
  margin-top: auto;
  width: 100%;
}

/* ==========================================
   接收文件区域样式
   ========================================== */
.receive-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  background: var(--color-bg-light);
  transition: var(--transition);
}
.receive-zone:hover {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.05);
}
.receive-zone__icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
  color: var(--color-primary);
}
.receive-zone__text {
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.receive-zone__hint {
  color: var(--color-text-light);
  font-size: 0.85rem;
  opacity: 0.8;
  margin-bottom: 24px;
}

/* ==========================================
   取件码 / 房间码 格子输入样式
   ========================================== */
.pickup-code-boxes {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.pickup-code-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  color: var(--color-text);
}
.pickup-code-box::placeholder {
  color: #d1d5db;
  font-size: 1.5rem;
}
.pickup-code-box:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.pickup-code-box.filled {
  border-color: var(--color-primary);
  background: #f0f4ff;
}
@media (max-width: 480px) {
  .pickup-code-boxes {
    gap: 6px;
  }
  .pickup-code-box {
    width: 40px;
    height: 48px;
    font-size: 1.2rem;
  }
  .pickup-code-box::placeholder {
    font-size: 1.2rem;
  }
}

/* ==========================================
   LAN Nearby Devices
   ========================================== */

.lan-peer-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--color-bg);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  border: 1px solid var(--color-border);
}
.lan-peer-item:hover {
  background: var(--color-bg-light, #f1f5f9);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.lan-peer-item__icon {
  font-size: 1.3rem;
  margin-right: 10px;
  flex-shrink: 0;
}
.lan-peer-item__info {
  flex: 1;
  min-width: 0;
}
.lan-peer-item__name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lan-peer-item__device {
  font-size: 0.75rem;
  color: var(--color-text-light);
}
.lan-peer-item .app-btn {
  flex-shrink: 0;
  margin-left: 8px;
}

/* 我的设备 - 与对端列表统一但带区分标识 */
.lan-peer-item.my-device {
  background: var(--color-bg-soft);
  cursor: default;
  margin-bottom: 10px;
}
.lan-peer-item.my-device:hover {
  background: var(--color-bg-soft);
  box-shadow: none;
}
.lan-peer-item.my-device .lan-peer-item__icon {
  font-size: 1.3rem;
  margin-right: 10px;
}
