/* Modern CSS with enhanced UI - Fully Responsive */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* Background gradient */
.bg-gradient {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Enhanced card styles */
.card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  height: 100%;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.15) !important;
}

/* Logo animation */
.logo-icon {
  animation: float 3s ease-in-out infinite;
}

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

/* Responsive font sizes */
@media (max-width: 576px) {
  .h2-md {
    font-size: 1.5rem;
  }
  .small-md {
    font-size: 0.9rem;
  }
  .fs-md-2 {
    font-size: 2rem !important;
  }
}

/* Enhanced collage container - FULLY RESPONSIVE */
.collage {
  width: 100%;
  max-width: 530px;
  height: auto;
  aspect-ratio: 1 / 1;
  position: relative;
  background: linear-gradient(45deg, #f3f3f3 25%, #ffffff 25%, #ffffff 50%, #f3f3f3 50%, #f3f3f3 75%, #ffffff 75%);
  background-size: 20px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  margin: 0 auto;
}

.collage:hover {
  box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

/* Preview container - Responsive */
.preview-container {
  min-height: auto;
  min-height: 300px;
  max-height: 600px;
  background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
  border-radius: 16px;
  padding: 15px;
  border: 1px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .preview-container {
    min-height: 450px;
    padding: 20px;
  }
}

@media (min-width: 992px) {
  .preview-container {
    min-height: 550px;
  }
}

/* Enhanced drop area */
.drop-area-enhanced {
  border: 2px dashed #cbd5e0;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 100%);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .drop-area-enhanced {
    border-width: 3px;
  }
}

.drop-area-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.drop-area-enhanced:hover {
  border-color: #667eea;
  background: linear-gradient(135deg, #eef2f6 0%, #e2e8f0 100%);
  transform: scale(1.01);
}

@media (min-width: 768px) {
  .drop-area-enhanced:hover {
    transform: scale(1.02);
  }
}

.drop-area-enhanced:hover::before {
  left: 100%;
}

/* Drag over state */
.drop-area-enhanced.drag-over {
  border-color: #667eea;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  transform: scale(1.01);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

@media (min-width: 768px) {
  .drop-area-enhanced.drag-over {
    transform: scale(1.02);
  }
}

.drop-area-enhanced.drag-over .cloud-icon {
  animation: pulse 1s ease infinite;
}

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

.cloud-icon {
  animation: bounce 2s ease infinite;
}

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

@media (min-width: 768px) {
  @keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }
}

/* Enhanced form controls */
.form-select {
  border: 2px solid transparent;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .form-select {
    font-size: 1rem;
  }
}

.form-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Photo frame - Responsive */
.frame {
  position: absolute;
  box-sizing: border-box;
  overflow: hidden;
  border: 2px solid #fff;
  padding: 2px;
  background-color: #f2f2f2;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-origin: content-box;
  background-clip: content-box;
  cursor: grab;
  user-select: none;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: box-shadow 0.3s ease;
}

@media (min-width: 768px) {
  .frame {
    border-width: 4px;
    padding: 4px;
    border-radius: 8px;
  }
}

.frame:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  z-index: 5;
}

.frame:active {
  cursor: grabbing;
  opacity: 0.95;
}

/* Zoom controls - Responsive */
.zoom-controls {
  position: absolute;
  bottom: 5px;
  right: 5px;
  display: flex;
  gap: 4px;
  z-index: 10;
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.3s ease;
}

@media (min-width: 768px) {
  .zoom-controls {
    bottom: 10px;
    right: 10px;
    gap: 6px;
    transform: translateY(10px);
  }
}

.frame:hover .zoom-controls {
  opacity: 1;
  transform: translateY(0);
}

.zoom-controls button {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  font-weight: bold;
  background: rgba(255,255,255,0.9);
  color: #333;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
}

@media (min-width: 768px) {
  .zoom-controls button {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }
}

.zoom-controls button:hover {
  background: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Buttons - Responsive */
.btn {
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .btn {
    font-size: 1rem;
  }
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
  border: none;
}

.btn-success:hover {
  background: linear-gradient(135deg, #319795 0%, #2c7a7b 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(49, 151, 149, 0.4);
}

/* Divider */
.divider {
  color: #6c757d;
}

.divider hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, #dee2e6, transparent);
  margin: 0.5rem 0;
}

/* Badges */
.badge {
  font-weight: 500;
  letter-spacing: 0.3px;
  font-size: 0.75rem;
}

@media (min-width: 768px) {
  .badge {
    font-size: 0.875rem;
  }
}

/* Pro tips section */
.pro-tips {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 8px;
  padding: 12px;
  border-left: 4px solid #f59e0b;
}

.pro-tips-mobile {
  margin-top: 1rem;
}

.pro-tips-mobile p {
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Loading animation */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  border-top-color: #667eea;
  animation: spin 1s ease-in-out infinite;
}

@media (min-width: 768px) {
  .loading {
    width: 20px;
    height: 20px;
    border-width: 3px;
  }
}

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

/* Photo count indicator */
#photoCountDisplay, #maxPhotoCount {
  font-weight: 600;
  color: #667eea;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 5px;
}

@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 8px;
  }
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .frame:hover {
    transform: none;
  }
  
  .zoom-controls {
    opacity: 1;
    transform: translateY(0);
  }
  
  .zoom-controls button {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.95);
  }
  
  .btn:hover {
    transform: none;
  }
  
  .drop-area-enhanced:hover {
    transform: none;
  }
}

/* Small mobile devices */
@media (max-width: 380px) {
  .preview-container {
    padding: 8px;
  }
  
  .zoom-controls button {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }
  
  .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
}

/* Landscape mode on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .preview-container {
    min-height: 250px;
  }
  
  .collage {
    max-width: 400px;
  }
  
  .card-body {
    padding: 1rem;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 991px) {
  .preview-container {
    min-height: 400px;
  }
  
  .collage {
    max-width: 450px;
  }
}