/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e293b;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3b82f6, #0ea5e9);
  border-radius: 4px;
  border: 2px solid #1e293b;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2563eb, #0284c7);
}

* {
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 #1e293b;
}

/* Smooth animations */
.scrollbar-thin::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

/* Focus ring colors */
input:focus, button:focus {
  outline: none;
}

/* Custom selection */
::selection {
  background-color: #3b82f680;
  color: #ffffff;
}

/* Loading skeleton */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.skeleton {
  animation: shimmer 2s infinite linear;
  background: linear-gradient(to right, #1e293b 4%, #334155 25%, #1e293b 36%);
  background-size: 1000px 100%;
}

/* Hover effects */
.hover-lift {
  transition: transform 0.2s ease-out;
}

.hover-lift:hover {
  transform: translateY(-2px);
}

/* Fade animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Progress bar animations */
@keyframes progressPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.animate-slide-up {
  animation: slideUp 0.3s ease-out;
}

/* Progress bar glow effect */
#progressContainer [id^="progress-bar-"] {
  box-shadow: 0 0 10px currentColor;
  animation: progressPulse 1.5s ease-in-out infinite;
}

/* Responsive utilities */
@media (max-width: 640px) {
  .backdrop-blur-xl {
    backdrop-filter: blur(16px);
  }
  
  /* Show action buttons on mobile without hover */
  .group .opacity-0 {
    opacity: 1 !important;
  }
  
  /* Make action buttons touch-friendly */
  .group button {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Tablet responsive */
@media (min-width: 641px) and (max-width: 1023px) {
  /* Action buttons visible on tap/touch */
  .group:active .opacity-0 {
    opacity: 1 !important;
  }
}

/* Glass morphism effect enhancement */
.backdrop-blur-xl {
  background-color: rgba(15, 23, 42, 0.7);
}

/* Prevent double-tap zoom on mobile */
* {
  touch-action: manipulation;
}

/* Make tables scrollable on mobile */
table {
  touch-action: pan-y;
}

/* Clickable elements should allow tap */
button, a, input, select, textarea {
  touch-action: manipulation;
}

/* Button press effect */
.active\:scale-95:active {
  transform: scale(0.95);
}

.active\:scale-98:active {
  transform: scale(0.98);
}

/* Gradient text */
.bg-clip-text {
  -webkit-background-clip: text;
  background-clip: text;
}

/* Drag & Drop Zone Styles */
#dropZone {
  position: relative;
  min-height: 400px; /* Ensure enough height for drop zone */
}

/* Visual cue that this is a drop zone */
#dropZone:not(.drag-over) {
  border-style: dashed !important;
}

/* Highlight effect when dragging */
#dropZone.drag-over {
  border-style: solid !important;
  border-width: 3px !important;
  border-color: #3b82f6 !important;
  background-color: rgba(59, 130, 246, 0.1) !important;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.3), inset 0 0 50px rgba(59, 130, 246, 0.1);
}

#dropZone.drag-over::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 48%, #3b82f6 50%, transparent 52%);
  background-size: 20px 20px;
  opacity: 0.1;
  pointer-events: none;
  z-index: 1;
  animation: moveStripes 1s linear infinite;
}

@keyframes moveStripes {
  0% { background-position: 0 0; }
  100% { background-position: 20px 20px; }
}

/* Drop Overlay - always rendered, but hidden by default */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  display: flex !important; /* Always flex, control with opacity */
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Show overlay when dragging */
#dropZone.drag-over .drop-overlay {
  opacity: 1;
  visibility: visible;
}

.drop-icon {
  animation: bounceUpload 1s ease-in-out infinite;
}

@keyframes bounceUpload {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Mobile File Cards */
.file-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(71, 85, 105, 0.3);
  border-radius: 12px;
  padding: 12px;
  transition: all 0.2s ease;
  position: relative;
  min-height: 80px; /* Minimum height untuk touch-friendly */
}

.file-card:active {
  transform: scale(0.98);
  background: rgba(30, 41, 59, 0.7);
}

.file-card.selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Highlight effect saat checkbox checked */
.file-card:has(.file-card-checkbox:checked) {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.15);
}

.file-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding-left: 55px; /* Space untuk checkbox di kiri */
  position: relative;
  min-height: 48px; /* Minimum height untuk touch target */
}

/* Mobile optimization */
@media (max-width: 768px) {
  .file-card-header {
    padding-left: 72px; /* Lebih besar di mobile untuk checkbox yang lebih besar */
    min-height: 64px; /* Lebih tinggi untuk checkbox center vertical */
  }
}

.file-card-icon {
  font-size: 32px;
  flex-shrink: 0;
}

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

.file-card-name {
  font-weight: 500;
  color: #e2e8f0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.file-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(71, 85, 105, 0.3);
}

.file-card-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.file-card-actions button:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  color: white;
}

.btn-secondary {
  background: rgba(71, 85, 105, 0.5);
  color: #e2e8f0;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
}

/* Checkbox styling for cards */
.file-card-checkbox {
  position: absolute;
  top: 50%; /* Center vertical */
  transform: translateY(-50%); /* Perfect center */
  left: 12px;
  width: 24px;
  height: 24px;
  accent-color: #3b82f6;
  cursor: pointer;
  z-index: 10;
  border-radius: 6px;
  /* Add larger touch target */
  padding: 8px;
  margin: -8px;
  /* Better visibility */
  background: rgba(30, 41, 59, 0.8);
  border: 2px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.file-card-checkbox:checked {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.5);
}

/* Increase touch target for mobile */
@media (max-width: 768px) {
  .file-card-checkbox {
    width: 18px !important; /* Checkbox kecil tapi touch area besar */
    height: 18px !important;
    padding: 13px; /* Touch area 44x44px total - iOS standard */
    margin: -13px;
    left: 12px;
    border-width: 2px;
    border-radius: 5px;
  }
  
  /* Visual feedback saat tap */
  .file-card-checkbox:active {
    transform: translateY(-50%) scale(1.1);
    background: rgba(59, 130, 246, 0.4);
    border-color: #60a5fa;
  }
  
  /* Highlight checkbox area saat card di-tap */
  .file-card:active .file-card-checkbox {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.3);
  }
}


/* Optimized scroll performance for mobile */
#folderSelector {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  will-change: scroll-position;
}

/* Better touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
  #folderSelector button {
    min-height: 48px; /* Minimum touch target size */
    padding: 16px !important;
  }
}

/* Performance hint for browser */
#folderSelector button {
  contain: layout style paint;
}

/* Mobile card actions - only show download button */
@media (max-width: 768px) {
  .file-card-actions .btn-secondary,
  .file-card-actions .btn-danger {
    display: none !important;
  }
  
  .file-card-actions .mobile-download-btn {
    flex: 1;
    width: 100%;
  }
}
