/**
 * Bulk JPG to PNG Converter Pro — Frontend Styles
 * Premium SaaS-style card layout with soft shadows and smooth transitions.
 */

/* ── CSS Custom Properties ───────────────────────────────────────────────── */
.bjpng-wrapper {
    --bjpng-primary:       #6366f1;
    --bjpng-primary-dark:  #4f46e5;
    --bjpng-accent:        #8b5cf6;
    --bjpng-success:       #10b981;
    --bjpng-success-bg:    #d1fae5;
    --bjpng-success-text:  #065f46;
    --bjpng-error:         #ef4444;
    --bjpng-error-bg:      #fee2e2;
    --bjpng-error-text:    #991b1b;
    --bjpng-border:        #e5e7eb;
    --bjpng-bg:            #f9fafb;
    --bjpng-card-bg:       #ffffff;
    --bjpng-text:          #111827;
    --bjpng-text-muted:    #6b7280;
    --bjpng-radius:        14px;
    --bjpng-shadow:        0 4px 24px rgba(99,102,241,.08), 0 1px 4px rgba(0,0,0,.04);
    --bjpng-transition:    .2s cubic-bezier(.4,0,.2,1);

    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    max-width: 680px;
    margin: 32px auto;
    background: var(--bjpng-bg);
    border-radius: var(--bjpng-radius);
    padding: 0;
}

/* ── Card Shell ──────────────────────────────────────────────────────────── */
.bjpng-wrapper > * {
    background: var(--bjpng-card-bg);
    border: 1px solid var(--bjpng-border);
    border-radius: var(--bjpng-radius);
    box-shadow: var(--bjpng-shadow);
    margin-bottom: 12px;
    padding: 24px 28px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.bjpng-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--bjpng-border);
    border-radius: var(--bjpng-radius) var(--bjpng-radius) 0 0 !important;
    margin-bottom: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    background: linear-gradient(135deg, #f0f0ff 0%, #faf5ff 100%) !important;
}

.bjpng-header-icon svg {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.bjpng-title {
    margin: 0 0 4px !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--bjpng-text) !important;
    letter-spacing: -.02em;
}

.bjpng-subtitle {
    margin: 0 !important;
    font-size: .875rem !important;
    color: var(--bjpng-text-muted) !important;
}

/* ── Drop Zone ───────────────────────────────────────────────────────────── */
.bjpng-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    min-height: 200px;
    border: 2px dashed var(--bjpng-border) !important;
    background: var(--bjpng-bg) !important;
    cursor: pointer;
    transition: border-color var(--bjpng-transition), background var(--bjpng-transition);
    outline: none;
}

.bjpng-dropzone:hover,
.bjpng-dropzone:focus-visible {
    border-color: var(--bjpng-primary) !important;
    background: #eff0ff !important;
}

.bjpng-dropzone.bjpng-drag-over {
    border-color: var(--bjpng-primary) !important;
    background: #eff0ff !important;
    transform: scale(1.01);
}

.bjpng-drop-icon {
    color: var(--bjpng-primary);
    width: 52px;
    height: 52px;
    background: #eff0ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.bjpng-drop-icon svg {
    width: 28px;
    height: 28px;
}

.bjpng-drop-primary {
    margin: 0 !important;
    font-weight: 600;
    font-size: 1rem;
    color: var(--bjpng-text);
}

.bjpng-drop-secondary {
    margin: 0 !important;
    font-size: .875rem;
    color: var(--bjpng-text-muted);
}

.bjpng-browse-btn {
    background: none;
    border: none;
    color: var(--bjpng-primary);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color var(--bjpng-transition);
}

.bjpng-browse-btn:hover,
.bjpng-browse-btn:focus-visible {
    text-decoration-color: var(--bjpng-primary);
    outline: none;
}

.bjpng-drop-hint {
    margin: 4px 0 0 !important;
    font-size: .78rem;
    color: var(--bjpng-text-muted);
}

/* ── File List ───────────────────────────────────────────────────────────── */
.bjpng-file-list-wrap {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

.bjpng-file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.bjpng-file-count {
    font-size: .85rem;
    font-weight: 600;
    color: var(--bjpng-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.bjpng-clear-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid var(--bjpng-border);
    color: var(--bjpng-text-muted);
    font-size: .8rem;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all var(--bjpng-transition);
}

.bjpng-clear-btn svg {
    width: 14px;
    height: 14px;
}

.bjpng-clear-btn:hover {
    border-color: var(--bjpng-error);
    color: var(--bjpng-error);
    background: var(--bjpng-error-bg);
}

.bjpng-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
}

.bjpng-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bjpng-bg);
    border: 1px solid var(--bjpng-border);
    border-radius: 8px;
    transition: border-color var(--bjpng-transition);
    animation: bjpng-slide-in .2s ease;
}

@keyframes bjpng-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bjpng-file-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    letter-spacing: .02em;
}

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

.bjpng-file-name {
    font-size: .875rem;
    font-weight: 500;
    color: var(--bjpng-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.bjpng-file-size {
    font-size: .75rem;
    color: var(--bjpng-text-muted);
}

.bjpng-file-status {
    font-size: .75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.bjpng-status-pending  { background: #f3f4f6; color: #6b7280; }
.bjpng-status-done     { background: var(--bjpng-success-bg); color: var(--bjpng-success-text); }
.bjpng-status-error    { background: var(--bjpng-error-bg); color: var(--bjpng-error-text); }
.bjpng-status-working  {
    background: #eff0ff;
    color: var(--bjpng-primary);
    animation: bjpng-pulse 1.2s ease-in-out infinite;
}

@keyframes bjpng-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .5; }
}

/* ── Progress ────────────────────────────────────────────────────────────── */
.bjpng-progress-wrap {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

.bjpng-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--bjpng-text);
}

.bjpng-progress-bar-bg {
    background: #e5e7eb;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.bjpng-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--bjpng-primary), var(--bjpng-accent));
    border-radius: 999px;
    transition: width .4s cubic-bezier(.4,0,.2,1);
    position: relative;
}

.bjpng-progress-bar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
    animation: bjpng-shimmer 1.5s infinite;
}

@keyframes bjpng-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.bjpng-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px !important;
    border-radius: 10px !important;
    border-width: 1px;
    border-style: solid;
    animation: bjpng-fade-in .3s ease;
}

@keyframes bjpng-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bjpng-alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.bjpng-alert strong {
    display: block;
    font-size: .9rem;
}

.bjpng-alert p {
    margin: 2px 0 0 !important;
    font-size: .85rem;
}

.bjpng-alert-success {
    background: var(--bjpng-success-bg) !important;
    border-color: #6ee7b7 !important;
    color: var(--bjpng-success-text) !important;
}

.bjpng-alert-error {
    background: var(--bjpng-error-bg) !important;
    border-color: #fca5a5 !important;
    color: var(--bjpng-error-text) !important;
}

/* ── Actions / Buttons ───────────────────────────────────────────────────── */
.bjpng-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding-top: 20px !important;
    padding-bottom: 20px !important;
    border-top: 1px solid var(--bjpng-border) !important;
    background: linear-gradient(135deg, #f9f9ff 0%, #fdf9ff 100%) !important;
    border-radius: 0 0 var(--bjpng-radius) var(--bjpng-radius) !important;
}

/* Convert button — gradient CTA */
.bjpng-btn-convert {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--bjpng-primary), var(--bjpng-accent));
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--bjpng-transition);
    box-shadow: 0 4px 12px rgba(99,102,241,.35);
    letter-spacing: .01em;
}

.bjpng-btn-convert svg {
    width: 16px;
    height: 16px;
}

.bjpng-btn-convert:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,102,241,.45);
}

.bjpng-btn-convert:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
}

.bjpng-btn-convert:disabled {
    opacity: .5;
    cursor: not-allowed;
    box-shadow: none;
}

.bjpng-btn-convert:focus-visible {
    outline: 3px solid rgba(99,102,241,.4);
    outline-offset: 2px;
}

/* Download again button */
.bjpng-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bjpng-success-bg);
    color: var(--bjpng-success-text);
    border: 1px solid #6ee7b7;
    border-radius: 10px;
    padding: 11px 20px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--bjpng-transition);
}

.bjpng-btn-download svg {
    width: 16px;
    height: 16px;
}

.bjpng-btn-download:hover {
    background: #a7f3d0;
    color: var(--bjpng-success-text);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Reset button */
.bjpng-btn-reset {
    background: none;
    border: 1px solid var(--bjpng-border);
    color: var(--bjpng-text-muted);
    border-radius: 10px;
    padding: 11px 18px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--bjpng-transition);
}

.bjpng-btn-reset:hover {
    border-color: var(--bjpng-primary);
    color: var(--bjpng-primary);
    background: #eff0ff;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
    .bjpng-wrapper {
        margin: 16px;
    }

    .bjpng-wrapper > * {
        padding: 18px 16px;
        border-radius: 10px;
    }

    .bjpng-dropzone {
        min-height: 160px;
    }

    .bjpng-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .bjpng-btn-convert,
    .bjpng-btn-download,
    .bjpng-btn-reset {
        width: 100%;
        justify-content: center;
    }

    .bjpng-header {
        flex-direction: column;
        text-align: center;
    }
}
