/* Modern Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Attractive Header */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    color: #1f2937;
    margin-bottom: 1rem;
}

/* Upload Box Styling */
.upload-box {
    border: 2px dashed #4f46e5;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: #4338ca;
    background: #f3f4f6;
}

.upload-box.dragover {
    background: #e0e7ff;
    border-color: #4338ca;
}

.upload-instructions {
    color: #4b5563;
}

.upload-instructions i {
    font-size: 3rem;
    color: #4f46e5;
    margin-bottom: 1rem;
}

#browseBtn {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    margin: 1rem 0;
    cursor: pointer;
    transition: all 0.2s;
}

#browseBtn:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

/* Convert Button */
#convertBtn {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 1.5rem 0;
    cursor: pointer;
    transition: all 0.2s;
}

#convertBtn:hover:not(:disabled) {
    background: #4338ca;
    transform: translateY(-1px);
}

#convertBtn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    margin: 1.5rem 0;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: #4f46e5;
    transition: width 0.3s ease;
}

#progressText {
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: #6b7280;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    background: #f3f4f6;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle button.active {
    background: #4f46e5;
    color: white;
}

/* Upload preview grid shown after selection (before convert) */
.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #f8fafc;
  margin-top: 14px;
}
.upload-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.upload-preview-item img {
  width: 100%; height: 100%; object-fit: cover;
}
.upload-preview-item .filename {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  background: rgba(0,0,0,.55);
  color: #fff; padding: 3px 6px; border-radius: 6px;
  font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Gallery View */
.gallery-view {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px; margin: 16px 0;
}

.gallery-item {
  position: relative; background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 6px 14px rgba(0,0,0,.08); transition: transform .2s ease;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}

.gallery-item:hover { transform: translateY(-4px); }

.gallery-item img {
    width:100%;
    height:140px;
    object-fit: cover;
    border-radius: 8px;
    background: #f3f4f6;
}

.gallery-meta {
    font-size:.86rem;
    color:#4b5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nicer floating download button on hover */
.gallery-download {
  position: absolute; top: 10px; right: 10px;
  border: none; border-radius: 999px; padding: 8px 12px;
  background: rgba(79,70,229,.95); color:#fff; cursor: pointer;
  box-shadow: 0 8px 20px rgba(79,70,229,.35);
  display: none; align-items: center; gap: 6px; font-weight: 600;
}
.gallery-item:hover .gallery-download { display: inline-flex; }

/* List View Improvements */
.list-view {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background:#fff;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 6px 14px rgba(0,0,0,.06);
}

.list-item img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    background:#f3f4f6;
}

.list-meta {
    flex:1;
    min-width:0;
}

.list-meta .line {
  font-size:.9rem; color:#374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Better download buttons */
.list-download, .btn-zip {
  border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color:#fff; font-weight:700;
  box-shadow: 0 8px 20px rgba(124,58,237,.25);
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.list-download:hover, .btn-zip:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(124,58,237,.35); }

/* Add New Image button */
.add-more { display:flex; justify-content:center; margin: 18px 0 10px; }
#addNewBtn {
  border: 2px dashed #4f46e5; color:#4f46e5; background:#fff;
  border-radius: 12px; padding: 10px 16px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
#addNewBtn:hover { background:#eef2ff; }

/* Progress bar polish */
.progress-bar { height: 10px; border-radius: 6px; background:#e5e7eb; position:relative; overflow:hidden; margin: 8px 0 10px; }
.progress-fill { height: 100%; background: linear-gradient(90deg,#4f46e5,#06b6d4); width:0%; transition: width .3s ease; }
#progressText { position:absolute; top:-22px; left:50%; transform:translateX(-50%); font-size:.85rem; color:#6b7280; }

/* Responsive */
@media (max-width: 768px){
  .gallery-view { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}