/* Custom styles for ZoomClone */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* { font-family: 'Inter', sans-serif; box-sizing: border-box; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-ring { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

.fade-in { animation: fadeIn 0.3s ease forwards; }
.slide-in-right { animation: slideInRight 0.3s ease forwards; }
.slide-out-right { animation: slideOutRight 0.3s ease forwards; }

/* Spinner */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(99,102,241,0.3);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Gradient backgrounds */
.bg-gradient-brand { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bg-gradient-dark { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }

/* Video grid */
.video-grid {
  display: grid;
  gap: 8px;
  width: 100%;
  height: 100%;
}
.video-grid.participants-1 { grid-template-columns: 1fr; }
.video-grid.participants-2 { grid-template-columns: 1fr 1fr; }
.video-grid.participants-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid.participants-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid.participants-5,
.video-grid.participants-6 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid.participants-many { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Video tiles */
.video-tile {
  position: relative;
  background: #1f2937;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.video-tile.speaking { border-color: #22c55e; }
.video-tile video {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.video-tile.screen-share video { transform: none; }
.video-tile .tile-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex; align-items: center; gap: 8px;
}
.video-tile .avatar-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 700;
}

/* Control bar */
.control-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid rgba(75,85,99,0.3);
  z-index: 50;
}

/* Control buttons */
.ctrl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 14px;
  border-radius: 12px;
  border: none; cursor: pointer;
  transition: all 0.2s;
  background: rgba(55,65,81,0.7);
  color: white; font-size: 0.65rem; font-weight: 500;
  min-width: 56px;
}
.ctrl-btn:hover { background: rgba(75,85,99,0.9); transform: translateY(-1px); }
.ctrl-btn i { font-size: 1.1rem; }
.ctrl-btn.active { background: rgba(99,102,241,0.3); color: #818cf8; }
.ctrl-btn.danger { background: rgba(239,68,68,0.3); color: #f87171; }
.ctrl-btn.danger:hover { background: rgba(239,68,68,0.5); }
.ctrl-btn.end { background: #dc2626; color: white; }
.ctrl-btn.end:hover { background: #b91c1c; }
.ctrl-btn.muted { background: rgba(239,68,68,0.2); color: #f87171; }

/* Sidebar */
.sidebar {
  position: fixed; right: 0; top: 0; bottom: 80px;
  width: 320px; background: #111827;
  border-left: 1px solid rgba(75,85,99,0.3);
  display: flex; flex-direction: column;
  z-index: 40; transform: translateX(100%);
  transition: transform 0.3s ease;
}
.sidebar.open { transform: translateX(0); }

/* Chat */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: #374151 transparent;
}
.chat-bubble {
  max-width: 85%; padding: 8px 12px;
  border-radius: 12px; font-size: 0.85rem;
}
.chat-bubble.self { background: #6366f1; margin-left: auto; border-radius: 12px 12px 4px 12px; }
.chat-bubble.other { background: #1f2937; border-radius: 12px 12px 12px 4px; }
.chat-bubble .sender { font-size: 0.7rem; opacity: 0.7; margin-bottom: 2px; font-weight: 600; }
.chat-bubble .time { font-size: 0.65rem; opacity: 0.5; margin-top: 4px; text-align: right; }

/* Notification toast */
.toast {
  position: fixed; top: 20px; right: 20px;
  background: #1f2937; border: 1px solid #374151;
  padding: 12px 20px; border-radius: 12px;
  color: white; font-size: 0.9rem;
  z-index: 100; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease;
}
.toast.success { border-color: #22c55e; }
.toast.error { border-color: #ef4444; }
.toast.info { border-color: #6366f1; }

/* Auth forms */
.auth-card {
  background: rgba(17,24,39,0.95);
  border: 1px solid rgba(75,85,99,0.4);
  border-radius: 20px; padding: 40px;
  backdrop-filter: blur(20px);
}

.form-input {
  width: 100%; padding: 12px 16px;
  background: rgba(31,41,55,0.8);
  border: 1px solid rgba(75,85,99,0.5);
  border-radius: 10px; color: white;
  outline: none; transition: border-color 0.2s;
  font-size: 0.95rem;
}
.form-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-input::placeholder { color: #6b7280; }

.btn-primary {
  width: 100%; padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; border: none; border-radius: 10px;
  font-weight: 600; cursor: pointer; font-size: 1rem;
  transition: all 0.2s; letter-spacing: 0.3px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 25px rgba(99,102,241,0.4); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  padding: 10px 20px;
  background: rgba(55,65,81,0.7);
  color: white; border: 1px solid rgba(75,85,99,0.5); border-radius: 10px;
  font-weight: 500; cursor: pointer; font-size: 0.9rem;
  transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(75,85,99,0.9); }

/* Meeting cards */
.meeting-card {
  background: rgba(31,41,55,0.6);
  border: 1px solid rgba(75,85,99,0.3);
  border-radius: 16px; padding: 20px;
  transition: all 0.2s; cursor: pointer;
}
.meeting-card:hover { border-color: rgba(99,102,241,0.5); background: rgba(31,41,55,0.9); transform: translateY(-2px); }

/* Participant item */
.participant-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-radius: 10px; transition: background 0.2s;
}
.participant-item:hover { background: rgba(31,41,55,0.5); }

/* Avatar */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.3rem; }

/* Modal */
.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: 200;
}
.modal-box {
  background: #111827; border: 1px solid rgba(75,85,99,0.4);
  border-radius: 20px; padding: 32px; width: 90%; max-width: 480px;
  animation: fadeIn 0.2s ease;
}

/* Speaking indicator */
.speaking-indicator {
  display: inline-block; width: 8px; height: 8px;
  background: #22c55e; border-radius: 50%;
  animation: pulse-ring 1.5s infinite;
}

/* Waiting room badge */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; border-radius: 10px;
  background: #ef4444; color: white; font-size: 0.65rem; font-weight: 700;
  padding: 0 6px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

/* Screen share border */
.screen-sharing-active { border: 3px solid #6366f1 !important; }

/* ── Screen Share Layout ─────────────────────────────── */
/* Mobile-এ screen share prominent view */
.video-grid.screen-share-layout {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  height: 100%;
}

.video-tile.screen-share-prominent {
  flex: 1;
  min-height: 0;
  border: 2px solid #6366f1 !important;
  border-radius: 12px;
  overflow: hidden;
  background: #000 !important;
}

.video-tile.screen-share-prominent video {
  object-fit: contain !important;
  transform: none !important;
  background: #000;
}

/* Other participants thumbnail strip */
.video-grid.screen-share-layout .video-tile:not(.screen-share-prominent) {
  height: 80px;
  width: 120px;
  min-height: 80px;
  flex-shrink: 0;
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
}

/* Horizontal scroll for thumbnail strip */
.video-grid.screen-share-layout:not(:only-child) {
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* Mobile fix */
@media (max-width: 640px) {
  .video-tile.screen-share-prominent {
    min-height: 60%;
  }
  .video-grid.screen-share-layout .video-tile:not(.screen-share-prominent) {
    height: 70px;
    width: 100px;
  }
}

/* Tabs */
.tab-btn {
  flex: 1; padding: 10px;
  background: transparent; border: none; color: #9ca3af;
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.tab-btn.active { color: #6366f1; border-bottom-color: #6366f1; }

/* Waiting room item */
.waiting-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(31,41,55,0.5);
  border-radius: 10px; margin-bottom: 8px;
}

/* Loading overlay */
.loading-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: #0f172a;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 20px;
}

/* Video off placeholder */
.video-off-avatar {
  width: 100%; height: 100%; display: flex;
  align-items: center; justify-content: center;
  background: #1f2937;
}

/* Recording indicator */
.recording-dot {
  width: 8px; height: 8px; background: #ef4444; border-radius: 50%;
  animation: pulse-ring 1s infinite;
  display: inline-block;
}

/* Meeting info bar */
.meeting-info-bar {
  position: fixed; top: 0; left: 0; right: 0;
  background: rgba(17,24,39,0.9); backdrop-filter: blur(10px);
  padding: 8px 20px; display: flex; align-items: center;
  justify-content: space-between; z-index: 30;
  border-bottom: 1px solid rgba(75,85,99,0.3); height: 56px;
}

/* Main video area */
.video-area {
  position: fixed; top: 56px; left: 0; right: 0;
  bottom: 88px; overflow: hidden;
  padding: 8px; background: #0f172a;
  transition: right 0.3s ease;
}
.video-area.sidebar-open { right: 320px; }

/* Control bar responsive */
@media (max-width: 640px) {
  .control-bar { padding: 8px 10px; flex-wrap: wrap; gap: 6px; justify-content: center; }
  .ctrl-btn { min-width: 48px; padding: 8px 10px; font-size: 0.6rem; }
  .ctrl-btn i { font-size: 0.95rem; }
  .ctrl-btn span { display: none; }
  .sidebar { width: 100%; right: 0; }
  .video-area.sidebar-open { right: 0; bottom: 50%; }
  .sidebar.open { top: 50%; bottom: 88px; }
  .meeting-info-bar { padding: 6px 12px; height: 48px; }
  .video-area { top: 48px; bottom: 70px; }
}

/* Audio element hidden */
audio[id^="audio-"] { position: absolute; width: 0; height: 0; opacity: 0; }
