/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

/* Instagram-style modal animations */
@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(100%);
  }
}

.animate-slide-up {
  animation: slide-up 0.3s ease-out;
  transform: translateY(0);
}

.animate-slide-down {
  animation: slide-down 0.3s ease-out;
  transform: translateY(100%);
}

/* Comment modal base styles */
#comments-modal {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#comments-modal .modal-content {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* Desktop modal - centered like before */
@media (min-width: 769px) {
  #comments-modal .modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 95%;
    max-width: 1200px;
    height: 85vh;
    max-height: 800px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #comments-modal .modal-content.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  /* Comments list area - scrollable */
  #comments-modal .custom-scrollbar {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    max-height: calc(85vh - 200px);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
  }

  /* Content area - ensure proper layout */
  #comments-modal .bg-white {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  #comments-modal .custom-scrollbar::-webkit-scrollbar {
    width: 6px;
  }

  #comments-modal .custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }

  #comments-modal .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
  }

  #comments-modal .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }

  /* Comment input section - fixed at bottom */
  #comments-modal .border-t {
    flex-shrink: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 16px 24px;
    display: flex !important;
    align-items: center;
    min-height: 80px;
    max-height: 80px;
    z-index: 10;
    position: sticky;
    bottom: 0;
    width: 100%;
  }

  /* Comment input styling - Instagram style */
  #comments-modal input[type="text"] {
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 25px;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    flex: 1;
    margin-right: 12px;
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  #comments-modal input[type="text"]:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
    background-color: white;
  }

  #comments-modal button[type="submit"] {
    padding: 12px;
    border-radius: 50%;
    transition: all 0.2s ease;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
  }

  #comments-modal button[type="submit"]:hover {
    background-color: #f3f4f6;
    transform: scale(1.05);
  }

  #comments-modal button[type="submit"]:active {
    transform: scale(0.95);
  }

  /* Desktop header styling - force dark header */
  #comments-modal .modal-content > div:first-child {
    background: #1f2937 !important;
    border-radius: 16px 16px 0 0 !important;
  }

  #comments-modal .modal-content > div:first-child h3 {
    color: white !important;
  }

  #comments-modal .modal-content > div:first-child button {
    color: #d1d5db !important;
  }

  #comments-modal .modal-content > div:first-child button:hover {
    color: white !important;
    background-color: #374151 !important;
  }

  /* Desktop comment styling */
  #comments-modal .comment-item {
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
  }

  #comments-modal .comment-item:not(:last-child) {
    margin-bottom: 8px;
  }

  #comments-modal .comment-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
  }

  #comments-modal .comment-item .text-base {
    font-size: 16px;
    line-height: 1.5;
  }

  #comments-modal .comment-item .text-sm {
    font-size: 14px;
  }

  /* Desktop reply styling */
  #comments-modal .replies .comment-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    margin-left: 32px;
    margin-top: 8px;
  }

  #comments-modal .replies .comment-item:hover {
    background: #f8fafc;
  }

  /* Reply form styling */
  #comments-modal .reply-form {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
  }

  #comments-modal .reply-form form {
    background: transparent;
    border: none;
    padding: 0;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  #comments-modal .reply-form input[type="text"] {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 25px;
    padding: 10px 16px;
    font-size: 14px;
    flex: 1;
    transition: all 0.2s ease;
  }

  #comments-modal .reply-form input[type="text"]:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
    background-color: white;
  }

  #comments-modal .reply-form button[type="submit"] {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #comments-modal .reply-form button[type="submit"]:hover {
    background-color: #f3f4f6;
    transform: scale(1.05);
  }

  #comments-modal .reply-form button[type="button"] {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    transition: all 0.2s ease;
    font-size: 13px;
  }

  #comments-modal .reply-form button[type="button"]:hover {
    background-color: #f3f4f6;
  }
}

/* Mobile modal - Instagram style from bottom */
@media (max-width: 768px) {
  #comments-modal .modal-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    width: 100%;
    height: calc(70vh + 40px);
    border-radius: 24px 24px 0 0;
    opacity: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 16px;
  }

  #comments-modal .modal-content.show {
    transform: translateY(0);
    opacity: 1;
  }

  #comments-modal .modal-content .bg-white {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  #comments-modal .custom-scrollbar {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    padding-bottom: 20px;
  }

  /* Mobile comments list container */
  #comments-modal .custom-scrollbar > div {
    padding-bottom: 20px;
  }

  /* Mobile comment input styling */
  #comments-modal .border-t {
    flex-shrink: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 16px 20px;
    margin-top: 12px;
    margin-bottom: 32px;
    display: flex !important;
    align-items: center;
    min-height: 60px;
    max-height: 60px;
    z-index: 10;
    position: sticky;
    bottom: 0;
    width: 100%;
    border-radius: 0 0 24px 24px;
  }

  /* Mobile input styling */
  #comments-modal input[type="text"] {
    font-size: 14px;
    padding: 12px 16px;
    border-radius: 20px;
    flex: 1;
    margin-right: 8px;
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  #comments-modal button[type="submit"] {
    padding: 10px;
    min-width: 40px;
    min-height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
  }

  /* Mobile reply form styling */
  #comments-modal .reply-form {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
  }

  #comments-modal .reply-form form {
    background: transparent;
    border: none;
    padding: 0;
    margin: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  #comments-modal .reply-form input[type="text"] {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    transition: all 0.2s ease;
  }

  #comments-modal .reply-form input[type="text"]:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
    background-color: white;
  }

  #comments-modal .reply-form button[type="submit"] {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #comments-modal .reply-form button[type="submit"]:hover {
    background-color: #f3f4f6;
    transform: scale(1.05);
  }

  #comments-modal .reply-form button[type="button"] {
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: 16px;
    transition: all 0.2s ease;
    font-size: 12px;
  }

  #comments-modal .reply-form button[type="button"]:hover {
    background-color: #f3f4f6;
  }

  #comments-modal .custom-scrollbar::-webkit-scrollbar {
    width: 6px;
  }

  #comments-modal .custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }

  #comments-modal .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
  }

  #comments-modal .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }

  /* Mobile comment styling - add visual separation */
  #comments-modal .comment-item {
    margin-bottom: 16px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
  }

  /* Last comment spacing */
  #comments-modal .comment-item:last-child {
    margin-bottom: 24px;
  }

  #comments-modal .comment-item:not(:last-child) {
    margin-bottom: 12px;
  }

  #comments-modal .comment-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  }

  /* Mobile reply styling */
  #comments-modal .replies .comment-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    margin-left: 20px;
    margin-top: 12px;
    margin-bottom: 8px;
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
  }

  /* Mobile reply connector line */
  #comments-modal .replies .comment-item::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #e2e8f0, transparent);
  }

  #comments-modal .replies .comment-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
  }

  /* Mobile comment spacing and typography */
  #comments-modal .comment-item .text-base {
    font-size: 15px;
    line-height: 1.5;
  }

  #comments-modal .comment-item .text-sm {
    font-size: 13px;
  }

  /* Mobile comment actions spacing */
  #comments-modal .comment-item .flex.items-center.space-x-3 {
    margin-top: 8px;
  }

  #comments-modal .comment-item .flex.items-center.space-x-4 {
    margin-top: 8px;
  }

  /* Mobile comment avatar styling */
  #comments-modal .comment-item .flex-shrink-0 img,
  #comments-modal .comment-item .flex-shrink-0 div {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  /* Mobile button styling - larger touch targets */
  #comments-modal .comment-item button {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
  }

  #comments-modal .comment-item button:hover {
    background-color: #f3f4f6;
    transform: scale(1.02);
  }

  /* Mobile Reply button styling */
  #comments-modal .comment-item button[data-action*="showReplyForm"] {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    font-weight: 500;
    min-height: 44px;
    padding: 8px 16px;
  }

  #comments-modal .comment-item button[data-action*="showReplyForm"]:hover {
    background-color: #f8fafc;
    border-color: #d1d5db;
    color: #374151;
  }

  /* Mobile Delete button styling */
  #comments-modal .comment-item button[data-action*="deleteComment"] {
    background: transparent;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-weight: 500;
    min-height: 44px;
    padding: 8px 16px;
  }

  #comments-modal .comment-item button[data-action*="deleteComment"]:hover {
    background-color: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
  }

  /* Mobile like button styling */
  #comments-modal .comment-item button[data-action*="toggleLike"] {
    min-height: 44px;
    min-width: 44px;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #comments-modal .comment-item button[data-action*="toggleLike"]:hover {
    background-color: #f3f4f6;
    transform: scale(1.05);
  }

  /* Mobile reply form buttons */
  #comments-modal .reply-form button {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
  }

  #comments-modal .reply-form button[type="submit"] {
    min-height: 44px;
    min-width: 44px;
    padding: 8px;
    border-radius: 50%;
  }

  /* Extra small screens - ensure proper scrolling */
  @media (max-width: 480px) {
    #comments-modal .modal-content {
      height: calc(75vh + 40px);
    }

    #comments-modal .custom-scrollbar {
      padding-bottom: 30px;
    }

    #comments-modal .custom-scrollbar > div {
      padding-bottom: 30px;
    }

    #comments-modal .comment-item:last-child {
      margin-bottom: 30px;
    }

    #comments-modal .border-t {
      margin-top: 12px;
      margin-bottom: 32px;
    }
  }
}

/* Video Player Component Styles */
.video-modal {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.video-fullscreen-container {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.video-player-loading {
  position: relative;
}

.video-player-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  z-index: 10;
}

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

/* Likes Modal Styles */
@keyframes modal-in {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-modal-in {
  animation: modal-in 0.2s ease-out;
}

/* Custom scrollbar for modal */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.3);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.5);
}

/* Play button hover effects */
.video-play-button {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.video-play-button:hover {
  transform: scale(1.1);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.video-play-button:active {
  transform: scale(0.95);
}

/* Card hover effects */
.video-card:hover .video-play-button {
  transform: scale(1.05);
}

/* Modal animations */
.video-modal.show {
  opacity: 1;
  visibility: visible;
}

.video-modal.show .video-modal-content {
  transform: scale(1);
  opacity: 1;
}

.video-modal-content {
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 90vh;
  max-width: 90vw;
}

/* Responsive video containers */
@media (max-width: 768px) {
  .video-modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
}

/* Like Modal Styles */
#like-modal {
  transition: opacity 0.3s ease-in-out;
}

#like-modal:not(.hidden) {
  opacity: 1;
}

#like-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

#like-modal .bg-white {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal backdrop click animation */
#like-modal .bg-black {
  transition: opacity 0.3s ease-in-out;
}

/* Button hover effects */
#like-modal button {
  transition: all 0.2s ease-in-out;
}

#like-modal button:hover {
  transform: translateY(-1px);
}

#like-modal button:active {
  transform: translateY(0);
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0;
  }
  10%,
  90% {
    opacity: 1;
  }
}

/* Smooth aspect ratio transitions */
.aspect-video {
  transition: all 0.3s ease;
}

/* Error state styles */
.video-error {
  background: linear-gradient(45deg, #ef4444, #dc2626);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.video-error-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.8;
}

/* Focus styles for accessibility */
.video-play-button:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.video-modal:focus-within {
  outline: none;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .video-play-button,
  .video-modal-content,
  .aspect-video {
    transition: none;
  }

  .video-play-button:hover {
    transform: none;
  }

  @keyframes spin {
    to {
      transform: none;
    }
  }

  @keyframes fadeInOut {
    0%,
    100% {
      opacity: 0;
    }
    50% {
      opacity: 1;
    }
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .video-play-button {
    border: 2px solid currentColor;
  }

  .video-modal {
    backdrop-filter: none;
    background: rgba(0, 0, 0, 0.9);
  }
}

/* Print styles - hide video players */
@media print {
  .video-modal,
  .video-fullscreen-container,
  .video-play-button {
    display: none !important;
  }
}
