/* 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)); }
}

/* ============================================================================ */
/* Dark Theme & Advanced Styles (Migrated from template inline CSS) */
/* ============================================================================ */

/* Tool Page Wrapper */
.tool-page-wrapper {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    min-height: 100vh;
    padding-bottom: 4rem;
}

/* Tool Hero */
.tool-hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.hero-content-tool {
    max-width: 800px;
    margin: 0 auto;
}

.tool-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.tool-hero h1 {
    font-size: 2.8rem;
    color: white;
    margin-bottom: 1rem;
    font-weight: 800;
}

.tool-hero p {
    font-size: 1.2rem;
    color: #c7d2fe;
    max-width: 600px;
    margin: 0 auto;
}

/* How It Works Section */
.how-it-works {
    padding: 4rem 2rem;
    text-align: center;
}

.how-it-works h2 {
    font-size: 2rem;
    color: white;
    margin-bottom: 3rem;
}

.steps-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 1000px;
    margin: 0 auto;
}

.step-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 2rem;
    width: 200px;
    position: relative;
    transition: all 0.3s ease;
}

.step-card:hover {
    transform: translateY(-5px);
    border-color: #818cf8;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.2);
}

.step-icon {
    position: relative;
    margin-bottom: 1rem;
}

.step-emoji {
    font-size: 3rem;
    display: block;
    animation: bounce 2s ease-in-out infinite;
}

.step-card:nth-child(1) .step-emoji { animation-delay: 0s; }
.step-card:nth-child(3) .step-emoji { animation-delay: 0.3s; }
.step-card:nth-child(5) .step-emoji { animation-delay: 0.6s; }

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

.step-number {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.step-card h3 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.step-card p {
    color: #94a3b8;
    font-size: 0.9rem;
}

.step-arrow {
    color: #6366f1;
    animation: arrowPulse 1.5s ease-in-out infinite;
}

@keyframes arrowPulse {
    0%, 100% { opacity: 0.5; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(5px); }
}

/* Tool Container */
.tool-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Upload Box Enhancement (Dark Theme) */
.tool-container .upload-box {
    border: 2px dashed #6366f1;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    background: rgba(30, 41, 59, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-container .upload-box:hover {
    border-color: #818cf8;
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
}

.tool-container .upload-icon-wrapper {
    position: relative;
    display: inline-block;
}

.tool-container .upload-icon-wrapper i {
    font-size: 4rem;
    color: #6366f1;
}

.tool-container .upload-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.2);
    animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.tool-container .upload-instructions p {
    color: #c7d2fe;
    margin: 1rem 0;
}

.tool-container .upload-limit {
    font-size: 0.85rem !important;
    color: #94a3b8 !important;
}

.tool-container #browseBtn {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-container #browseBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.4);
}

/* Convert Button (Dark Theme) */
.tool-container .convert-actions {
    text-align: center;
    margin: 2rem 0;
}

.tool-container #convertBtn {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-container #convertBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

.tool-container #convertBtn:disabled {
    background: #475569;
    cursor: not-allowed;
}

.tool-container .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Progress Bar (Dark Theme) */
.tool-container .progress-bar {
    height: 10px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 5px;
    margin: 1.5rem 0;
    overflow: hidden;
    position: relative;
}

.tool-container .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.tool-container #progressText {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Download Button (Dark Theme) */
.tool-container .btn-zip {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-container .btn-zip:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
}

.tool-container .btn-zip:disabled {
    background: #475569;
    cursor: not-allowed;
}

/* Features Section */
.tool-features {
    padding: 4rem 2rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.5);
}

.tool-features h2 {
    font-size: 2rem;
    color: white;
    margin-bottom: 3rem;
}

.features-grid-tool {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-item {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.feature-emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
}

.feature-item h3 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.feature-item p {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* Supported Formats */
.supported-formats {
    padding: 3rem 2rem;
    text-align: center;
}

.supported-formats h2 {
    font-size: 1.8rem;
    color: white;
    margin-bottom: 2rem;
}

.formats-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.format-badge {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.format-badge:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
}

/* Blog Section */
.tool-blog {
    padding: 4rem 2rem;
    background: #0f172a;
}

.blog-container-tool {
    max-width: 900px;
    margin: 0 auto;
}

.tool-blog h2 {
    font-size: 2rem;
    color: white;
    text-align: center;
    margin-bottom: 3rem;
}

.blog-article {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 3rem;
}

.blog-article h3 {
    color: #a5b4fc;
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.blog-article h3:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.blog-article h4 {
    color: #c7d2fe;
    font-size: 1.2rem;
    margin: 1.5rem 0 0.5rem;
}

.blog-article p {
    color: #cbd5e1;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.blog-list {
    color: #cbd5e1;
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.blog-list li {
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

.blog-list.numbered {
    list-style-type: decimal;
}

.blog-list a {
    color: #818cf8;
    text-decoration: none;
}

.blog-list a:hover {
    text-decoration: underline;
}

/* Comparison Table */
.comparison-table {
    overflow-x: auto;
    margin: 2rem 0;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.comparison-table th {
    background: rgba(99, 102, 241, 0.2);
    color: white;
    font-weight: 600;
}

.comparison-table td {
    color: #c7d2fe;
}

/* FAQ Items */
.faq-item {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.faq-item h4 {
    color: #818cf8;
    margin-bottom: 0.5rem;
}

.faq-item p {
    margin-bottom: 0;
}

/* Responsive - Dark Theme */
@media (max-width: 768px) {
    .tool-hero h1 { font-size: 2rem; }
    .steps-container { flex-direction: column; }
    .step-arrow { transform: rotate(90deg); }
    .step-card { width: 100%; max-width: 280px; }
    .blog-article { padding: 1.5rem; }
}