/* CodeMirror styles now centralized in foundation/global-base.css */

/* Preserve monospace for any code-related elements */
.tikz-app pre, .tikz-app code, .tikz-app .code, .tikz-app .tikz-code, .tikz-app textarea[name="code"] {
    font-family: var(--font-family-mono);
    font-feature-settings: "liga" 1, "calt" 1;
    font-variant-ligatures: contextual;
}

/* Files Section Container - Unified Container Styles for Consistent Sizing */
.tikz-app .files-section-container {
    margin-top: var(--spacing-20);
    background-color: var(--container-bg-secondary);
    backdrop-filter: var(--container-bg-blur);
    padding: var(--container-padding-md);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: var(--container-max-width);
    margin-left: auto;
    margin-right: auto;
}

/* Files Section Title */
.tikz-app .files-section-title {
    color: #1976d2;
    margin-bottom: 24px;
}

/* Files Grid */
.tikz-app .files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
  padding: 0;
  list-style: none;
}

/* Individual File Card */
.tikz-app .file-card {
  position: relative;
  min-height: 260px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 8%);
  transition: transform 0.2s ease, width 0.3s ease;
  overflow: visible; /* Allow modal to appear outside card bounds */
}

.tikz-app .file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(0 0 0 / 12%);
}

/* Image Section */
.tikz-app .file-img-container {
  position: relative;
  overflow: visible;
  border-radius: 10px;
  background: #fff;
  min-height: 180px;
  width: 100%;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.tikz-app .file-img-container:hover {
  opacity: 0.9;
}

.tikz-app .file-img-container img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  display: block;
  background-color: #fff;
  transition: transform 0.3s ease;
  pointer-events: none; /* Prevent img from being the target, always use container */
}

/* Interaction Buttons Row - Below image */
.tikz-app .interaction-buttons-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* Like Button Wrapper */
.tikz-app .like-button-wrapper {
    display: flex;
    align-items: center;
}

/* Comment Count Wrapper */
.tikz-app .comment-count-wrapper {
    display: flex;
    align-items: center;
}

.tikz-app .comment-count-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tikz-app .comment-count-link:hover {
    background: rgba(255, 255, 255, 1);
    color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.tikz-app .comment-count-link i {
    font-size: 16px;
}

.tikz-app .comment-count {
    font-size: 13px;
    line-height: 1;
}

/* .file-card:hover .file-img-container img {
  transform: scale(1.03);
} */

/* 
 * ===== CSS SPECIFICITY REFACTORING COMPLETED =====
 * 
 * SOLUTION: Loại bỏ !important bằng cách tăng CSS specificity tự nhiên
 * 
 * HIERARCHY MỚI:
 * 1. Desktop hover: .tikz-app:not(.mobile-device) .file-card:not(.menu-open):hover .file-action-container
 *    Specificity: (0,0,5,0) = 50
 * 
 * 2. Mobile menu-open: .tikz-app.mobile-device .file-card.menu-open .file-action-container  
 *    Specificity: (0,0,5,0) = 50 (same as desktop, but cascade order wins)
 * 
 * 3. Mobile buttons: .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn.individual-active
 *    Specificity: (0,0,6,0) = 60 > Desktop (50) ✅ WINS WITHOUT !important
 * 
 * KẾT QUẢ: ZERO !important declarations needed ✅
 * 
 * JAVASCRIPT INTEGRATION COMPLETED:
 * 1. Device Detection: ✅ Add 'mobile-device' class to .tikz-app when on mobile
 * 2. Menu State: ✅ Add 'menu-open' class to .file-card when action menu is opened
 * 3. Removed legacy: ✅ Replaced 'is-touch' and 'active' class logic
 * 
 * Example JavaScript Integration:
 * document.querySelector('.tikz-app').classList.add('mobile-device');
 * fileCard.classList.add('menu-open');
 */

/* Overlay Action Menu - Base State */
.tikz-app .file-action-container {
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px);
  transition: opacity 0.3s, transform 0.3s;
  position: absolute;
  left: 12px;
  top: 60px;
  z-index: 300;
}

/* Desktop hover logic - chỉ áp dụng khi KHÔNG có class menu-open */
@media (hover: hover) and (pointer: fine) {
  .tikz-app:not(.mobile-device) .file-card:not(.menu-open):hover .file-action-container,
  .tikz-app:not(.mobile-device) .file-card:not(.menu-open) .file-action-container:hover,
  .tikz-app:not(.mobile-device) .file-card:not(.menu-open) .file-img-container:hover + .file-action-container {
    display: block;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }
}

/* Mobile/Touch: Hiện khi card có class menu-open - SOLUTION: High Specificity */
/* 
 * GIẢI PHÁP ĐÃ REFACTOR:
 * - Tăng specificity từ (0,0,3,0)=30 lên (0,0,6,0)=60
 * - Cao hơn desktop hover (0,0,5,0)=50 ⟹ KHÔNG CẦN !important
 * - Sử dụng .mobile-device.menu-open để tăng specificity tự nhiên
 */
.tikz-app.mobile-device .file-card.menu-open .file-action-container {
  display: block;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  z-index: 999;
}

/* Action Toggle Button - Ẩn mặc định, chỉ hiện trên mobile */
.tikz-app .action-toggle-btn {
  display: none; /* Ẩn mặc định trên tất cả devices */
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 200;
  border: none;
  background: rgb(255 255 255 / 95%);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
  transition: all 0.2s ease;
  color: #333;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Desktop: Đảm bảo nút toggle KHÔNG hiện */
@media (hover: hover) and (pointer: fine) {
  .tikz-app:not(.mobile-device) .action-toggle-btn {
    display: none; /* Force ẩn trên desktop */
  }
}

.tikz-app .action-toggle-btn:hover {
  background: rgb(255 255 255 / 100%);
  box-shadow: 0 4px 12px rgb(0 0 0 / 25%);
  transform: scale(1.05);
}

.tikz-app .action-toggle-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgb(0 0 0 / 20%);
}

/* Enhanced mobile detection - sync with JavaScript */
@media (hover: none), (pointer: coarse) {
  .tikz-app.mobile-device .action-toggle-btn {
    display: block;
  }

  /* Vô hiệu hóa hover trên mobile - SOLUTION: Higher specificity - EXCLUDE menu-open cards */
  .tikz-app.mobile-device .file-card:not(.menu-open):hover .file-action-container,
  .tikz-app.mobile-device .file-card:not(.menu-open) .file-action-container:hover,
  .tikz-app.mobile-device .file-card:not(.menu-open) .file-img-container:hover + .file-action-container {
    display: none;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
  }
}

/* Additional mobile detection using JavaScript classes - SOLUTION: High Specificity */
/* 
 * GIẢI PHÁP ĐÃ REFACTOR:
 * - Sử dụng .mobile-device class thay vì .is-touch để consistency
 * - Tăng specificity tự nhiên ⟹ KHÔNG CẦN !important  
 * - Loại bỏ debug styles
 * - CHỈ HIỆN TRÊN MOBILE: Kết hợp với media query
 */
@media (hover: none), (pointer: coarse) {
  .tikz-app.mobile-device .file-card .action-toggle-btn {
    display: block;
  }
}

/* Consolidated mobile hover disable rules - EXCLUDE menu-open cards */
.tikz-app.mobile-device .file-card:not(.menu-open):hover .file-action-container,
.tikz-app.mobile-device .file-card:not(.menu-open) .file-action-container:hover,
.tikz-app.mobile-device .file-card:not(.menu-open) .file-img-container:hover + .file-action-container {
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px);
}

.tikz-app .file-action-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
  width: auto;
}

.tikz-app .file-action-item {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

/* Button Styling */
.tikz-app .Btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 35px;
  height: 35px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 2px 2px 10px rgb(0 0 0 / 19.9%);
  background: linear-gradient(-50deg, rgb(39 107 255), rgb(112 186 255), rgb(39 107 255));
  background-size: 250%;
  background-position: left;
  min-width: 35px;
  flex-shrink: 0;
}

/* Icon container */
.tikz-app .sign {
  width: 45px;
  height: 45px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 4px;
  flex-shrink: 0;
  z-index: 2;
  position: relative;
}

.tikz-app .sign svg {
  width: 18px;
  height: 18px;
}

.tikz-app .sign svg path {
  fill: white;
}

.tikz-app .logoIcon {
  color: white;
  font-size: 16px;
}

/* Text label */
.tikz-app .text {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  opacity: 0;
  color: white;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-align: left;
  padding-left: 12px;
  z-index: 1;
}

/* Desktop hover effect */
.tikz-app .Btn:hover {
  width: 140px;
  border-radius: 20px;
  background-position: right;
}

.tikz-app .Btn:hover .text {
  opacity: 1;
  width: auto;
  max-width: 85px;
  color: #fff;
  text-shadow: 0 1px 2px rgb(0 0 0 / 30%);
}

/* Mobile button states - SOLUTION: High specificity selector chains */
@media (hover: none), (pointer: coarse) {
  /* Active button states - Specificity: (0,0,6,0) = 60 */
  .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn.individual-active,
  .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn.ready-to-execute,
  .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn.mobile-hover {
    background: linear-gradient(-50deg, rgb(39 107 255), rgb(112 186 255), rgb(39 107 255));
    background-position: right;
    width: 120px;
    border-radius: 20px;
    transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 4px 12px rgb(25 118 210 / 30%);
  }

  /* Active button text states - Specificity: (0,0,7,0) = 70 */
  .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn.individual-active .text,
  .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn.ready-to-execute .text,
  .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn.mobile-hover .text {
    opacity: 1;
    width: auto;
    max-width: 85px;
    color: #fff;
    text-shadow: 0 1px 2px rgb(0 0 0 / 30%);
  }

  /* Inactive button states - Specificity: (0,0,6,0) = 60 */
  .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn:not(.individual-active, .ready-to-execute, .mobile-hover) {
    background: linear-gradient(-50deg, rgb(39 107 255), rgb(112 186 255), rgb(39 107 255));
    width: 35px;
    border-radius: 50%;
  }

  /* Inactive button text states - Specificity: (0,0,7,0) = 70 */
  .tikz-app.mobile-device .file-card.menu-open .file-action-container .Btn:not(.individual-active, .ready-to-execute, .mobile-hover) .text {
    opacity: 0;
    width: 0;
    max-width: 0;
    color: #fff;
    text-shadow: 0 1px 2px rgb(0 0 0 / 30%);
  }
}

/* JavaScript mobile detection - REMOVED: All legacy .is-touch rules replaced with .mobile-device */

/* File Info Styling */
.tikz-app .file-info {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-top: 0;
    font-size: 13px;
    color: #555;
}

.tikz-app .file-meta {
    margin-bottom: 6px;
    font-weight: 400;
}

.tikz-app .file-meta .label {
    font-weight: 500;
    color: #333;
}

.tikz-app .file-creator {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 400;
}

/* Like Button Styles - Rounded pill style matching comment count */
.tikz-app input[id^="heart-"] {
    display: none;
}

.tikz-app .like-button {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    border: none;
    overflow: visible;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.tikz-app .like-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.tikz-app .like-button input[type="checkbox"] {
    display: none;
}

.tikz-app .like {
    display: flex;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
}

/* Like count container for animation */
.tikz-app .like-count-container {
    position: relative;
    display: inline-block;
    min-width: 16px;
    text-align: center;
}

.tikz-app .like-icon {
    fill: #808080;
    height: 16px;
    width: 16px;
    transition: fill 0.2s ease;
}

.tikz-app .like-count {
    color: #666;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    line-height: 1;
}

.tikz-app .like-count.two {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transform: translateY(20px);
    opacity: 0;
}

.tikz-app .like-count.one {
    position: relative;
    display: block;
}

.tikz-app input[id^="heart-"]:checked ~ .like .like-icon {
    fill: #ff4757;
    animation: heart-beat 0.3s ease;
}

.tikz-app input[id^="heart-"]:checked ~ .like .like-count.one {
    transform: translateY(-20px);
    opacity: 0;
}

.tikz-app input[id^="heart-"]:checked ~ .like .like-count.two {
    transform: translateY(0);
    opacity: 1;
    color: #ff4757;
}

/* Like button hover when liked */
.tikz-app input[id^="heart-"]:checked ~ .like-button:hover {
    color: #ff4757;
}

@keyframes heart-beat {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* ===== LIKES PREVIEW TEXT STYLES ===== */

.tikz-app .likes-preview-text {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    padding: 8px 12px;
    max-width: 100%;
    overflow: hidden;
    background: rgba(248, 249, 250, 0.9);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.tikz-app .likes-preview-content {
    color: #333;
    display: inline;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.tikz-app .likes-view-all-btn {
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.tikz-app .likes-view-all-btn:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* TikZ Code Section Styles */
.tikz-app .tikz-code-block {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 10px;
    width: 100%;
    display: none; /* Hidden by default, JavaScript will show when needed */
}

.tikz-app .tikz-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 5px 5px 0 0;
    font-weight: bold;
    color: #333;
}

/* Copy button styling for TikZ Code Section - Synchronized with index.css */
.tikz-app .tikz-code-header .copy-btn {
    background: linear-gradient(90deg, #1976d2 0%, #2196f3 100%);
    color: #fff;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tikz-app .tikz-code-header .copy-btn:hover {
    background: linear-gradient(90deg, #1565c0 0%, #42a5f5 100%);
    color: #fff;
    box-shadow: 0 3px 12px rgb(25 118 210 / 15%);
    transform: translateY(-1px) scale(1.02);
    outline: none;
    text-decoration: none;
}

.tikz-app .tikz-code-block .code-block {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    overflow: auto;
    max-height: 400px;
    position: relative;
    width: 100%;
}

.tikz-app .tikz-cm {
    width: 100%;
    min-height: 100px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 8px;
    resize: vertical;
}

/* CodeMirror styles cho TikZ code block */
.tikz-app .tikz-code-block .CodeMirror {
    max-height: 300px;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
    width: 100%;
}

.tikz-app .tikz-code-block .tikz-cm {
    display: none;
}

/* CodeMirror placeholder and gutter styles now centralized in index.css */

/* Tùy chỉnh scrollbar cho CodeMirror */
.tikz-app .tikz-code-block .CodeMirror-scrollbar-filler {
    background-color: #f0f0f0;
}

.tikz-app .tikz-code-block .CodeMirror-simplescroll-horizontal div,
.tikz-app .tikz-code-block .CodeMirror-simplescroll-vertical div {
    background-color: #c1c1c1;
    border-radius: 10px;
}

/* No Files State */
.tikz-app .no-files {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px dashed #dee2e6;
    margin: 20px 0;
}

.tikz-app .no-files-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.tikz-app .no-files h4 {
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 600;
}

.tikz-app .no-files p {
    color: #868e96;
    margin: 0;
    font-size: 14px;
}

/* Back link for search results page */
.tikz-app .no-files .back-link {
    margin-top: 10px;
    font-size: 0.9rem;
}

.tikz-app .no-files .back-link a {
    color: #1976d2;
    text-decoration: none;
}

.tikz-app .no-files .back-link a:hover {
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (width <= 768px) {
  .tikz-app .files-section-container {
      padding: 20px 0;
      margin-top: 30px;
  }

  .tikz-app .files-section {
      margin-top: 20px;
      padding: 15px;
  }

  .tikz-app .files-grid {
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 12px;
  }

  .tikz-app .file-card {
      width: 100%;
      min-width: 0;
  }

  /* Copy button mobile optimization */
  .tikz-app .tikz-code-header .copy-btn {
      padding: 6px 12px;
      font-size: 13px;
      border-radius: 5px;
  }

  .tikz-app .file-actions {
      flex-direction: column;
      gap: 8px;
  }

  .tikz-app .file-actions a, .file-actions button {
      padding: 8px 12px;
      font-size: 12px;
      min-height: 36px;
  }
}

@media (width <= 600px) {
  .tikz-app .files-grid {
      grid-template-columns: 1fr;
      gap: 15px;
  }

  .tikz-app .file-card {
      width: 100%;
      min-width: 0;
  }
}

@media (width <= 480px) {
  .tikz-app .files-section-container {
      padding: 15px 0;
      margin-top: 25px;
  }

  .tikz-app .files-section {
      margin-top: 15px;
      padding: 10px;
  }

  .tikz-app .files-grid {
      gap: 10px;
  }

  .tikz-app .file-card {
      width: 100%;
      min-width: 0;
  }
}

/* ===== LIKES MODAL STYLES ===== */

/* Modal Base - Contained within file card */
.tikz-app .likes-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.tikz-app .likes-modal.active {
    display: flex;
}

/* Modal Overlay - Contained within file card */
.tikz-app .likes-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    animation: fade-in 0.2s ease;
    box-sizing: border-box;
    border-radius: 10px;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Content */
.tikz-app .likes-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    max-width: 95%;
    width: 240px;
    max-height: 70%;
    display: flex;
    flex-direction: column;
    animation: slide-up 0.3s ease;
    overflow: hidden;
    min-width: 200px;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header - Compact design */
.tikz-app .likes-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e5e5;
    background: #fafafa;
    min-height: 40px;
}

.tikz-app .likes-modal-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tikz-app .likes-modal-title i {
    color: #ff4757;
    font-size: 14px;
    flex-shrink: 0;
}

.tikz-app .likes-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 8px;
}

.tikz-app .likes-modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Modal Body */
.tikz-app .likes-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

/* Loading State */
.tikz-app .likes-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
}

.tikz-app .likes-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e5e5;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

/* Users List */
.tikz-app .likes-users-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tikz-app .likes-user-item {
    border-bottom: 1px solid #f0f0f0;
}

.tikz-app .likes-user-item:last-child {
    border-bottom: none;
}

.tikz-app .likes-user-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}

.tikz-app .likes-user-link:hover {
    background-color: #f8f8f8;
}

/* User Avatar */
.tikz-app .likes-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tikz-app .likes-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid #ddd;
}

.tikz-app .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: 600;
}

/* User Info */
.tikz-app .likes-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tikz-app .likes-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.tikz-app .likes-user-time {
    font-size: 12px;
    color: #999;
}

/* Empty State */
.tikz-app .likes-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.tikz-app .likes-empty p {
    margin: 0;
    font-size: 14px;
}

/* Error State */
.tikz-app .likes-error {
    text-align: center;
    padding: 40px 20px;
}

.tikz-app .likes-error p {
    margin: 0 0 16px 0;
    color: #d32f2f;
    font-size: 14px;
}

.tikz-app .retry-btn {
    background-color: #1976d2;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.tikz-app .retry-btn:hover {
    background-color: #1565c0;
}

/* Modal Footer */
.tikz-app .likes-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: center;
}

.tikz-app .load-more-btn {
    background-color: #f5f5f5;
    color: #333;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tikz-app .load-more-btn:hover:not(:disabled) {
    background-color: #e5e5e5;
}

.tikz-app .load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Body scroll lock when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Mobile Responsive - Contained modal */
@media (max-width: 768px) {
    .tikz-app .likes-modal {
        padding: 12px;
    }

    .tikz-app .likes-modal-overlay {
        border-radius: 10px;
    }

    .tikz-app .likes-modal-content {
        max-width: 95%;
        width: 100%;
        max-height: 80%;
        border-radius: 10px;
        animation: slide-up-mobile 0.3s ease;
    }

    @keyframes slide-up-mobile {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .tikz-app .likes-modal-header,
    .tikz-app .likes-user-link,
    .tikz-app .likes-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .tikz-app .likes-modal-content {
        background: #1e1e1e;
    }

    .tikz-app .likes-modal-header {
        background: #252525;
        border-bottom-color: #333;
    }

    .tikz-app .likes-modal-title {
        color: #e5e5e5;
    }

    .tikz-app .likes-modal-close {
        color: #999;
    }

    .tikz-app .likes-modal-close:hover {
        background-color: #333;
        color: #e5e5e5;
    }

    .tikz-app .likes-user-link:hover {
        background-color: #252525;
    }

    .tikz-app .likes-user-name {
        color: #e5e5e5;
    }

    .tikz-app .likes-user-time {
        color: #888;
    }

    .tikz-app .likes-modal-footer {
        border-top-color: #333;
    }

    .tikz-app .load-more-btn {
        background-color: #2a2a2a;
        color: #e5e5e5;
    }

    .tikz-app .load-more-btn:hover:not(:disabled) {
        background-color: #333;
    }
}
