:root { 
  --bg: #0f1237; 
  --card: rgba(255, 255, 255, 0.05); 
  --text: #ffffff; 
  --muted: #a1a1aa; 
  --accent: #7c3aed; 
  --accent-hover: #6d28d9;
  --danger: #ef4444; 
  --success: #10b981;
  --warning: #f59e0b;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --gradient: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  --gradient-accent: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
}

* { 
  box-sizing: border-box; 
  margin: 0;
  padding: 0;
}

html, body { 
  background: var(--bg);
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.28) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.24) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(124, 58, 237, 0.18) 0%, transparent 50%);
  color: var(--text); 
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

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

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

header { 
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 { 
  margin: 0; 
  font-size: 28px; 
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info { 
  display: flex; 
  gap: 16px; 
  align-items: center; 
}

.user-info span { 
  color: var(--accent); 
  font-weight: 600; 
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

main { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 32px 20px; 
  display: grid; 
  gap: 24px; 
}

.card { 
  background: var(--card);
  backdrop-filter: blur(20px);
  padding: 24px; 
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient);
  opacity: 0.5;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.card h2 {
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.row { 
  display: flex; 
  gap: 12px; 
  align-items: center; 
  margin-top: 12px; 
  flex-wrap: wrap; 
}

input[type="text"], input[type="password"], select, input[type="file"] { 
  background: rgba(255, 255, 255, 0.05);
  color: var(--text); 
  border: 1px solid var(--border);
  padding: 12px 16px; 
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

input[type="text"]:focus, input[type="password"]:focus, select:focus { 
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

button { 
  background: var(--gradient-accent);
  color: white;
  border: none; 
  padding: 12px 20px; 
  border-radius: 12px; 
  cursor: pointer; 
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

button:active {
  transform: translateY(0);
}

button.danger { 
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

button.danger:hover {
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.muted { 
  color: var(--muted); 
  margin-top: 8px; 
  font-size: 14px;
}

.album-list { 
  display: flex; 
  gap: 12px; 
  flex-wrap: wrap; 
}

/* Override for all photos grid container */
#albums:has(.all-photos-grid) {
  display: block;
}

.chip { 
  background: rgba(255, 255, 255, 0.1);
  color: var(--text); 
  border: 1px solid var(--border);
  padding: 8px 16px; 
  border-radius: 20px; 
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.chip:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.gallery { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
  gap: 20px; 
}

.image-card { 
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px; 
  padding: 16px; 
  display: flex; 
  flex-direction: column; 
  gap: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.image-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient);
  opacity: 0.3;
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
}

.image-card img { 
  width: 100%; 
  height: 180px; 
  object-fit: cover; 
  border-radius: 12px;
  transition: transform 0.3s ease;
}

.image-card:hover img {
  transform: scale(1.05);
}

.hidden { 
  display: none !important; 
}

/* Auth Styles */
.auth-section { 
  max-width: 420px; 
  margin: 60px auto; 
}

.auth-tabs { 
  display: flex; 
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 4px;
}

.tab { 
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 12px 24px; 
  cursor: pointer; 
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  flex: 1;
}

.tab.active { 
  background: var(--gradient-accent);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.auth-form { 
  background: var(--card);
  backdrop-filter: blur(20px);
  padding: 32px; 
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.auth-form h2 { 
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 600;
}

.auth-form input { 
  width: 100%; 
  margin-bottom: 16px; 
}

.auth-form button { 
  width: 100%; 
  padding: 16px;
  font-size: 16px;
}

/* Admin Panel */
.admin-users { 
  display: grid; 
  gap: 12px; 
}

.admin-user { 
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 16px; 
  border: 1px solid var(--border);
  border-radius: 12px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  transition: all 0.3s ease;
}

.admin-user:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.admin-user .role { 
  color: var(--accent); 
  font-weight: 600;
  padding: 4px 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 20px;
  font-size: 12px;
}

.admin-section { 
  margin-bottom: 24px; 
}

.admin-section h3 { 
  margin: 0 0 16px 0; 
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}

.admin-albums { 
  display: grid; 
  gap: 12px; 
}

.admin-album { 
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 16px; 
  border: 1px solid var(--border);
  border-radius: 12px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  transition: all 0.3s ease;
}

.admin-album:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.admin-album .count { 
  color: var(--muted);
  font-size: 14px;
}

/* Upload Management */
.selected-files { 
  margin-top: 16px; 
}

.file-item { 
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 16px; 
  border: 1px solid var(--border);
  border-radius: 12px; 
  margin-bottom: 12px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  transition: all 0.3s ease;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.file-item .file-info { 
  display: flex; 
  align-items: center; 
  gap: 16px; 
}

.file-item .file-details { 
  display: flex; 
  flex-direction: column; 
  gap: 4px; 
}

.file-item .file-name { 
  font-weight: 600;
  font-size: 14px;
}

.file-item .file-size { 
  color: var(--muted); 
  font-size: 12px; 
}

.file-item .upload-status { 
  font-size: 12px;
  font-weight: 500;
}

.file-item .upload-status.uploading { 
  color: var(--accent); 
}

.file-item .upload-status.success { 
  color: var(--success); 
}

.file-item .upload-status.error { 
  color: var(--danger); 
}

.file-item .upload-status.cancelled { 
  color: var(--muted); 
}

.upload-progress { 
  width: 120px; 
  height: 6px; 
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px; 
  overflow: hidden; 
  margin-left: 12px; 
}

.upload-progress-bar { 
  height: 100%; 
  background: var(--gradient-accent);
  transition: width 0.3s ease;
  border-radius: 3px;
}

.file-preview { 
  width: 60px; 
  height: 60px; 
  object-fit: cover; 
  border-radius: 8px; 
  border: 1px solid var(--border);
}

.file-preview-placeholder { 
  width: 60px; 
  height: 60px; 
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 24px; 
  color: var(--muted);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeIn 0.6s ease-out;
  will-change: transform;
}

/* Performance optimizations */
button {
  will-change: transform;
}

.image-card {
  will-change: transform;
}

/* Reduce animations on slower devices */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* GPU acceleration for smooth animations */
.card, button, .image-card, .chip {
  transform: translateZ(0);
  backface-visibility: hidden;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Optimize scrolling performance */
main, .gallery, .selected-files {
  contain: layout style paint;
}

/* Reduce repaints during scroll */
header {
  contain: layout style paint;
}

.card {
  contain: layout style paint;
}

/* Modern Upload Card Styles */
.upload-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.upload-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  border-radius: 6px 6px 0 0;
}

.upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.upload-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-counter {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.upload-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.album-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.album-selector label {
  font-weight: 600;
  color: #e5e7eb;
  font-size: 0.95rem;
}

.modern-select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  color: #e5e7eb;
  font-size: 1rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.modern-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: rgba(15, 23, 42, 0.9);
}

.file-upload-area {
  border: 2px dashed rgba(59, 130, 246, 0.4);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  background: rgba(59, 130, 246, 0.05);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.file-upload-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.5s ease;
}

.file-upload-area:hover::before {
  left: 100%;
}

.file-upload-area:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.file-upload-area.dragover {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.8;
}

.upload-text h3 {
  margin: 0 0 8px 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #e5e7eb;
}

.upload-text p {
  margin: 0;
  color: #9ca3af;
  font-size: 0.95rem;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-btn {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 16px;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, #2563eb, #1e40af);
}

.upload-actions {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.upload-all-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.upload-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669, #047857);
}

.upload-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  transition: all 0.3s ease;
}

.upload-message.success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.upload-message.error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Individual upload button */
.upload-single-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.upload-single-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  background: linear-gradient(135deg, #059669, #047857);
}

.remove-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.remove-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.cancel-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.cancel-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, #d97706, #b45309);
}

.file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* View Controls */
.view-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.view-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  color: #9ca3af;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.view-btn.active {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.view-btn:hover:not(.active) {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

/* All Photos Grid */
.all-photos-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
  gap: 16px;
  margin-top: 20px;
  width: 100%;
}

.all-photo-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: 100%;
}

.all-photo-item a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
}

.all-photo-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border-color: #3b82f6;
}

.all-photo-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.all-photo-item:hover img {
  transform: scale(1.05);
}

.all-photo-info {
  padding: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}

.all-photo-album {
  font-size: 0.9rem;
  font-weight: 600;
  color: #3b82f6;
  margin-bottom: 4px;
}

.all-photo-uploader {
  font-size: 0.85rem;
  color: #9ca3af;
}

/* PhotoSwipe Custom Styles */
.pswp__bg {
  background: rgba(0, 0, 0, 0.9) !important;
}

.pswp__ui {
  --pswp-icon-color: #ffffff;
}

.pswp__button--close {
  background: rgba(0, 0, 0, 0.5) !important;
  border-radius: 50% !important;
  width: 44px !important;
  height: 44px !important;
}

.pswp__button--arrow--prev,
.pswp__button--arrow--next {
  background: rgba(0, 0, 0, 0.5) !important;
  border-radius: 50% !important;
  width: 44px !important;
  height: 44px !important;
}

.pswp__caption {
  background: rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 16px !important;
}

.pswp__caption__center {
  text-align: center;
  color: #ffffff;
  font-size: 14px;
  line-height: 1.4;
}

/* Disable autocomplete */
input[type="text"], input[type="password"] {
  autocomplete: off;
  -webkit-autocomplete: off;
  -moz-autocomplete: off;
}

/* Responsive Design */
@media (max-width: 768px) {
  main {
    padding: 20px 16px;
    gap: 20px;
  }
  
  .card {
    padding: 20px;
  }
  
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }
  
  .all-photos-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }
  
  .row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .row > * {
    width: 100%;
  }
  
  header {
    padding: 16px 0;
  }
  
  h1 {
    font-size: 24px;
  }
}

/* Enhanced scroll performance optimizations */
* {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  scroll-behavior: smooth;
}

/* GPU acceleration for all interactive elements */
.card, button, .image-card, .chip, .file-item, .all-photo-item {
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

/* Optimize scrolling performance */
main, .gallery, .selected-files, .all-photos-grid {
  contain: layout style paint;
  transform: translateZ(0);
}

/* Reduce repaints during scroll */
header, .card, .image-card, .file-item, .all-photo-item {
  contain: layout style paint;
  transform: translateZ(0);
}

/* Scroll performance optimizations */
body.scrolling .card {
  will-change: transform;
}

body.scrolling .image-card {
  will-change: transform;
}

body.scrolling button {
  will-change: transform;
}

body.scrolling .file-item {
  will-change: transform;
}

body.scrolling .all-photo-item {
  will-change: transform;
}

/* Smooth animations */
.card, button, .image-card, .chip, .file-item, .all-photo-item {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduce motion for better performance */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Custom Image Modal Styles - With Click Animation */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, visibility, transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.image-modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.image-modal.animate-in .modal-content {
  animation: modalScaleIn 0.3s ease-out;
}

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

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
  will-change: opacity;
  opacity: 0;
}

.image-modal.animate-in .modal-backdrop {
  animation: backdropFadeIn 0.3s ease-out forwards;
}

.image-modal.animate-out .modal-backdrop {
  animation: backdropFadeOut 0.2s ease-in forwards;
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transform: scale(0.3) translateZ(0);
  transform-origin: center center;
  display: flex;
  flex-direction: column;
  will-change: transform;
  backface-visibility: hidden;
  opacity: 0;
}

.image-modal.animate-in .modal-content {
  opacity: 1;
  transform: scale(1) translateZ(0);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.8);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
  will-change: background-color;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.9);
}

.modal-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px 8px 0 0;
  display: block;
  will-change: transform;
}

.modal-info {
  padding: 16px;
  background: rgba(0, 0, 0, 0.9);
  border-top: 1px solid rgba(59, 130, 246, 0.2);
}

.modal-album {
  font-size: 1rem;
  font-weight: 600;
  color: #3b82f6;
  margin-bottom: 6px;
}

.modal-uploader {
  font-size: 0.9rem;
  color: #9ca3af;
  margin-bottom: 3px;
}

.modal-filename {
  font-size: 0.85rem;
  color: #6b7280;
  font-style: italic;
}

/* Modal Scale Animations */
@keyframes modalScaleIn {
  0% {
    transform: scale(0.3) translateZ(0);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateZ(0);
    opacity: 1;
  }
}

@keyframes modalScaleOut {
  0% {
    transform: scale(1) translateZ(0);
    opacity: 1;
  }
  100% {
    transform: scale(0.3) translateZ(0);
    opacity: 0;
  }
}

@keyframes backdropFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes backdropFadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-content {
    max-width: 95vw;
    max-height: 95vh;
    margin: 20px;
  }
  
  .modal-content img {
    max-height: 60vh;
  }
  
  .modal-info {
    padding: 16px;
  }
  
  .modal-close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
}