/* ============================================================
   Video Streaming Platform — White & Blue Theme
   ============================================================ */

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --bg: #f8f9fa;
  --white: #ffffff;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
  --card-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.15);
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-light: #80868b;
  --border: #dadce0;
  --danger: #d93025;
  --success: #1e8e3e;
  --sidebar-width: 240px;
  --navbar-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  flex-shrink: 0;
  min-width: 150px;
}

.navbar-brand:hover {
  text-decoration: none;
}

.navbar-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.navbar-search {
  flex: 1;
  max-width: 540px;
  display: flex;
  gap: 0;
}

.navbar-search input {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  background: var(--bg);
  transition: border-color var(--transition);
}

.navbar-search input:focus {
  border-color: var(--primary);
  background: var(--white);
}

.navbar-search button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  transition: background var(--transition);
}

.navbar-search button:hover {
  background: var(--primary-dark);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.navbar-actions .btn {
  padding: 7px 16px;
  font-size: 0.9rem;
}

.user-menu {
  position: relative;
}

.user-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  transition: border-color var(--transition);
}

.user-avatar-btn:hover {
  border-color: var(--primary);
}

.user-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--card-shadow-hover);
  min-width: 180px;
  display: none;
  z-index: 1001;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown a,
.user-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition);
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background: var(--bg);
  text-decoration: none;
}

.user-dropdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  padding-top: var(--navbar-height);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  background: var(--white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
  z-index: 100;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin: 2px 8px;
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-nav li a .icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 16px;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
  min-width: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #b0261e;
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

/* ============================================================
   VIDEO GRID
   ============================================================ */
.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

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

.video-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.video-thumbnail {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #e8e8e8;
  overflow: hidden;
}

.video-thumbnail img,
.video-thumbnail video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumbnail .placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #c5d8fd 100%);
  color: var(--primary);
  font-size: 2.5rem;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 500;
}

.video-info {
  padding: 12px;
}

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.video-meta .uploader {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
}

.video-meta .uploader:hover {
  color: var(--primary);
}

.video-meta .uploader img,
.video-meta .uploader .avatar-placeholder {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--white);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-control.textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f8f9fa 100%);
  padding: 20px;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow-hover);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo .brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ============================================================
   ALERT MESSAGES
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error {
  background: #fce8e6;
  color: var(--danger);
  border: 1px solid #f5c6c3;
}

.alert-success {
  background: #e6f4ea;
  color: var(--success);
  border: 1px solid #b7dfbc;
}

.alert-info {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #c5d8fd;
}

/* ============================================================
   VIDEO WATCH PAGE
   ============================================================ */
.watch-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

.video-player-wrapper {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.video-player-wrapper video {
  width: 100%;
  display: block;
}

.video-details {
  padding: 16px 0;
}

.video-details h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.video-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 12px 0;
}

.video-stats {
  flex: 1;
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.like-btn:hover,
.like-btn.liked {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.uploader-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
}

.uploader-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.uploader-details {
  flex: 1;
}

.uploader-details .name {
  font-weight: 600;
  font-size: 0.95rem;
}

.uploader-details .follower-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ============================================================
   COMMENTS
   ============================================================ */
.comments-section {
  margin-top: 24px;
}

.comments-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.comment-input-area {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.comment-input-area textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color var(--transition);
  min-height: 42px;
}

.comment-input-area textarea:focus {
  border-color: var(--primary);
}

.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg);
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  object-fit: cover;
}

.comment-body {
  flex: 1;
}

.comment-username {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.comment-time {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-left: 8px;
}

.comment-text {
  font-size: 0.9rem;
  margin-top: 4px;
  line-height: 1.5;
}

.comment-delete-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.78rem;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}

.comment-delete-btn:hover {
  color: var(--danger);
  background: #fce8e6;
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-header {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.profile-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 2.2rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 3px solid var(--primary-light);
}

.profile-info {
  flex: 1;
}

.profile-info h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-bio {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.profile-stats {
  display: flex;
  gap: 24px;
}

.profile-stats .stat {
  text-align: center;
}

.profile-stats .stat .value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.profile-stats .stat .label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Edit Profile Modal ── */
.edit-profile-card {
  padding: 28px;
  width: 100%;
  max-width: 460px;
  margin: 20px;
  max-height: 90vh;
  overflow-y: auto;
}

.edit-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.edit-profile-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-icon-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.btn-icon-close:hover {
  background: var(--bg);
  color: var(--danger);
}

.avatar-edit-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.avatar-preview-wrapper {
  position: relative;
  display: inline-block;
}

.avatar-preview-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  border: 3px solid var(--border);
  overflow: hidden;
  background-repeat: no-repeat;
}

.avatar-camera-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background var(--transition);
  border: 2px solid var(--white);
}

.avatar-camera-btn:hover {
  background: var(--primary-dark);
}

.input-with-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-status .form-control {
  flex: 1;
}

.username-status {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ============================================================
   MESSAGES PAGE
   ============================================================ */
.messages-main {
  padding: 0 !important;
}

.messages-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  height: calc(100vh - var(--navbar-height));
  background: var(--white);
  overflow: hidden;
}

.conversations-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.conversations-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 600;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--bg);
}

.conversation-item:hover,
.conversation-item.active {
  background: var(--primary-light);
}

.conversation-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
  object-fit: cover;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.conversation-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-badge {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-panel {
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

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

.chat-message {
  display: flex;
  gap: 8px;
  max-width: 75%;
}

.chat-message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 100%;
  word-break: break-word;
}

.chat-message.received .chat-message-bubble {
  background: var(--bg);
  color: var(--text-primary);
  border-radius: 4px 18px 18px 18px;
}

.chat-message.sent .chat-message-bubble {
  background: var(--primary);
  color: white;
  border-radius: 18px 4px 18px 18px;
}

.chat-message-time {
  font-size: 0.72rem;
  color: var(--text-light);
  align-self: flex-end;
  white-space: nowrap;
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-area textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color var(--transition);
}

.chat-input-area textarea:focus {
  border-color: var(--primary);
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  gap: 12px;
  font-size: 0.95rem;
}

.chat-empty .icon {
  font-size: 3rem;
  color: var(--border);
}

/* ============================================================
   UPLOAD PAGE
   ============================================================ */
.upload-page {
  max-width: 700px;
  margin: 0 auto;
}

.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg);
  margin-bottom: 24px;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-dropzone .icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.upload-dropzone p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.upload-progress {
  margin-top: 12px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
  width: 0%;
}

/* ============================================================
   SEARCH PAGE
   ============================================================ */
.search-hero {
  text-align: center;
  padding: 40px 0 24px;
}

.search-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.search-hero p {
  color: var(--text-secondary);
}

.search-bar-lg {
  display: flex;
  max-width: 600px;
  margin: 0 auto 32px;
  gap: 0;
}

.search-bar-lg input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition);
}

.search-bar-lg input:focus {
  border-color: var(--primary);
}

.search-bar-lg button {
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition);
}

.search-bar-lg button:hover {
  background: var(--primary-dark);
}

/* ============================================================
   PLYR VIDEO PLAYER OVERRIDES
   ============================================================ */
.video-player-wrapper .plyr {
  border-radius: 0;
}

.video-player-wrapper .plyr--video {
  width: 100%;
}

/* ============================================================
   LOADING & EMPTY STATES
   ============================================================ */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 12px;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state .icon {
  font-size: 3rem;
  color: var(--border);
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.pagination button:hover,
.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-primary);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: var(--card-shadow-hover);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   SEARCH TOGGLE BUTTON (mobile only — shown via media query)
   ============================================================ */
.search-toggle-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-primary);
  padding: 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.search-toggle-btn:hover {
  background: var(--bg);
}

/* ============================================================
   BOTTOM NAVIGATION (mobile only — shown via media query)
   ============================================================ */
.bottom-nav {
  display: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  /* ── Navbar: hide full search, show toggle icon ── */
  .navbar-search {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 10px 16px;
    border-bottom: 2px solid var(--primary);
    z-index: 1001;
    gap: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }

  .navbar.search-open .navbar-search {
    display: flex;
  }

  .search-toggle-btn {
    display: flex;
  }

  /* Hide upload button in navbar on mobile (available via bottom nav) */
  .navbar-upload-btn {
    display: none;
  }

  /* ── Sidebar: hidden on mobile (bottom nav replaces it) ── */
  .sidebar {
    display: none !important;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-bottom: calc(56px + 16px);
  }

  /* ── Bottom navigation ── */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--white);
    border-top: 1px solid var(--border);
    z-index: 1000;
    align-items: stretch;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.6rem;
    font-weight: 500;
    gap: 3px;
    transition: color var(--transition);
    padding: 6px 0 4px;
    position: relative;
  }

  .bottom-nav-item i {
    font-size: 1.25rem;
  }

  .bottom-nav-item.active {
    color: var(--primary);
  }

  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--primary);
    border-radius: 0 0 2px 2px;
  }

  .bottom-nav-item:hover {
    color: var(--primary);
    text-decoration: none;
  }

  /* ── Page-level layout fixes ── */
  .watch-layout {
    grid-template-columns: 1fr;
  }

  .messages-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - var(--navbar-height) - 56px);
    border-radius: 0;
    box-shadow: none;
    position: relative;
    overflow: hidden;
  }

  .conversations-panel {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--white);
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    display: flex;
  }

  .conversations-panel.panel-hidden {
    transform: translateX(-100%);
    pointer-events: none;
  }

  .chat-panel {
    position: absolute;
    inset: 0;
    z-index: 5;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    background: var(--white);
    display: flex;
    flex-direction: column;
  }

  .chat-panel.panel-visible {
    transform: translateX(0);
  }

  /* Fix input bar + reply preview above the bottom nav on mobile */
  .chat-panel .reply-preview {
    flex-shrink: 0;
  }

  .chat-panel .chat-input-area {
    position: fixed;
    bottom: 56px; /* height of .bottom-nav */
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--white);
    border-top: 1px solid var(--border);
  }

  /* Prevent messages from being hidden behind the fixed input area (≈ 65px) + bottom-nav (56px) */
  .chat-panel.panel-visible .chat-messages {
    padding-bottom: 80px;
  }

  .chat-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 1rem;
    padding: 4px 8px 4px 0;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .chat-back-btn:hover {
    background: var(--primary-light);
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .navbar-brand {
    min-width: auto;
  }

  .brand-name {
    display: none;
  }

  .auth-card {
    padding: 24px;
  }

  .btn-label {
    display: none;
  }

  /* Search page mobile */
  .search-hero h1 {
    font-size: 1.4rem;
  }

  .search-bar-lg-wrap {
    padding: 0 4px;
  }

  .search-bar-lg {
    max-width: 100%;
  }

  .search-bar-lg input {
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  .search-bar-lg button {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .category-pills {
    gap: 6px;
    padding: 0 4px;
  }

  /* Playlist page mobile */
  .playlist-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   SEARCH PAGE EXTRA
   ============================================================ */
.search-bar-lg-wrap {
  position: relative;
  max-width: 600px;
  margin: 0 auto 16px;
}

.search-bar-lg {
  margin-bottom: 0;
}

.search-section-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-results-info {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* Category pills */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 0;
}

.category-pill {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.category-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.category-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Category tag on video cards */
.video-thumbnail {
  position: relative;
}

.category-tag {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.65);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  pointer-events: none;
}

/* ============================================================
   SHARE MODAL & GENERIC MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 20px;
}

.share-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.share-link-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  outline: none;
}

.share-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--transition);
  color: white;
}

.share-btn:hover {
  opacity: 0.85;
  text-decoration: none;
  color: white;
}

.share-btn.whatsapp { background: #25D366; }
.share-btn.twitter { background: #000; }
.share-btn.facebook { background: #1877F2; }
.share-btn.telegram { background: #0088CC; }

/* ============================================================
   BLUETICK / VERIFIED BADGE  (custom verified badge)
   ============================================================ */
.bluetick-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}

/* Larger version used in profile headers */
.profile-info .bluetick-icon {
  width: 20px;
  height: 20px;
}

/* ============================================================
   SEARCH SUGGESTIONS DROPDOWN
   ============================================================ */
.navbar-search-wrapper {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.navbar-search {
  width: 100%;
}

.search-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--card-shadow-hover);
  z-index: 1100;
  overflow: hidden;
}

.suggestion-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.suggestion-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ============================================================
   MESSAGES EXTRA (reply, search, unread header)
   ============================================================ */
.conv-search-wrap {
  position: relative;
}

.chat-back-btn {
  display: none;
}

.reply-preview {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--primary-light);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  gap: 8px;
}

.reply-quote {
  background: rgba(0,0,0,0.06);
  border-left: 3px solid var(--primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
  margin-bottom: 6px;
  color: var(--text-secondary);
  word-break: break-word;
}

.reply-quote-thumb {
  display: block;
  max-height: 60px;
  max-width: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 4px;
  cursor: zoom-in;
}

.chat-message-actions {
  display: none;
  position: absolute;
  right: -30px;
  top: 50%;
  transform: translateY(-50%);
}

.chat-message:hover .chat-message-actions {
  display: flex;
}

.chat-message.sent .chat-message-actions {
  left: -30px;
  right: auto;
}

.msg-reply-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 4px;
  border-radius: 4px;
}

.msg-reply-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.chat-message {
  position: relative;
}

.chat-message-bubble {
  position: relative;
}

/* Photo send button */
.msg-photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1rem;
  transition: background var(--transition);
}

.msg-photo-btn:hover {
  background: var(--primary);
  color: white;
}

/* Photo message image */
.chat-msg-image-wrap {
  margin-bottom: 4px;
}

.chat-msg-image {
  max-width: 220px;
  max-height: 260px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.chat-message.sent .chat-msg-image {
  border-radius: 12px 4px 12px 12px;
}

.chat-message.received .chat-msg-image {
  border-radius: 4px 12px 12px 12px;
}

.chat-msg-text {
  display: block;
  word-break: break-word;
}

/* ============================================================
   PREVENT DOWNLOAD — Disable right-click context menu on
   thumbnails (via JS oncontextmenu on each img element).
   The video element uses controlslist="nodownload" attribute.
   ============================================================ */
.video-thumbnail img {
  -webkit-user-drag: none;
  user-drag: none;
}

/* ============================================================
   PLAYLIST PAGE
   ============================================================ */
.playlist-header {
  display: flex;
  gap: 24px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
  align-items: flex-start;
}

.playlist-cover {
  width: 180px;
  height: 120px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: white;
  flex-shrink: 0;
}

.playlist-meta h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.playlist-video-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg);
}

.playlist-index {
  width: 28px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}
