/* YouTube Trends - Custom Styles */

html {
  font-size: 14px;
  height: 100%;
  position: relative;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  margin-bottom: 0;
  background-color: #f8f9fa;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

main {
  flex: 1;
}

/* Focus styles */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #ff0000;
}

/* Custom utility classes */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Video card styles */
.video-card {
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.video-card .card-img-top {
  height: 140px;
  object-fit: cover;
  transition: transform 0.3s;
}

.video-card:hover .card-img-top {
  transform: scale(1.05);
}

/* Navigation */
.navbar-dark.bg-dark {
  background-color: #202020 !important;
  border-bottom: 3px solid #ff0000;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
}

/* Footer */
.footer.bg-dark {
  background-color: #202020 !important;
  border-top: 3px solid #ff0000;
}

/* Custom badges */
.badge-view-count {
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Loading animation */
.loading-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

/* Custom alerts */
.alert-api {
  border-left: 4px solid #ff0000;
  background-color: #fff5f5;
}

/* Search form */
.search-form .form-control-lg {
  border-radius: 50px;
  padding-left: 20px;
  padding-right: 20px;
}

.search-form .btn-lg {
  border-radius: 50px;
  padding-left: 30px;
  padding-right: 30px;
}

/* Trend sections */
.trend-section {
  border-left: 4px solid;
  padding-left: 15px;
  margin-bottom: 30px;
}

.trend-section.daily {
  border-left-color: #0d6efd;
}

.trend-section.weekly {
  border-left-color: #198754;
}

.trend-section.monthly {
  border-left-color: #0dcaf0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .video-card .card-img-top {
    height: 120px;
  }
  
  .display-4 {
    font-size: 2.5rem;
  }
}

/* Print styles */
@media print {
  .navbar, .footer, .btn, form {
    display: none !important;
  }
  
  .container {
    width: 100%;
    max-width: 100%;
  }
}

/* Accessibility improvements */
a:focus {
  outline: 2px solid #ff0000;
  outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Extra videos hidden by default */
.extra-video {
    display: none;
}

/* Comments section styles */
.comment-text.collapsed {
    max-height: 4.5em;
    overflow: hidden;
    position: relative;
}

.comment-text.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5em;
    background: linear-gradient(to bottom, transparent, white);
}

.comment-toggle {
    font-size: 0.875rem;
    color: #0d6efd;
    text-decoration: none;
    cursor: pointer;
}

.comment-toggle:hover {
    text-decoration: underline;
}

.list-group-item.list-group-item-action {
    transition: background-color 0.15s ease;
    border-left: 3px solid transparent;
}

.list-group-item.list-group-item-action:hover {
    background-color: #f8f9fa;
    border-left-color: #0d6efd;
}

.list-group-item.list-group-item-action:focus {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

/* Loading states */
#commentsLoading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Error state */
#commentsError .bi-exclamation-triangle {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* Empty state */
#commentsEmpty .bi-chat-square {
    opacity: 0.5;
}

/* Pagination accessibility */
.pagination .page-link:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Button states */
#loadCommentsBtn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

#loadCommentsBtn .bi-hourglass-split {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}