.bg-remover-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 768px) {
    .bg-remover-layout { grid-template-columns: 1fr; }
}

    

.canvas-wrap {
        flex: 1;
    min-width: 300px;
    background: #0f172a;
    padding: 45px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
}
.canvas-wrap canvas { display: block; max-width: 100%; border-radius: 8px; }

.settings-panel {
    background: #fff;
    border: 1px solid #e8eaf6;
    border-radius: 12px;
    padding: 20px;
    position: sticky;
    top: 80px;
}
.settings-panel h5 {
    font-size: 14px; font-weight: 600; color: #3d4066;
    margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f7;
}
.panel-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; color: #9fa8da; margin: 16px 0 8px;
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.color-swatch {
    width: 100%; aspect-ratio: 1; border-radius: 6px; cursor: pointer;
    border: px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
    box-shadow: 0 0 5px var(--primary);
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.active { border-color: #3d5afe; box-shadow: 0 0 0 2px var(--primary) inset; }
.color-swatch.transparent-swatch {
    background: repeating-conic-gradient(#bbb 0% 25%, #fff 0% 50%) 0 0 / 10px 10px;
}

.custom-color-row {
    display: flex; align-items: center; gap: 8px; margin-top: 8px;
}
.custom-color-row input[type="color"] {
    width: 36px; height: 36px; border: 1px solid #e0e0e0;
    border-radius: 6px; cursor: pointer; padding: 2px; background: none;
}
.custom-color-row label { font-size: 13px; color: #5c6080; }

.process-bar-wrap { margin: 14px 0 0; display: none; }
.process-bar-track { background: #e8eaf6; border-radius: 99px; height: 7px; overflow: hidden; }
.process-bar-fill {
    height: 100%; background: linear-gradient(90deg, #3d5afe, #00ffff);
    width: 0%; border-radius: 99px; transition: width 0.4s;
}
.process-bar-label { font-size: 12px; color: #7986cb; margin-top: 6px; text-align: center; }

#resultArea { display: none; margin-top: 20px; }
.result-img-wrap {
    flex: 1;
    min-width: 300px;
    background: #0f172a;
    padding: 45px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
}
.result-img-wrap canvas { 
    display: block; max-width: 100%; 
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #f5f5f5 0% 50%) 0 0 / 20px 20px;
    align-items: center; justify-content: center;
}

.btn-primary-custom {
    display: inline-block; background: #3d5afe; color: #fff;
    border: none; border-radius: 8px; padding: 11px 20px;
    font-size: 14px; font-weight: 600; cursor: pointer; width: 100%;
    text-align: center; transition: background 0.2s, transform 0.1s; margin-top: 14px;
}
.btn-primary-custom:hover { background: #2844f7; }
.btn-primary-custom:active { transform: scale(0.98); }
.btn-primary-custom:disabled { background: #9fa8da; cursor: not-allowed; }

.btn-outline-custom {
    display: inline-block; background: transparent; color: #3d5afe;
    border: 1.5px solid #3d5afe; border-radius: 8px; padding: 9px 20px;
    font-size: 14px; font-weight: 600; cursor: pointer; width: 100%;
    text-align: center; transition: background 0.2s; margin-top: 8px; text-decoration: none;
}
.btn-outline-custom:hover { background: #eef0ff; }

.spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.7s linear infinite;
    vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.upload-progress-wrapper { margin-top: 16px; display: none; }
.upload-progress-bar { background: #e8eaf6; border-radius: 99px; height: 6px; overflow: hidden; }
#uploadProgressBar {
    height: 100%; background: linear-gradient(90deg, #3d5afe, #00ffff);
    width: 0%; border-radius: 99px; transition: width 0.15s;
}
.upload-progress-text { font-size: 12px; color: #7986cb; margin-top: 6px; text-align: center; }

.model-status {
    font-size: 12px; padding: 7px 12px; border-radius: 6px;
    margin-top: 12px; display: none;
}
.model-status.loading { background: #fff8e1; color: #e65100; }
.model-status.ready   { background: #e8f5e9; color: #2e7d32; }

#toastContainer { position: fixed; right: 20px; z-index: 9999; }

/* ── Background Image Upload Box ── */
.bg-img-upload-box {
    border: 1.5px dashed #c5cae9;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    color: #7986cb;
    background: #f8f9ff;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    margin-bottom: 10px;
}
.bg-img-upload-box:hover { border-color: #3d5afe; background: #eef0ff; }
.bg-img-upload-box input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.bg-img-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.bg-img-thumb {
    aspect-ratio: 16/10;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    background-size: cover;
    background-position: center;
    transition: border-color 0.15s, transform 0.15s;
}
.bg-img-thumb:hover { transform: scale(1.05); border-color: #9fa8da; }
.bg-img-thumb.active { border-color: #3d5afe; }
.crop-settings-panel {
    width: 280px;
    background: #111827;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}
.crop-settings-panel h5{
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary);
}

.canvas-wrap {
    position: relative; /* important */
}


.result-area {
    position: relative; /* important */
}

.canvas-label {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 11px;
    color: var(--primary);
    background: rgba(0,0,0,0.5);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: .5px;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.crop-settings-panel {
    position: sticky;
    top: 100px;
    transition: top 0.2s ease;
}

#bgImgGrid::-webkit-scrollbar {
    width: 6px;
}

#bgImgGrid::-webkit-scrollbar-thumb {
    background: #9fa8da;
    border-radius: 10px;
}

#bgImgGrid::-webkit-scrollbar-track {
    background: transparent;
}
#bgImgGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;

    max-height: 150px; /* 🔥 9 items (3x3) fit করবে */
    overflow-y: auto;
    padding-right: 4px; /* scrollbar gap */
}
.bg-img-thumb:hover {
    transform: scale(1.05);
}
.color-picker-conic {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}


.cone-inner {
    width: 100%;
    height: 100%;
    background: conic-gradient(#FF2E00, #FEE600, #05FF00, #00FFFF, #1400FF, #FF00E5, #FF0000);
    transition: all 0.1s ease-in;
    border-radius: 50%;
    border: 1px solid var(--primary);;
}

/* hidden color input overlay */
.color-picker-conic input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
