:root {
  --primary-color: #0f0f0f;
  --secondary-color: #1f1f1f;
  --text-color: #ffffff;
  --secondary-text: #aaaaaa;
  --border-color: #303030;
  --hover-color: #272727;
  --video-grid-gap: 16px;
}

/* Base styles */
body {
  background-color: var(--primary-color);
  color: var(--text-color);
  font-family: "Roboto", "Arial", sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  /* Prevent zoom and orientation issues */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* Prevent orientation changes */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  /* Prevent zoom on input focus */
  -webkit-tap-highlight-color: transparent;
}

/* Main content styles */
.main-content {
  width: 100%;
  padding: 24px;
  box-sizing: border-box;
}

/* Video grid styles */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--video-grid-gap);
  padding: 24px 0;
  margin-top: 76px;
  max-width: 1800px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 1400px) {
  .video-grid {
    grid-template-columns: repeat(4, minmax(300px, 1fr));
  }
}

@media (max-width: 1200px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(280px, 1fr));
  }
}

@media (max-width: 900px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 600px) {
  .video-grid {
    grid-template-columns: 1fr;
    padding: 8px 0;
    gap: 12px;
    margin-top: 68px; /* Adjust for smaller header */
  }
  .main-content {
    padding: 8px;
  }
  .video-card {
    padding: 0 0 16px 0;
    border-radius: 0;
    box-shadow: none;
    background: none;
  }
  .thumbnail {
    border-radius: 0;
    margin-bottom: 8px;
  }
  .video-info {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    padding: 0 4px;
  }
  .channel-avatar {
    width: 32px;
    height: 32px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .video-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .video-title {
    font-size: 15px;
    max-height: 40px;
    margin-bottom: 4px;
    order: 1; /* Title comes first in the details */
  }
  .channel-name {
    order: 2; /* Channel name comes second */
  }
  .video-stats {
    order: 3; /* Stats come last */
  }
  .channel-name, .video-stats {
    font-size: 13px;
    margin-bottom: 2px;
  }
}

@media (max-width: 480px) {
  .video-grid {
    margin-top: 64px; /* Adjust for even smaller header */
  }
}

.video-card {
  cursor: pointer;
  transition: transform 0.2s;
  width: 100%;
  max-width: 100%;
}

.video-card:hover {
  transform: scale(1.02);
}

.thumbnail {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--secondary-color);
  margin-bottom: 12px;
}

.thumbnail img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 3px 4px;
  border-radius: 4px;
  font-size: 12px;
}

.video-info {
  display: flex;
  gap: 12px;
  padding: 0;
  width: 100%;
}

.channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #1f1f1f;
  flex-shrink: 0;
}

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

.video-details {
  flex: 1;
  min-width: 0; /* Prevents flex item from overflowing */
}

.video-title {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  max-height: 44.8px;
}

.channel-name, .video-stats {
  font-size: 14px;
  color: var(--secondary-text);
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Loading spinner */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 24px;
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Header styles */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    min-width: 160px;
}

.logo-container a {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 16px;
}

.logo-container img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.app-name {
    color: #ffffff;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: 1px;
    font-family: serif;
    text-transform: uppercase;
    position: relative;
}

.app-name::after {
    content: '°';
    position: absolute;
    top: -5px;
    right: -12px;
    font-size: 16px;
}

.search-container {
    flex: 0 1 728px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 640px;
}

.search-form {
    display: flex;
    height: 40px;
    width: 100%;
}

.search-input {
  flex: 1;
  padding: 0 16px;
  height: 100%;
  border: 1px solid var(--border-color);
  border-radius: 40px 0 0 40px;
  background-color: var(--secondary-color);
  color: var(--text-color);
  font-size: 16px;
  outline: none;
  /* Prevent zoom on mobile */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Prevent zoom on focus */
  font-size: 16px !important;
  /* Improve mobile input */
  -webkit-appearance: none;
  appearance: none;
  border-radius: 40px 0 0 40px;
}

.search-input:focus {
    border-color: #1c62b9;
}

.search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 100%;
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 40px 40px 0;
    background-color: var(--secondary-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-button:hover {
    background-color: var(--hover-color);
}

.search-button i {
    color: var(--text-color);
}

/* Add a right spacer to balance the header */
.header::after {
    content: '';
    min-width: 160px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }
    
    .search-container {
        margin: 0 12px;
        flex: 1;
        max-width: 400px;
    }
    
    .logo-container {
        min-width: 100px;
    }
    
    .logo-container img {
        height: 28px;
    }
    
    .header::after {
        min-width: 100px;
    }
    
    .app-name {
        font-size: 18px;
    }
    
    .app-name::after {
        font-size: 12px;
        top: -3px;
        right: -8px;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 0 8px;
        height: 52px;
    }
    
    .search-container {
        margin: 0 8px;
        flex: 1;
        max-width: none;
    }
    
    .search-form {
        height: 36px;
    }
    
    .search-input {
        font-size: 14px;
        padding: 0 12px;
    }
    
    .search-button {
        width: 48px;
    }
    
    .logo-container {
        min-width: 80px;
    }
    
    .logo-container img {
        height: 24px;
    }
    
    .header::after {
        min-width: 80px;
    }
    
    .app-name {
        font-size: 16px;
        display: none; /* Hide text on very small screens */
    }
    
    .app-name::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 6px;
        height: 48px;
    }
    
    .search-container {
        margin: 0 6px;
    }
    
    .search-form {
        height: 32px;
    }
    
    .search-input {
        font-size: 13px;
        padding: 0 10px;
    }
    
    .search-button {
        width: 40px;
    }
    
    .search-button i {
        font-size: 18px;
    }
    
    .logo-container {
        min-width: 60px;
    }
    
    .logo-container img {
        height: 20px;
    }
    
    .header::after {
        min-width: 60px;
    }
}

/* Adjust main content for header */
.video-detail-container {
    margin-top: 76px;
}

@media (max-width: 600px) {
    .video-detail-container {
        margin-top: 68px;
    }
}

@media (max-width: 480px) {
    .video-detail-container {
        margin-top: 64px;
    }
}

/* Error message */
.error-message {
    background-color: #dc3545;
    color: white;
    padding: 12px;
    border-radius: 4px;
    margin: 20px 0;
    text-align: center;
} 